Skip to content

5667 add more robust inventory tracking approach - #5696

Open
armahillo wants to merge 3 commits into
mainfrom
5667-add-more-robust-inventory-tracking-approach
Open

5667 add more robust inventory tracking approach#5696
armahillo wants to merge 3 commits into
mainfrom
5667-add-more-robust-inventory-tracking-approach

Conversation

@armahillo

Copy link
Copy Markdown
Collaborator

Ref #5667 This gets the feature most of hte way there. You'll want to read through this in detail. The individual commit messages handle more detail.

Checklist:

  • I have performed a self-review of my own code,
  • I have commented my code, particularly in hard-to-understand areas,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works,
  • New and existing unit tests pass locally with my changes ("bundle exec rake"),
  • Title include "WIP" if work is in progress.
  • I acknowledge that I will not force push my branch once reviews have started.

-->

Resolves #1

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

How Has This Been Tested?

Screenshots

The basic concept here is:

"quantity" -- same current concept. Available, on-hand inventory that can be used for distributions.
"committed" -- inventory that has been earmarked for distribution
"physical" -- sum of "quantity" + "committed"

The action concepts are:

commit -> reduce quantity (available), increase committed, physical is unchanged
fulfill -> quantity unchanged, decrease committed, decrease physical
uncommit -> increase quantity, decrease committed, physical unchanged.

These conceptual nouns and verbs cleanly describe the relationship here, and will be used for the model going forward.
NOUNS

Inventory - pesistent concept, inventory that is on-hand and available for distribution
Reserved - inventory that has been allocated for a scheduled Distribution
Physical - the sum of inventory + reserved, inventory that is still physically on-site and countable

TRANSITIONS     available   reserved   physical
created         -n          +n         n/c
edited          +/- delta   -/+ delta  n/c
completed       n/c         -n         -n
reclaimed       +n          -n         unchanged
changed after   +/- delta   n/c        +/- delta

This commit _specifically_ only does happy path with this feature. There is an obvious error state that can happen when there is nothing reserved and an existing distribution attempts to be completed  (no reserved inventory to reduce). Addressing separately.

Claude was used for this generation, with heavy supervision and interaction. Brock also reviewed it with me.
Ref #5667

This pass adds a feature flag and hides the reserving behavior behind it. The tests validate this.

The actual behaviors around reserving inventory are now working and modifying the in-flight distributions.
The inventory_aggregate spec is probably the most illustrative of the big picture, but the individual event item specs show reasonable unit test coverage of the behaviors as well.

There might be some additional cleanup on the inventory_aggregator spec, but AFAIK they all pass. I ran out of time :(

🤖 Claude was used for _some_ of the code implementation on this, and while it did generate some specs initially, I rewrote most of them by hand.
@armahillo
armahillo requested a review from awwaiid August 30, 2026 14:47
@armahillo armahillo self-assigned this Aug 30, 2026
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.

1 participant