Skip to content

Conversation

@rosskukulinski
Copy link

Summary

The quantity field does not exist in the ListItem protobuf schema (see lib/definitions.json). Including it in _encode() causes protobuf encoding errors when calling methods like removeItem() that need to encode the item.

Problem

When trying to remove an item from a list using list.removeItem(item), the following error occurs:

.pcov.proto.ListItem#quantity is not a field: undefined

This happens because _encode() tries to include quantity: this._quantity but the protobuf schema for ListItem doesn't have a quantity field.

Solution

Remove the quantity field from the _encode() method since it's not part of the protobuf schema.

🤖 Generated with Claude Code

The 'quantity' field does not exist in the ListItem protobuf schema
(see lib/definitions.json). Including it in _encode() causes protobuf
encoding errors when calling methods like removeItem() that need to
encode the item.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kevdliu
Copy link
Collaborator

kevdliu commented Dec 27, 2025

Hi, thanks for the PR. After looking through the codebase again (I wasn't the original author), it seems like the quantity property shouldn't be working at all with the current implementation. Instead of only removing the property from the encode method, I think we should be through and remove it from the Item class altogether. What do you think?

@rosskukulinski
Copy link
Author

Hi @kevdliu - I went the other direction and dug in more into how anylist's APIs work. I pushed #52 which fixes quantity encoding/decoding, added a mocha test suite for the Item class, and the necessary package.json/lock to pull in the test frameworks.

Separately - I grabbed a fresh protobuf definition from their webclient which you can find in #53.

Open to feedback on a test frameworks - Mocha was what I've used in the past, but happy to swap to something else if you want me to.

My thinking:

  1. Close this PR
  2. Merge Fix quantity field encoding/decoding and add test suite #52
  3. (?) Merge Update protobuf definitions from AnyList webapp #53
  4. Give me the go-ahead to expand test coverage for the other classes with a test framework of your choosing.

Let me know where I should go from here! Happy new year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants