refactor(trace): single discovery path; relocate self-trace to cert/trace/#116
Merged
Conversation
…race/
Three things, all driving toward "every cargo evidence verb sees
the same trace location":
1. **`cert/trace/` is the canonical project layout, period.**
The discovery chain looks at `<workspace>/cert/trace/`; if
absent it falls back to `boundary.toml`'s `scope.trace_roots`.
No `tool/trace/` fallback. `tool/trace/` was a transitional
path that confused the exclusion in three different walker
tests; collapsing on one location removes the asymmetry that
caused the original silent-under-counting bug.
2. **One discovery function, library-side.**
`evidence_core::trace::default_trace_roots(workspace_root)` is
the single source of truth. `evidence_core::floors::count_trace_per_layer`
uses it directly; the CLI's `cargo_evidence::cli::trace::default_trace_roots`
is a thin re-export. A downstream project with traces under
`cert/trace/` now sees the right floor counts — `cargo
evidence floors`, `cargo evidence trace --validate`, and
`cargo evidence check` all reach the same trace root.
3. **Self-trace relocated.**
`git mv tool/trace cert/trace`. `cert/boundary.toml` updated to
`trace_roots = ["cert/trace"]`. CI workflow paths, integration-
test fixture builders, walker-exclusion logic in
`rot_prone_markers_locked` + `trace_id_refs_locked`, and every
doc comment that mentioned the old location all swept across.
Test:
- New `crates/evidence-core/tests/floors_trace_discovery.rs`
integration test fixtures both the canonical `cert/trace/`
layout and the `boundary.toml` `scope.trace_roots` fallback,
asserting `count_trace_per_layer` returns the real counts.
Floors ratchet:
- `evidence-core/test_count` 351 → 354 (+3 integration tests).
- All other dimensions unchanged.
Backward compat: there is none for the on-disk layout. The
canonical layout is documented by `cargo evidence init` (the
template scaffolds `cert/trace/`), so new projects pick it up
automatically; existing internal-tool projects on `tool/trace/`
must `git mv tool/trace cert/trace` and update their
`scope.trace_roots`.
cc048a4 to
94c1c87
Compare
luofang34
pushed a commit
that referenced
this pull request
May 2, 2026
…rface claim, CHANGELOG - **Blocker 1**: CONTRIBUTING.md's UUID workflow now points at the established `cargo evidence trace --backfill-uuids` policy and cross-references `cert/trace/README.md`'s rationale. The python3 one-liner the prior draft suggested was the exact hand-crafting form the existing policy bans (collision risk, weakens the "UUIDs are opaque" contract, tempts reading meaning into digits). Two contradictory authority docs on the same workflow is a quality-of-process regression — fixed. - **Blocker 2**: Sharpened the negative dogfood. The previous test used `mcdc_2024.rs`, which fails the duplicate regex for two independent reasons (no leading space + 4 digits exceeds the 2-digit cap). A regression that drops only the leading-space anchor would still pass. Added `mcdc_24.rs` (2 digits, no leading space) so each anchor is isolated by its own fixture. - **Minor 3**: HLR-069 now claims `surfaces = ["editor-duplicate gate"]`, matching the convention HLR-044 / HLR-046 / HLR-047 established for sibling hygiene gates. New entry in `KNOWN_SURFACES`. `cert/floors.toml` known_surfaces 21→22. - **Minor 5**: 0.1.4 hygiene-track entry added to CHANGELOG. Bundles the changes already in main from PRs #115 / #116 / #117 plus the changes landing in this PR. Per-PR cadence rather than batched release-prep PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8 tasks
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
Closes the silent-under-counting bug a downstream project hit: traces under
cert/trace/producedfloors current=0becausecount_trace_per_layerhardcodedtool/trace/while every other verb (check,trace --validate) used a discovery chain. Three changes drive toward "every `cargo evidence` verb sees the same trace location."1.
cert/trace/is the canonical project layout, periodDiscovery chain is now:
<workspace>/cert/trace/→ `boundary.toml`'s `scope.trace_roots`. No `tool/trace/` fallback. `tool/trace/` was a transitional path that confused the exclusion in three different walker tests; collapsing on one location removes the asymmetry that caused the bug.2. One discovery function, library-side
`evidence_core::trace::default_trace_roots(workspace_root)` is the single source of truth. `evidence_core::floors::count_trace_per_layer` uses it directly; `cargo_evidence::cli::trace::default_trace_roots` is a thin re-export.
A downstream project with traces under `cert/trace/` now sees the right floor counts — `cargo evidence floors`, `cargo evidence trace --validate`, and `cargo evidence check` all reach the same root.
3. Self-trace relocated
`git mv tool/trace cert/trace`. `cert/boundary.toml` updated to `trace_roots = ["cert/trace"]`. CI workflow paths, integration-test fixture builders, walker-exclusion logic in `rot_prone_markers_locked` + `trace_id_refs_locked`, and every doc comment that mentioned the old location all swept across.
Test
Floors ratchet
All other dimensions unchanged.
Backward compat
None for the on-disk layout. The canonical layout is documented by `cargo evidence init` (which already scaffolds `cert/trace/`), so new projects pick it up automatically. Existing internal-tool projects on `tool/trace/` must:
Stacking note
This is the third of the three v0.1.3 cleanup items. PR #114 (doc honesty pass) is merged; PR #115 (DAL-A MC/DC fail-loud) is green and ready to merge. Recommend merging #115 before this so the floor baseline doesn't drift mid-flight.
🤖 Generated with Claude Code