feat(flow): assess persisted checkout coverage against verified file evidence

Merged
TH
9d ago
+1015-0

User description

Fixes #366

What

Add assessFlowCheckoutCoverage({ report, descriptors, fileEvidence }) to
adt-flow — a pure, validated assessment binding a FlowCheckoutReport
payload to object descriptors and caller-verified file evidence (path →
sha256, or null for verified absence). This is the second increment of
snapshot diagnostics after #349.

Behavior

  • Schema-validates the report payload (schemaVersion/coverageVersion 1, mode,
    scope, skipped/derived/absent/inventory/resolutions shapes).
  • Inventory-to-owner mapping: direct canonical identity, repository ownership
    (padded/URI-less components), explicitly absent objects, or report
    omissions; anything else emits COVERAGE_OWNERSHIP_UNMAPPED. Descriptors
    claimed by no inventory entry emit COVERAGE_OWNERSHIP_UNINVENTORIED.
  • File classification against evidence: acquired (hash match), deleted
    (verified absence), diverged (hash mismatch → COVERAGE_FILE_DIVERGED
    with the owning identity and source component), unverified (no evidence).
  • Missing or unsupported reports resolve to an explicit unknown assessment
    (missing-report / unsupported-report), never to complete.
  • complete requires no typed omissions, no divergence and no unverified
    owned files (unless indexedOnly).
  • Deterministic, sorted output; duplicate owned paths keep path_collision,
    paths outside src/ keep the schema-enforced boundary.

Tests

Ten regressions cover complete coverage with class companions, namespaced
encoded paths, padded/URI-less ownership via resolutions, typed omissions,
unknown variants, divergence and verified absence, unverified evidence,
indexed-only assessments, boundary errors and determinism. No checkout,
storage, command or provider behavior changes; openspec change
assess-flow-checkout-coverage included.

Summary by Sourcery

Add validated checkout coverage assessment to bind persisted reports to descriptor ownership and verified file evidence.

New Features:

  • Add a pure adt-flow API for assessing persisted checkout coverage against object descriptors and caller-verified file evidence.
  • Classify owned files as acquired, deleted, diverged, or unverified and surface typed ownership and coverage omissions.
  • Return explicit unknown assessments for missing or unsupported checkout reports.

Enhancements:

  • Provide deterministic, validated coverage results while preserving existing checkout report, CLI, storage, and provider contracts.

Documentation:

  • Document the checkout coverage assessment API in the package README and SDK documentation.

Tests:

  • Add regression coverage for ownership resolution, typed omissions, unknown reports, file divergence and absence, unverified evidence, indexed-only assessments, validation boundaries, and determinism.

Chores:

  • Add the associated OpenSpec proposal, design, and requirements documentation.

Summary by cubic

Adds assessFlowCheckoutCoverage() to adt-flow, a pure validated assessment binding a persisted checkout report to object descriptors and caller-supplied file evidence (path → sha256, or null for verified absence). Missing or unsupported reports resolve to an explicit unknown assessment, never complete.

  • Validates inventory-to-owner mapping and classifies owned files as acquired, deleted, diverged, or unverified, emitting sorted typed omissions.
  • complete requires no omissions, divergence, or unverified files unless the report is indexedOnly.
  • Duplicate owned paths and paths outside src/ keep the established path_collision and path_invalid boundaries.
  • No checkout, storage, CLI, or provider behavior changes; openspec change specs and regression tests included.

CodeAnt-AI Description

Assess checkout coverage against verified file evidence

What Changed

  • Adds a checkout coverage assessment that compares saved report inventory with object ownership and verified file evidence.
  • Classifies owned files as acquired, deleted, diverged, or unverified, and reports skipped, absent, and unmapped objects as omissions.
  • Returns unknown for missing or unsupported reports instead of treating them as complete.

Impact

✅ Missing reports cannot appear complete
✅ Detects deleted or changed checkout files
✅ Exposes unmapped checkout objects

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features
    • Added a library API to assess checkout coverage using a report, object descriptors, and caller-provided file evidence.
    • Results distinguish complete, partial, and unknown coverage, classify files, and report omissions or mismatches. Missing or unsupported reports are marked unknown rather than complete.
  • Documentation
    • Added usage guidance for the coverage assessment API in the SDK documentation.