Commit 19010cb
authored
feat: protocol 0.7.0 - source_hash format pin, JSON-shape anchors, RiskBand + CoverageSource sentinels (#4)
* feat: protocol 0.7.0 - pin source_hash format, add JSON-shape anchor fixtures
Closes #3.
- Pin FunctionIdentity::source_hash to a cross-producer-comparable format:
first 8 bytes of SHA-256(canonical body bytes) rendered as 16 lowercase
hex chars. Canonicalization rule: signature line, body, closing brace,
no whitespace normalization. Producers that cannot canonicalize the
same way MUST omit the field rather than emit a divergent format.
Closes the cross-producer non-comparability gap that the 0.6.0
"producer-defined, opaque string" wording allowed.
- New pub fn source_hash_for(body: &[u8]) -> String helper. Reuses the
existing sha2 dependency, no new transitive deps. Anchor fixture pins
source_hash_for(b"function foo() { return 1; }") to "74846e29a52fe863"
so producers can self-test against the conformance value in their CIs.
- Tighten FunctionIdentity::stable_id_computed rustdoc with the literal
phrase "NOT a validation gate"; consumers MUST NOT reject payloads
whose stable_id differs from the computed value.
- Byte-level JSON-shape anchor fixtures for FunctionIdentity (full +
minimal) plus anchor fixtures for blast_radius_id and importance_id
parallel to the existing function_identity_id fixture.
- Per-field identity-stability assertions: function_identity_id is
asserted invariant under independent mutation of start_column,
end_line, end_column, source_hash. Refines the prior bundled
function_identity_id_unchanged_by_columns into the per-field cases the
rustdoc claims.
- IdentityResolution::Unresolved shape fixture documenting the wire
bytes an MCP agent or cloud aggregator sees for a failed-join entry.
- Internal hex_prefix refactored to take a bytes count so the 4-byte
truncation used by finding_id / hot_path_id / blast_radius_id /
importance_id / function_identity_id and the 8-byte truncation used
by source_hash_for share one auditable implementation.
PROTOCOL_VERSION and Cargo.toml [package].version both bumped 0.6.0 ->
0.7.0 in lockstep. 13 new tests, all green; clippy clean; doc-warning
clean; cargo publish --dry-run succeeds.
* feat: add Unknown sentinels to RiskBand and CoverageSource
Closes #5.
Adds `#[serde(other)] Unknown` to the two remaining public enums that
lacked the forward-compat sentinel. Surfaced by a /sweep audit of every
public enum in the crate after the 0.7.0 source_hash format pin landed:
- `RiskBand` (Response-side, `BlastRadiusEntry.risk_band`): future
bands (`Critical`, `Negligible`) MAY now be added by producers as a
minor bump; older consumers map unseen variants to Unknown rather
than failing deserialization.
- `CoverageSource` (Request-side, `Request.coverage.sources`): future
source kinds (`IstanbulDir`, `TraceEvent`, `RuntimeBeacon`) MAY be
added by the CLI as a minor bump; sidecars that have not seen the
new kind map it to Unknown and skip the entry.
Two new round-trip tests (`unknown_risk_band_round_trips`,
`unknown_coverage_source_round_trips`) lock the forward-compat
behaviour. Test count is now 61. Clippy / fmt / doc / publish all
green.
CHANGELOG `[0.7.0]` Added section gains a bullet. Module-level 0.7
overview block mentions the addition. No wire shape change for
existing payloads.
* ci: clear CI red on PR #4 (typos false positive + release.yml zizmor findings)
Fixes three failing CI checks on PR #4:
1. **Typos** (new failure caused by this PR): the byte-equal JSON anchor
literal added in the 0.7.0 source_hash format pin contains the hex
string `e25ba02c5e53651f`, which typos tokenizes on digit boundaries
and flags `ba` as a misspelling of `by` / `be`. Adds the specific
hex value to `[default.extend-identifiers]` in `_typos.toml` with a
comment explaining the scope (panel-verified anchor; changing the
test inputs would invalidate the cross-producer conformance fixture).
Narrowly scoped to one identifier; does not whitelist `ba` globally.
2. **Actions Security (zizmor) - superfluous-actions** on
`.github/workflows/release.yml`: replaces
`softprops/action-gh-release@v3` with a `gh release create` shell
step. Equivalent behaviour using the gh CLI already preinstalled on
ubuntu-latest runners. Adds a re-run-safe guard that skips creation
when the release already exists for the tag (e.g. workflow_dispatch
re-runs on an existing tag). All inputs routed through env: vars per
the workflow's existing security-note convention.
3. **Actions Security (zizmor) - use-trusted-publishing** on `cargo
publish`: suppressed via `# zizmor: ignore[use-trusted-publishing]`
inline pragma with a TODO comment documenting the migration path.
Real migration to crates.io OIDC trusted publishing requires
registering the trusted publisher on the crates.io web UI plus
adding `id-token: write` permission to the job; that infra change is
out of scope for this PR and tracked by the inline TODO.
4. **CI** (meta-job): aggregates the above; turns green automatically
once Typos and Actions Security pass.
Local verification: cargo test (61 passed), clippy, fmt, doc, typos,
zizmor (no findings; 12 ignored, 1 suppressed) all clean.
Pre-existing context: main branch CI had been red for over a month due
to these two zizmor findings on release.yml. The Typos failure is
specific to this PR; the zizmor fixes incidentally unblock the
release pipeline ahead of v0.7.0 tagging.1 parent 95a73d7 commit 19010cb
5 files changed
Lines changed: 511 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
| |||
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 177 | + | |
176 | 178 | | |
177 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
10 | 94 | | |
11 | 95 | | |
12 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments