Repository navigation
Phase 2.5: Cross-reference rules (E002, E003, E007, E010, E014) - #12
Merged
withrvr merged 5 commits intoAug 31, 2026
Conversation
Checked against both invoices and payments, since either kind of record can carry a dangling Customer_ID. Fires independently of E003 when both a payment's customer and invoice reference are unknown (PAY-2025) -- two true, independently actionable facts, not one combined flag. Fires on INV-1026 and PAY-2025 (both C999) in dataset A. Refs: docs/RULES.md
A payment referencing an invoice that doesn't exist in the Invoices sheet is never applied to anything, since outstanding.py's payment index is keyed by real invoice IDs. Fires on PAY-2025 (Invoice_ID INV-9999) in dataset A -- the same row that independently fires E002 for its unknown customer reference. Refs: docs/RULES.md
Payments can reference an invoice belonging to a different customer. PAY-2026 pays INV-1002 under C003 while the invoice belongs to C002. The payment is excluded from the paid total and flagged rather than reassigned, since reassignment would be a silent data correction. Refs: docs/RULES.md
Flags a payment dated before its own invoice's invoice date as a data-quality item, without excluding it from compute_outstanding -- the workbook doesn't authorize that exclusion, only this rule's documented assumption does (see README.md). Fires on PAY-2027 against INV-1004 in dataset A. Refs: docs/RULES.md
Not on the assessment's required list -- added because the data called for it (QA_PREP.md Q5). Reuses outstanding.py's own valid_payments_total so this rule can never disagree with the real calculation about what counts as a valid payment, and floors nothing itself since compute_outstanding already floors at zero -- this rule only explains why. Fires on INV-1007 (88,000 invoiced, 110,000 paid, 22,000 overpaid) in dataset A. All 14 rules now implemented and registered; RULES.md's catalogue is complete and matches the code. Refs: docs/RULES.md
withrvr
merged commit Aug 31, 2026
f67216e
into
claude/erp-collection-reporting-workflow-iycqto
4 of 7 checks passed
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.
Phase 2 (feature 5 of 6): Cross-reference rules
What this adds
The five rules spanning two sheets: E002 (unknown customer reference, on
either invoices or payments), E003 (unknown invoice reference), E007
(payment-to-invoice customer mismatch — the flagship worked example from
MASTER_PLAN.md section 8 and QA_PREP.md Q11), E010 (payment before
invoice date, flag-only per README's documented assumption), and E014
(overpayment — beyond the assessment's required list, added because the
data called for it, QA_PREP.md Q5).
All 14 rules are now implemented and registered. Verified against dataset
A: 17 exception rows across all 14 codes, exactly matching
RULES.md'ssummary table.
Assessment requirement served
Covers the remaining required categories: "unknown customers/invoices,"
"customer mismatch," and "payment before invoice" — plus E014, added
beyond the brief.
Docs updated
"14/14 rules implemented"
Verification
Known gaps carried to next phase
test_coverage.pyandtest_reconcile.py(invoice-amount andpayment-centric identities) land in PR6, along with the final
RULES.md/README.md/CHANGELOG.mdconsistency pass and thev0.3.0tag attempt.Generated by Claude Code