Repository navigation
Conversation
khaira777
marked this pull request as ready for review
August 12, 2026 22:38
khaira777
marked this pull request as draft
August 13, 2026 04:21
Contributor
Author
|
PR #269 is intentionally marked draft while the independent verification is addressed. The core transaction-boundary, integer allocation, void_adjustment exclusion, and repeat/concurrency behavior were independently verified. One residual defect remains: when a split bill contains both categorized item tax snapshots and configured charge-tax snapshots (for example packaging/delivery/service tax), each child bill's total reconciles but the receipt/thermal tax components can misattribute item tax versus charge tax. Please fix this on the existing Required follow-up:
|
Contributor
Author
|
Superseded by the completed implementation in #295. Closing this draft to avoid duplicate delivery. |
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.
Fixes #253
Audit Findings & Verification
This PR addresses FloCafe audit issue #253. Following empirical testing on
origin/main, the issue was PARTIALLY CONFIRMED:CONFIRMED:
Math.round()could cause cumulative rounded allocations to exceed the source total, producing negative amounts on the final guest check (e.g. $0.02 split across 4 checks produced $0.01, $0.01, $0.00, -$0.01 for Guest 4).void_adjustmentExposure): Queries filteringstatus NOT IN ('cancelled', 'voided')failed to exclude syntheticvoid_adjustmentrows, forcing POS operators to allocate non-physical void reversal lines across guest checks.withTxn().NOT REPRODUCED:
better-sqlite3execution. Simultaneous HTTP requests are strictly serialized by Node.js, so concurrent HTTP requests do not create duplicate split groups.split_group_id/ bill count checks and are cleanly rejected with HTTP 409 Conflict (This check has already been split).Summary of Changes
txnItemById), check validations, normalized allocations (txnNormalized), weights, andbill_itemsinsertions are performed 100% authoritatively insidewithTxn().Math.round()logic with integer minor-unit largest-remainder (Hamilton/Hare-Niemeyer) allocation algorithm, guaranteeing exact reconciliation without negative allocations.TaxBreakdown[][](array of per-item component arrays) and legacy flatTaxBreakdown[]arrays. Reconciles component allocations to check tax amounts and source breakdown totals exactly in minor units while preserving original JSON structures.void_adjustmentExclusion: Updated SQL queries inmain/routes/bills.tsand item filtering infrontend/src/components/pos/SplitCheckModal.tsxto excludevoid_adjustmentrows.tests/payment-methods-split-checks.test.ts(79/79 assertions passing).