Skip to content

[Catalog][CATD-05][P0] Fix royalty normalization, precision, classification and source controls #2282

Open

Description

@sidneyswift

The reviewed public scripts can accept absent owner-net values, round fractional royalties per line, duplicate append imports, sum unlike currencies/periods and silently default provider rights/income types or currencies. These break reconciliation before any report is generated.

Parent: Catalog diligence and operations epic. Implementation status: progress is in review; the scoped update below distinguishes executable work from remaining acceptance.

Implementation area: review-deal accounting scripts and canonical vendored helpers. Priority: P0 within this epic, not a change to company-wide priority. No individual assignee is implied.

Goal

Fix royalty normalization, precision, classification and source controls.

Implementation progress — 2026-10-22

Skills #223 implements the portable portfolio. Shared persistence is in Database #120 and API #1112; canonical documentation is in Marketing #226.

Streaming exact-decimal normalization, source lineage/row conservation, observed classifications/currencies, report-versus-payment dates, duplicate/keyed revision controls and strict source totals are implemented. Financial regressions and a 2-million-row synthetic benchmark pass. Unkeyed overlap remains open/manual; bounded archive batching subsequently merged in Skills #246 (qualification below). No general automatic revised-statement deduplication claim.

This issue remains open. PR creation and synthetic checks do not satisfy unmerged, deployed, private-account or provider-outcome acceptance criteria.

Scope and deliverables

  • Use decimal arithmetic and explicit currency/units/rounding policy; retain raw values and sub-cent precision until the documented aggregation boundary.
  • Replace silent USD/master/mechanical/date assumptions with explicit field mappings and unresolved classifications. Separate right, income type, earned period, reported period, payment date and territory.
  • Bind source file/version/sheet/row and transforms; validate requested worksheets, headers, required fields, source totals and held/rejected rows.
  • Deduplicate identical/revised overlapping statements and imports; stream large CSV/archive batches with bounded resource use and versioned parser profiles.
  • Repair deterministic runner coverage and readiness controls, including header-only inputs and manual-mapping overrides.
  • Retain source detail/control/footer/ignored/held classifications and totals with conservation receipts; a title starting with Totals is not automatically a footer. Validate allowed statuses and evidence for accepted/deferred findings; unknown statuses fail explicitly.
  • Manifest parsed status requires an actual parser receipt with exact source/version ID; file extension or filename alone cannot establish parsing or link findings across same-named files.

Acceptance criteria

  • Missing owner-net or currency remains unknown/held; header-only files cannot produce a misleading successful financial result.
  • Sub-cent rows reconcile exactly under documented rounding; mixed currencies and noncomparable periods cannot be summed without an explicit FX/comparison policy.
  • Provider defaults cannot overwrite supplied or user-approved mappings; a report date never silently becomes a payment date.
  • A nonexistent worksheet fails clearly rather than parsing another sheet; duplicated appends add no new economic lines.
  • A multi-million-row synthetic batch retains source controls and measured resource behavior; PDF/OCR extraction remains qualified until independently reconciled.

Dependencies and sequencing

Completion prerequisites: CATD-01 — #2278.

These are completion/integration gates, not a prohibition on parallel fixtures, documentation or independent branches. Use documentation/contract → required database change → API/skill implementation sequencing. Portable file review does not wait for unrelated hosted or provider access. Reuse existing Context/UI ownership linked below; add only missing domain behavior.

Validation and delivery evidence

Deterministic regression fixtures reproducing each defect, plus original/corrected/reversal statements, negative royalties, malformed sheets, mixed types and large-file performance. No new real customer data in fixtures.

Link owning-repository PRs and exact tested versions here. Record fixture-tested, implemented, deployed, connected and live-verified separately. Keep private customer originals and derived account details out of public issues/fixtures. This planning ticket does not authorize unrequested provider submissions, messages, payments, merges or deployment.

Source references

Bounded archive batching — merged source qualification (2026-10-27 UTC)

Skills #246 merged as f0ef77f29f101603b4aebef25de59221f6220894 from reviewed head d6d2c52609827f95f7de46a7021072d51ed992aa; merge tree b13e4b59bab66cc0bf3b08fde5727f6a6d85525a exactly matches that head. ZIP CSV/TSV batches now retain archive/member hashes, row lineage, per-member receipts and explicit partial results. Existing decimal, currency, classification and keyed revision policies are preserved. Failed members roll back their rows and receipts, preserve earlier evidence byte-for-byte, and allow later valid members to finish.

Final-head validation and 13 archive regressions passed; root manual independent review found no blockers and independently ran those tests. The prior full suite passed 66 finance tests, 13 package tests and all five repository gates. Runtime source is unchanged by the final test-only supplement. Source-bound synthetic runs measured 100,000 and 2,000,000 rows; the latter retained exact USD 9,800.0000 across two members in 170.982 seconds with 98,762,752 bytes peak RSS on Python 3.12.4/macOS. Output and temporary disk scale with data; repeated append scans prior ledger per member, so these measurements are not a universal throughput or memory guarantee. Post-merge validation and publisher workflow report success; emitted-asset/installed qualification is separate.

At the #246 checkpoint, per-member source-control inputs remained unsupported; #247 below adds that interface. Still open: unresolved unkeyed overlapping/revised statements, PDF/OCR independent reconciliation, representative authorized private imports and source-semantic/customer acceptance. One provider/map applies to a batch. These are merged-source and synthetic results only; no customer import, provider execution, hosted continuation, recognized debt or cash receipt is established. The issue and whole-ticket acceptance criteria remain open.

Per-member source controls — merged source qualification (2026-10-27 UTC)

Skills #247 merged as 5f532e364a1309489b10c1300a4421969161cb9d from reviewed head b9ecdff542b81eb6196c422988e33830df29a472. Merge tree 2a7c848de381b3b10214aba19734501b6f6f4e5e matches that head. Optional --archive-controls accepts a manifest bounded to 1 MiB/128 entries, binding unchanged per-file control objects to exact member names and content hashes, plus the original archive hash when supplied. The existing control validator and financial policies are reused.

Unknown/duplicate bindings or malformed manifests reject publication; a stale member hash produces a member error without importing its rows. Missing controls remain unavailable, mismatches remain partial, and observed zero remains distinct from absent evidence. Exact supplied manifest bytes/hash and controlled-receipt provenance are retained. There is no archive-wide monetary or reconciliation conclusion.

Final source qualification: 77 finance tests including 23 archive methods, 13 package tests and all five gates passed. Independent scoped review, independent archive tests/vendoring, root manual review and exact-head CI passed. Post-merge validation passed. Release metadata records 2026.1026.64 targeting this merge; emitted-asset/installed qualification remains separately owned. The prior large benchmark was not rerun and is not a new performance measurement for this head.

Matching supplied controls is not independent reconciliation, validation of the control evidence itself, or a real client import. Unkeyed overlap, provider-specific format semantics, PDF/OCR verification, authorized private imports and full-lifecycle/provider/cash acceptance remain open. This update does not close whole-ticket criteria or authorize customer/provider/database operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    codexenhancementNew feature or requestpriority:P0Required for the first shared Sites and external Widgets release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions