Skip to content

test(capability-src): bring deadline-pressure and decide-escalation to 100% coverage - #274

Merged
enricopiovesan merged 1 commit into
mainfrom
claude/issue-273-loop-capability-coverage
Aug 18, 2026
Merged

test(capability-src): bring deadline-pressure and decide-escalation to 100% coverage#274
enricopiovesan merged 1 commit into
mainfrom
claude/issue-273-loop-capability-coverage

Conversation

@enricopiovesan

Copy link
Copy Markdown
Contributor

Summary

  • Brings core.calculate-deadline-pressure and core.decide-escalation
    (capability-src/core-calculate-deadline-pressure,
    capability-src/core-decide-escalation) to 100% line, function, and
    region coverage (cargo llvm-cov), closing core.calculate-deadline-pressure / core.decide-escalation: bring test coverage to this repo's 100% bar #273.
  • Removes genuinely dead code first (never reachable from evaluate/fail,
    confirmed by occurrence-count audit — each removed function appeared
    exactly once, its own definition, nowhere called): boilerplate copied
    from a shared template but never trimmed per-capability.
    core-calculate-deadline-pressure: skip_ws_comma,
    array_after_key_at_depth, extract_bool, parse_number_millis,
    normalize_email, trim_ascii, eq_ignore_case, ascii_lower.
    core-decide-escalation: skip_ws_comma, write_i32, extract_string,
    extract_string_at_depth, string_value_after, copy_json_escaped,
    normalize_email, trim_ascii, eq_ignore_case, ascii_lower,
    parse_ymd_days, format_score_millis (this capability never deals with
    dates or fractional scores at all).
  • Adds use_case_NN_{happy,sad} tests (following the existing convention
    in both files) for every remaining reachable branch: band/decision
    boundaries, missing/malformed/absent JSON keys, unbalanced
    objects/arrays, escaped-backslash handling in the hand-rolled byte
    scanner, and non-numeric fallbacks.
  • Adds a handful of direct unit tests (calling parser/formatter helpers
    like string_value_after, parse_i32, write_u32, copy_json_escaped,
    array_after_key_at_depth directly) for a few defensive branches that
    are either impossible or impractically contrived to reach through a
    realistic top-level JSON input (e.g. a buffer that's already full when a
    digit-writer is called, or a key's colon search needing to find no
    colon anywhere in the rest of the document) — standard practice for
    helper-level edge cases, and avoids fabricating unrealistic end-to-end
    inputs just to move a percentage.

Verification against the real deployed artifact

Not just cargo llvm-cov locally — ran the real
scripts/ci/gather_catalog_data.py (98 capabilities, live measurements)
and piped the output through the actual wasm32-unknown-unknown release
build of catalog-builder.wasm via wasmtime, the same pipeline
build-catalog CI runs. Both capabilities report
{'lines_percent': 100, 'functions_percent': 100, 'regions_percent': 100}
in the regenerated catalog.json.

No open issue tracks this beyond #273. capability-src/ is not governed
by any approved spec's governs list (confirmed — same as #272), so
001-registry-foundation is cited per this repo's existing precedent for
capability-src-only changes.

Closes #273.

Governing Spec

  • 001-registry-foundation

Definition of Done

  • Each of the two crates' evaluate() function and its helpers reach 100% line coverage.
  • New #[test] cases follow the existing use_case_NN_{happy,sad} naming convention already used in both files.
  • cargo llvm-cov --manifest-path capability-src/<crate>/Cargo.toml --text --show-missing-lines reports no uncovered lines for either crate.
  • Live catalog badges for both capabilities show coverage at or near 100% after the next build-catalog deploy (verified via a real end-to-end pipeline run, see above).

Validation

  • cargo test --manifest-path capability-src/core-calculate-deadline-pressure/Cargo.toml (36 tests, all passing)
  • cargo test --manifest-path capability-src/core-decide-escalation/Cargo.toml (30 tests, all passing)
  • cargo llvm-cov --manifest-path <crate>/Cargo.toml --summary-only — 100.00% lines/functions/regions for both
  • cargo build --release --target wasm32-unknown-unknown for both crates
  • End-to-end: real gather_catalog_data.py output piped through the real catalog-builder.wasm via wasmtime

Test plan

  • CI green (build-catalog regenerates catalog.json on merge; live badges should show ~100% for both capabilities after the next deploy)

Non-goals

…o 100% coverage

Removes genuinely dead helper functions (never called from evaluate/fail,
boilerplate copied from a shared template but never trimmed per
capability) from both crates, then adds use_case_NN tests for every
reachable branch plus a handful of direct unit tests for a few defensive
edges impractical to reach through a realistic top-level input.

Verified end-to-end against the real deployed artifact: ran
gather_catalog_data.py for real and piped it through the actual
wasm32-unknown-unknown release build of catalog-builder.wasm via
wasmtime -- both capabilities report 100% lines/functions/regions in the
regenerated catalog.json.

Closes #273.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@enricopiovesan
enricopiovesan enabled auto-merge (squash) August 18, 2026 06:18
@enricopiovesan
enricopiovesan merged commit 9b10c7a into main Aug 18, 2026
9 checks passed
@enricopiovesan
enricopiovesan deleted the claude/issue-273-loop-capability-coverage branch August 18, 2026 06:20
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.

core.calculate-deadline-pressure / core.decide-escalation: bring test coverage to this repo's 100% bar

1 participant