Skip to content

refactor(coverage): give the complete/partial/unknown status one owner and ratchet local completeness enums - #11134

Merged
morluto merged 3 commits into
mainfrom
refactor/coverage-status-join
Nov 15, 2026
Merged

morluto merged 3 commits into
mainfrom
refactor/coverage-status-join

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Coverage status had no owner. 71 source files declare 120 z.enum([...]) vocabularies that contain "complete". Fifteen of them are the same ["complete", "partial", "unknown"] copied into 12 files, and many others leave out unknown, so a producer that cannot tell has to claim complete or partial. This PR adds src/domain/coverage.ts with coverageStatusSchema, moves the 16 identical copies onto it, and adds a counted architecture guard so the number of local completeness enums can only go down.

This is the first slice of W6 step 2 (structural audit report 05, section 2). No linked issue.

Problem and expected behavior

  • Before: each domain declares its own completeness enum. Nothing stops a new two-valued ["complete", "partial"] enum that cannot represent unknown.
  • After: the three-valued status has one definition. A new local enum containing "complete" fails scripts/verify/architecture-guards.mjs (local-completeness-enum). Removing one requires --shrink-baselines, so a removal cannot be undone silently.

Change and scope

  • src/domain/coverage.ts: coverageStatusSchema / CoverageStatus, documented so that absence of a report means unknown, never complete.
  • 16 identical enums in 13 files (protobufWire, callPathSchemas, referenceSourceGraph, relationshipCoverage, toolOutputSchemaGroups, functionComparisonSchemas, Android JNI and native declarations, Apple asset catalog, protobuf capture view, JavaScript route inventory, source-to-bundle comparison) now use the owner. The advertised JSON Schema is the same because the enum values are the same.
  • Guard with a counted baseline of the remaining 113 local enums in 63 files. The counter (scripts/verify/completeness-enum-guard.mjs) allows whitespace and line breaks between z, .enum( and [, so oxfmt's chained layout is counted, and it skips detail levels (lists containing "summary"), which choose how much to return rather than what was examined.
  • Not included: the different vocabularies (for example ["complete", "partial"], ["complete", "partial", "unavailable"], complete-within-inputs) change wire values when migrated, so they need per-domain PRs. A combiner where unknown wins is left out until a fold migrates onto it. The folds I sampled (source-to-bundle comparison, Android JNI, JavaScript routes) each mix in domain-specific outcomes, so they are not drop-in joins.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/coverage.ts; consumers are the 12 schema files above.
  • Contribution scope fit and linked maintainer decision: not applicable (refactor within existing boundaries).
  • CLI and MCP/tool-catalog contract: unchanged (identical enum values; schemas are inlined, reused: "inline").
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/evaluation/completenessEnumGuard.test.ts covers the counter (inline, chained and multi-line lists counted; detail levels and lists without "complete" ignored). The guard is the regression for new enums. Appending z.enum(["complete", "partial"]) to src/domain/protobufWire.ts makes node scripts/verify/architecture-guards.mjs fail with src/domain/protobufWire.ts: 1 (baseline 0).
  • Base reproduction: not applicable (no behavior change).
  • Remaining proof gaps: no full tool-catalog diff was generated. Schema equality follows from identical enum values; the contract and schema tests below pass.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/domain/referenceSourceGraph.test.ts src/domain/callPath.test.ts src/domain/apple/appleAssetCatalog.test.ts src/domain/android/androidJniBindings.test.ts src/domain/javascript/sourceToBundleComparison.test.ts src/domain/javascript/javascriptRouteInventory.test.ts src/contracts/outputSchemaDefinitions.test.ts src/contracts/compactOutputSchema.test.ts src/contracts/toolSchemaMetadata.test.ts — 9 files, 206 tests passed.
  • npm run test:local -- tests/evaluation/completenessEnumGuard.test.ts — 3 passed.
  • node scripts/verify/architecture-guards.mjs — passed; fails as shown above when a new local enum is added.
  • npm run check:fast — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable.

Included from #11162 (collapsed into this PR)

This PR also carries #11162, which changes behaviour. The "no behaviour change" statements above cover only the enum migration and guard.

  • src/domain/coverage.ts adds joinCoverageStatus(parts): any unknown gives unknown, then any partial gives partial, otherwise complete.
  • compare_source_to_bundle: coverage.status now folds the reference inventory and graph coverage through it. When either input is unknown (or the graph is unavailable), it reports "unknown" where it reported "partial" before. This is an additive output enum value; clients should treat it as not complete. Complete with complete is still complete-within-inputs, and partial without unknown is still partial.
  • Tests: sourceToBundleComparison.test.ts "source to bundle coverage" covers 5 input pairs. With the base implementation restored, all 5 fail; with the change, 30 of 30 pass.
  • Validation (run for fix(javascript): keep source-to-bundle coverage unknown when an input's coverage is unknown #11162): npm run test:local -- src/domain/javascript/sourceToBundleComparison.test.ts (30 passed); npm run test:local -- src/application/analysisView/JavaScriptProvenanceViews.test.ts src/contracts/outputSchemaDefinitions.test.ts src/contracts/compactOutputSchema.test.ts (24 passed); node scripts/verify/architecture-guards.mjs (passed); npm run check:fast (passed).

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T13:11:28.339563Z
We couldn’t complete this review. Comment @codex review to try again.
779f202 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[Medium impact] The PR reaches shared coverage schemas across several analysis areas and one comparison workflow.

The code changes appear sound, but the required PR description update should be completed before merging.

Fix All in CodexFindings

  1. P2 PR description contradicts changed behavior ▶
Fix with agent prompt
### Issue 1
src/domain/javascript/sourceToBundleComparisonSchemas.ts:111-115
`compare_source_to_bundle` now returns `coverage.status: "unknown"` for inputs previously reported as `"partial"`, and this PR adds `joinCoverageStatus`. The PR description still says the CLI/MCP contract is unchanged and the combiner is excluded.

`AGENTS.md` requires the PR description and validation to stay current as changes are added. Before merging, update those claims and the verification section to describe the new behavior.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Gives the shared three-value coverage status one owner and adds a counted guard against new local copies. The latest change also preserves unknown coverage in source-to-bundle comparisons.

  • Coverage fields share one three-way status vocabulary.
  • The architecture check tracks local completeness enums per file.
  • Source-to-bundle results keep unknown coverage visible.

Reviews (3) · Last reviewed commit: "fix(javascript): keep source-to-bundle c..." · Reviewed by Greptile

Comment thread scripts/verify/architecture-guards.mjs Resolved
@morluto
morluto merged commit 1c90a0f into main Nov 15, 2026
5 of 7 checks passed
@morluto
morluto deleted the refactor/coverage-status-join branch November 15, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant