Repository navigation
Settle up in whole dollars (#193) - #196
Open
Param-Harrison wants to merge 3 commits into
Open
Param-Harrison wants to merge 3 commits into
Param-Harrison wants to merge 3 commits into
Conversation
Param-Harrison
marked this pull request as ready for review
October 14, 2026 11:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settleUpnow settles the whole-dollar part of every balance first, then settles the leftover cents with separate transfers that are each under $1. Cash covers most of the money and every balance still settles to the exact cent.Closes #193
Plan
Plan comment (rev 1, in the issue thread;
.factory/runs/issue-193/plan-comment.md):bun test tests/balances.test.ts -t "issue example"-t "whole dollars or cents only"-t "settles exactly"-t "whole-dollar balances"make checkDeliberately left out (non-goals): no change to the
Transfertype,/balancesJSON shape,computeBalancesor schema; no rounding that leaves a balance unsettled; no float money; dollar and cents transfers between the same pair are not merged.Changed files:
src/balances.ts,tests/balances.test.ts(new).Gate evidence
FACTORY_GATES: status=GREEN passed=3 failed=0 skipped=1 failed_gates=auditThe skipped
auditgate is optional and flags existing hono advisories this diff does not cause.Verify verdict
Verdict comment (in the issue thread;
.factory/runs/issue-193/verdict-comment.md): pass, AC-1 to AC-5 all pass, no reviewer findings.Test that bites:
settleUp > issue example: $100 dinner for three gives $33 transfers plus cents-only remaindersfails withsrc/balances.tsreverted (3 assertion failures, no compile error) and passes with the change.Risk and rollback
Risk: low. One non-protected module, no schema or API-shape change. Note that users now see two transfers between the same pair (a dollar amount and a cents remainder), so a reviewer should confirm this reading of the issue.
Rollback: revert this PR;
src/balances.tsreturns to the one-pass algorithm and nothing is persisted, so there is no data to migrate.Factory run
Proof: the new test fails without the change.
9 stage runs, 9m 25s, $2.26.
Went well
Needed help
/factory retry