feat(context): prepare catalog audit from saved assessment

Merged
SI
5d ago
+2546-269

Summary

Add pending, read-only prepare_catalog_audit to HTTP /api/context and the dedicated standard MCP catalog. It prepares an unsaved revision-zero case from one authorized current saved company_onboarding assessment.

  • Copy retained source-version fingerprints; reject missing, foreign, withdrawn or malformed evidence.
  • Preserve the exact summary, input manifest and coverage gaps in an assessment dependent on every selected source.
  • Recheck workspace membership and saved-brief/source availability after asynchronous reads.
  • Exclude delegated OAuth. Preparation performs no persistence, provider call or external action; explicit save_catalog_case, optimistic revisions, idempotent retries and withdrawal readback remain separate and authoritative.

Current source and coordinated fixtures

Final candidate b7bddd14ff1d9e81b4e531ef7e152cf34cc6f728, tree eb30766e807cd79cc0dec4c769ec3af91b5c2a11, parent 5c9bb1a37991af21f1654d77d9a7e95f54c96b9b. This 12-file review-fix successor follows normal merge 549cf08c with ordered parents original 588f4ae and released main 0b1450b3, then the duplicate-import correction 5c9bb1a3. No history rewrite or held typed-error, ingestion or accounting feature integration.

Released freshness, selected-evidence validation, OAuth policy additions and valuation contracts remain preserved. The original Docs producer at 09200d825130c7b2e04f266d5090bcebc341dd50 adds pending labels in the existing discovery tables. The API fixture pair matches its proposal byte-for-byte; both change only the Context source hash, with all request/response schemas, examples, mappings and non-Context values preserved:

  • Context source SHA-256: 10b243ab1098a7428fb935dfb0780ff0f9a1c8885b96feda8e453acff4a1df17
  • context-contract.json: 05235cc4cdf05a51290397526214656a0cc022ce72a01e9dcba76d141c73a81c
  • published-docs.json: 396f1f4354450b263570179ed55fefe50389aa0cb32147ac5b82283021c4b599

The valuation release-source hash remains 0e1239e256b2c1f8f189d81e013f942518619a24214b7c2b7f99baad15de7d3c. Producer --check and independent comparison pass. Runtime request/response/example exports compare exactly with the predecessor.

Review findings and fixes

All 11 Cubic findings on 5c9bb1a3 were assessed; no automated review-thread replies or resolutions were performed.

FindingDisposition
4586985475Batch both retained metadata lookups at 200 IDs, following the existing catalog pattern; preserve projections, owner/deletion filters, complete-result validation and requested order.
4586985431Select denial cases by action; explicitly cover both save_catalog_case and prepare_catalog_audit.
4586985449 / 4586985461Assert intended domain errors or schema-validation errors, and verify injected private storage detail is absent. The changed-brief test reaches the consistency comparison.
4586985482Reject normalized duplicate IDs within a document before lookup; retain legitimate shared sources across documents and their complete manifest.
4586985493 / 4586985526Clarify fixed generic scope and a new, unreserved random case UUID on every prepare call.
4586985533Use catalog metadata for direct delegated denial, preserving the existing error envelope and evidence-operation behavior.
4586985540Extract pure response assembly/validation; keep reads, rechecks and UUID generation in the orchestrator.
4586985414 / 4586985424Decline unrelated inventory splitting: the claimed under-100-line rule is absent from the checked repository instructions. Released inventories already contain 767/108 lines; the focused declarative additions do not violate the owning SRP rule. Independently reviewed.

Validation

Local RED→GREEN regressions cover large lookups, reversed results, later-batch failure/completeness checks, private-error redaction, within-document duplicates, shared-source lineage and both denial paths. Initial RED: 6 failed, 93 passed. Corrected focused regressions: 116 passed. No checker weakened.

The repaired implementation passed 9,561 full-suite tests (51 skipped), 1,240 focused tests (8 skipped), and 314 Node 22 OAuth tests (5 skipped). These runs preceded the final fixture source-hash adoption; the final pair then passed all 328 contract tests. A final test-only assertion improvement passed all 21 retained-source tests. Scoped/production/OAuth/response-contract types, lint, formatting and whitespace checks passed. Independent review reran 106 tests, approved the implementation, and bound the final 12-file successor and fixture hashes to the exact head/tree with no new findings.

Exact-head required checks for b7bddd14 all passed: test, compatibility, format, lint, and Cubic completed successfully. Cubic reported one description finding, 4587125102: it compared the new fixture source hash with the predecessor hash in an earlier PR-description snapshot. The current description now states the correct 10b243ab… source and exact 05235cc4… / 396f1f43… fixture pair; readback confirms the predecessor hash is no longer claimed. No source or fixture change was needed. No review-thread reply or resolution was performed. The earlier 11 findings retain the explicit dispositions above; a successful review check alone is not finding-free approval.

Release order and remaining acceptance

  1. Complete and merge Docs contract #15, pinned to final candidate b7bddd14 with paired checks and rendered review qualified.
  2. After coordinator acceptance of the exact-head checks, review dispositions and paired Docs release, merge/deploy this API change.
  3. Release App #2363, then verify the intended account, deployed catalog-case schema and native workflow.

The coordinator retains merge ownership under the standing qualified-merge authorization. No schema migration, provider/customer/account operation, production write or native/browser acceptance occurred in this repair. Preparation alone never saves an audit or verifies rights, ownership, registration, delivery or external execution.

Related: recoupable/app#2116, recoupable/app#2277. This does not close either epic or establish complete catalog diligence/provider integration.