feat(reports): filter report attachments by document tier per report type (#1930) - #1942
Conversation
…type (#1930) Documents form an ordered evidentiary tier — quotation -> deposit -> invoice — and each report type now declares a tier floor: a document is embedded iff its tier is at or above that floor. budget-overview floors at quotation (embeds everything), claim floors at deposit (never embeds a quotation), and proof-of-funds floors at invoice (invoices only). The rule depends solely on the report type and the document's own type, replacing the previous per-invoice status/deposit-split stage matching in sourceReportService.ts, which made attachment inclusion depend on invoice status rather than the report's purpose. Untagged (null) attachmentType documents are treated as the strongest tier (invoice), so existing pre-#1877 links and untyped links are never silently dropped from claim or proof-of-funds reports. Fixes #1930 Co-Authored-By: Claude dev-team-lead <noreply@anthropic.com> Co-Authored-By: Claude backend-developer <noreply@anthropic.com> Co-Authored-By: Claude qa-integration-tester <noreply@anthropic.com> Co-Authored-By: Claude product-owner <noreply@anthropic.com> Co-Authored-By: Claude product-architect <noreply@anthropic.com>
|
[product-owner] Requirements review of PR #1942 against story #1930 (head Verdict: APPROVED I wrote #1930, so I checked every AC against the code and tests rather than against the summary. All 11 pass. Verified locally: Acceptance criteria
On the QA deviation in the AC1 scenario (fresh invoice per report-type block)I agree the AC1 contract is fully covered and not diluted. The reasoning is sound and I'd have ruled the same way: no single invoice status sits in all three target slices at once (proof-of-funds requires Non-blocking observationsI1 (informational, no action required). Two of the proof-of-funds assertions are not change-detecting against the removed implementation: for a I2 (done, not a request). #1930 ruled that #1888 stays open, re-scoped to indicator presentation only. Nothing in this PR conflicts with that — it touches no client code, and it removes rather than creates the "attached but not stage-matched" state #1888 originally proposed (non-qualifying documents no longer reach the client at all). #1888's text had not been updated, so I rewrote it just now: the Story #1930 is complete as specified. No scope creep: no attachment-selection UI, no change to the |
|
[product-architect] Architecture review — APPROVED Verified against the Wiki API Contract, the AC set on #1930, and the surrounding report pipeline. No blocking findings. The change is genuinely smaller than the code it deletes: a per-invoice derivation with three inputs (invoice status slice, deposit split, Answers to the six questions raised1. Placement in
|
The existing AC3 proof-of-funds assertions were not change-detecting — they would have passed identically on beta's pre-#1930 stage-derivation logic. Adds a discriminating fixture: a deposit-only invoice (no budget line) whose sole tagged deposit is 'claimed', which the old code's "no split entry" branch would have kept via railBContributions alone, independent of report type. Verified to fail against the inlined pre-#1930 logic and pass against current. Also aligns wiki/API-Contract.md's attachmentType field wording ("Document stage" -> "Attachment tier") with the tier rule documented below it. Co-Authored-By: Claude dev-team-lead <noreply@anthropic.com> Co-Authored-By: Claude qa-integration-tester <noreply@anthropic.com> Co-Authored-By: Claude backend-developer <noreply@anthropic.com> Co-Authored-By: Claude product-architect <noreply@anthropic.com> Co-Authored-By: Claude product-owner <noreply@anthropic.com>
|
🎉 This PR is included in version 2.13.0-beta.43 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
quotation(1) ->deposit(2) ->invoice(3) — and each report type declares a tier floor:budget-overview= 1 (embeds all),claim= 2 (never embeds a quotation),proof-of-funds= 3 (invoices only).sourceReportService.ts, which made attachment inclusion depend on invoice status rather than the report's purpose. The rule now depends solely on report type + the document's own type, expressed once inserver/src/services/shared/attachmentTierUtils.ts.null)attachmentTypedocuments are treated as the strongest tier (invoice), so existing pre-Source contact fields, household sender setting & document attachment typing #1877/untyped links are never silently dropped from claim or proof-of-funds reports.wiki/API-Contract.mdupdated with the new tier model, replacing the stale document-stage-rule description.Fixes #1930
Test plan
attachmentTierUtils.ts100% stmts/branches/funcs/lines;sourceReportService.ts100% stmts/funcs/lines, 93.18% branch — pre-existing gaps unrelated to this change)invoices.spec.ts:841) and 6 (dashboard.spec.ts:516) are expected to fail — pre-existing, unrelated flakes (also failing on PR feat(reports): report table cleanup — shared footnotes, deposit labels, claim metadata, total-only summary, usage area (#1923) #1924).E2E Gatesis not required onbeta.Co-Authored-By: Claude dev-team-lead noreply@anthropic.com
Co-Authored-By: Claude backend-developer noreply@anthropic.com
Co-Authored-By: Claude qa-integration-tester noreply@anthropic.com
Co-Authored-By: Claude product-owner noreply@anthropic.com
Co-Authored-By: Claude product-architect noreply@anthropic.com