test(capability-src): bring deadline-pressure and decide-escalation to 100% coverage - #274
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
core.calculate-deadline-pressureandcore.decide-escalation(
capability-src/core-calculate-deadline-pressure,capability-src/core-decide-escalation) to 100% line, function, andregion coverage (
cargo llvm-cov), closing core.calculate-deadline-pressure / core.decide-escalation: bring test coverage to this repo's 100% bar #273.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 withdates or fractional scores at all).
use_case_NN_{happy,sad}tests (following the existing conventionin 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.
like
string_value_after,parse_i32,write_u32,copy_json_escaped,array_after_key_at_depthdirectly) for a few defensive branches thatare 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-covlocally — ran the realscripts/ci/gather_catalog_data.py(98 capabilities, live measurements)and piped the output through the actual
wasm32-unknown-unknownreleasebuild of
catalog-builder.wasmviawasmtime, the same pipelinebuild-catalogCI 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 governedby any approved spec's
governslist (confirmed — same as #272), so001-registry-foundationis cited per this repo's existing precedent forcapability-src-only changes.Closes #273.
Governing Spec
001-registry-foundationDefinition of Done
evaluate()function and its helpers reach 100% line coverage.#[test]cases follow the existinguse_case_NN_{happy,sad}naming convention already used in both files.cargo llvm-cov --manifest-path capability-src/<crate>/Cargo.toml --text --show-missing-linesreports no uncovered lines for either crate.build-catalogdeploy (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 bothcargo build --release --target wasm32-unknown-unknownfor both cratesgather_catalog_data.pyoutput piped through the realcatalog-builder.wasmviawasmtimeTest plan
build-catalogregeneratescatalog.jsonon merge; live badges should show ~100% for both capabilities after the next deploy)Non-goals
capability-srccrates from Catalog: mirror Loop core.* + platform.decide-state-transition into capability-src for llvm-cov coverage #255 are out of scope, per core.calculate-deadline-pressure / core.decide-escalation: bring test coverage to this repo's 100% bar #273's own non-goals.