Title: Design: a charge is evidence — one identity and lifecycle contract for the charges pipeline · Issue #3161 · developing-today/code · GitHub
Open Graph Title: Design: a charge is evidence — one identity and lifecycle contract for the charges pipeline · Issue #3161 · developing-today/code
X Title: Design: a charge is evidence — one identity and lifecycle contract for the charges pipeline · Issue #3161 · developing-today/code
Description: 🤖 Design-architect pass 27 (2026-10-31) — design issue. Full design doc: files/designs/code-charges-pipeline-contract.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main 8bae502f, all code references verified on cu...
Open Graph Description: 🤖 Design-architect pass 27 (2026-10-31) — design issue. Full design doc: files/designs/code-charges-pipeline-contract.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main 8bae...
X Description: 🤖 Design-architect pass 27 (2026-10-31) — design issue. Full design doc: files/designs/code-charges-pipeline-contract.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main 8bae...
Opengraph URL: https://github.com/developing-today/code/issues/3161
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Design: a charge is evidence — one identity and lifecycle contract for the charges pipeline","articleBody":"🤖 Design-architect pass 27 (2026-10-31) — design issue. Full design doc: `files/designs/code-charges-pipeline-contract.md` in the keep-the-four-repos-healthy goal workspace. Audit at origin/main `8bae502f`, all code references verified on current main this pass.\n\n## Summary\n\nThe charges pipeline built for #1057 has a pure core whose header states its philosophy — `charges-match.ts`: *\"this module only decides what a charge IS, never what was already shown\"* — but the pipeline never stated the three rules that philosophy needs: **what counts as a charge (admission), when two observations are the same charge (identity), and when an unmatched charge counts as shown (delivery).** Nine open filings are those three unstated rules, one per pipeline stage:\n\n- **Admission** (`scripts/produce-charge-candidates.ts`): `isNotChargeSubject` (~L148–157) has no declined/failed pattern and nothing requires payment evidence, so declined alerts and amount-due-only invoices become candidates (#3120); the body amount fallback (~L208) matches `total` inside **Subtotal** and first-match wins, recording $20.00 for a $21.60 charge (#3121) — the wrong amount then defeats dedupe.\n- **Identity** (`charges-match.ts`, `charges-collect.ts`): `matchCharges` dedupes on (amount, normalized merchant, ±3 days) without requiring **different sources** despite the header/#1057 scoping dedupe to across-sources, and empty-normalized merchants merge across merchants (#2130); `sameCharge` (charges-collect.ts:74) merges hand-fed rows on squashed **substring containment** (`Meta` vanishes against `METAMUCIL`, `AI` against `RAILWAY`, #3049) and never compares payment methods, so conflicting card masks merge away (#3123).\n- **Classification**: `isSaasLooking`/`matchService` match substrings with no token boundary — `METAMUCIL` and `METAL ROOFING` classify as Meta (#3048) — and the collector's catalog is built only from `extractSaasServices()` (collect-fleet-feed.ts:435–437), so Anthropic/OpenAI charges can never match and always flood the attention strip (#3119).\n- **Delivery**: surfaced keys are persisted at collection time (~L451), before the feed is written (~L646) and before the out-of-collector laptop transfer, so one failed delivery permanently suppresses flags (#3122); the live source consumes charges only inside the `saas` gate (live.ts:869), so a quota-view failure hides all auto-matched charges (#3124).\n\nPass 26 of this series assessed #3048/#3049 as a candidate to revisit \"if a third instance files\" — six more filed today. The condition is met.\n\n**The rules (recorded here; full text, alternatives and risks in the design doc):**\n\n> **A charge is evidence.** (1) **Admission requires payment evidence** — declined/failed and merely-due amounts produce no candidate; the amount is the amount *paid* (explicit paid/charged labels outrank a bare total; a bare total must be a standalone label, never a substring of \"Subtotal\"). (2) **Identity is one rule everywhere** — same charge only when provenance differs (cross-source dedupe; hand-fed vs auto merge), amounts equal, dates within the existing 3-day window, merchant identity holds at **token boundaries** (exact normalized equality for dedupe; token-boundary containment for the hand-fed merge, preserving the documented `METAPAY` / \"Meta PAYG spill\" pair), an empty normalized merchant never matches, and **conflicting known payment methods veto** the merge. (3) **Surfaced means delivered, and consumption is independent** — surfaced keys persist only for charges in a successfully published feed, and the live source consumes the charges sections on their own validity, never gated on an unrelated section. Classification corollary: names/aliases/markers match at token boundaries only, and the catalog is SaaS services **plus** quota pools and aliases from their existing extractors.\n\n**Boundaries:** input-validity neighbours are NOT adopted — #2194 (impossible dates), #2445/#2439 (feed charges shape), #2448 (batch-discarding producer throw) are governed by #2576's fail-closed ingest contract and #3068's shape contract; this design governs identity, evidence and lifecycle of candidates that pass them. #3005 owns count/size measurement grammar; the producer's paid-amount labels are admission evidence, owned here. Producer scheduling (#2205) is operational and untouched.\n\n## Phased breakdown (phases adopt the origins — no parallels)\n\n- **Phase 1 — Identity.** #2130 + #3049 + #3123: one shared identity rule across `matchCharges` and `sameCharge`, one probe matrix (same-source repeats, empty-normalized pairs, Meta/METAMUCIL, AI/RAILWAY, the METAPAY control, conflicting/agreeing/absent methods).\n- **Phase 2 — Admission & classification.** #3120 + #3121 + #3048 + #3119. Independent of Phase 1.\n- **Phase 3 — Delivery.** #3122 + #3124, plus the closing truth-up on landing: the three rules written into the `charges-match.ts` / `charges-collect.ts` / producer headers and evidence posted on #1057. No separate audit issue — the surface inventory is closed (verified by repo-wide grep this pass: producer + collector scripts, charges-match, charges-collect, feed/live consumption only).\n\nOpen questions stay in the design doc (`unmatchedKey` gaining the method; #3122's confirm-after-publish vs pending-keys mechanism — either satisfies the rule, Phase 3 picks against the as-built publish flow).\n\n## Acceptance\n\n- [ ] Phase 1 origins (#2130, #3049, #3123) closed under the recorded identity rule, probe matrix as tests\n- [ ] Phase 2 origins (#3120, #3121, #3048, #3119) closed under the admission + classification rules\n- [ ] Phase 3 origins (#3122, #3124) closed; rules written into the module headers; evidence posted on #1057\n- [ ] Register row for this design in `files/potential-projects.md` kept truthful as phases land\n\n## Acceptance criteria\n\n- The design doc (`files/designs/code-charges-pipeline-contract.md` in the goal workspace) states the three contract rules — admission, identity, delivery — for the charges pipeline.\n- Each of the nine open filings named in the issue is linked to the contract section that governs it.\n- Implementation of the contract is tracked by linked implementation issues (this design issue does not itself change pipeline code).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-31T17:33:11Z","url":"https://github.com/developing-today/code/issues/3161"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3b36c006-c5a8-bd8e-018d-89d327bd135c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB92:345F05:AAED57:E41310:6B064176 |
| html-safe-nonce | 70f24f5b3be6f0bd5b8ce0cd2cf4fd3c16e3cb6126dc89bb7d8d196c0c6ad79f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjkyOjM0NUYwNTpBQUVENTc6RTQxMzEwOjZCMDY0MTc2IiwidmlzaXRvcl9pZCI6IjUzMTIxNjU2MzU4MDU4NDMxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 20e0f6fdf033e5b16301570e64aa2bb1bccd19952e9438619e4979c31f63e2dc |
| hovercard-subject-tag | issue:6137784340 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/3161/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bee150ecc902936e10e383bf12e3018c36f91b97c2e99d8f73ee2dd144200395/developing-today/code/issues/3161 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bee150ecc902936e10e383bf12e3018c36f91b97c2e99d8f73ee2dd144200395/developing-today/code/issues/3161 |
| og:image:alt | 🤖 Design-architect pass 27 (2026-10-31) — design issue. Full design doc: files/designs/code-charges-pipeline-contract.md in the keep-the-four-repos-healthy goal workspace. Audit at origin/main 8bae... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width