Repository navigation
fix(record): denied_policy claimed a check it never made - #57
Conversation
The value records the developer's own Claude Code permission rule refusing a tool — reader.go reaches it from toolDenialKind "permission-rule". The name said policy, which in this product means the approved set, so a reader takes it for a governance decision. It is not one, and the gap is not theoretical: of the 159 such records on the first machine Wake was installed on, every one was a builtin Bash call. None was a skill, subagent or MCP server. The outcome domain is part of the stored contract record.go refuses to pass an unrecognised value through (ADR-0005, ADR-0007). Renaming it to denied_by_harness_rule says what produced it. Schema 6 -> 7 because the bump is the only thing that routes the old value to the arm that can repair it. Validate checks the version before the outcome, so without it a version-6 line carrying denied_policy matches SchemaVersion and then fails validOutcome: Decode returns a plain "invalid outcome", never ErrUnsupportedVersion. Store.Stale counts only the latter, so those 159 records would be dropped by store.Entries, counted by no health.Scan.StaleRecords, and never rebuilt. With the bump they are refused on read and re-derived from the harness's own history. The delivery watermark stamps the version and starts over on a bump, so nothing needs migrating on the wire — verified here by a rebuild that re-derived all 31,288 records at version 7 with the 159 landing under the new name. This is not versions 4 and 5's rule: those cite ADR-0004 because both changed how event_id is derived. A rename changes no id and adds no dimension. The golden payload moves by four lines, all schema_version. No attribute key changes, so the frozen key set and the privacy allowlist over it are untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The value changes on disk and on the wire, so anything grouping on the old string needs updating. Filed under Changed rather than Fixed for that reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ADR-0004 is about id derivation: versions 4 and 5 cite it because both changed how event_id is derived, and "a stored value whose name overstates the check" is not a claim it makes. A rename changes no id and adds no dimension, so that rule does not carry the bump. What does carry it is mechanical and was missing. Validate checks the version before the outcome, so without the bump a version-6 line holding denied_policy matches SchemaVersion and then fails validOutcome: Decode returns a plain "invalid outcome", never ErrUnsupportedVersion. Store.Stale counts only ErrUnsupportedVersion, so those records would be dropped by store.Entries, counted by no health.Scan.StaleRecords, and never rebuilt — the silent shrink the paragraph below already warns about. The bump routes them through the version arm instead. The citation moves to ADR-0005/ADR-0007, which is how this file already cites the rule that an unrecognised stored value is refused rather than passed through. The changelog said the store is re-derived "by the next scan", which overstates what a hook-fired scan does. rebuildStaleSpool discards the version-6 spool only at wholeHistory scope (internal/activation/boundary.go:181); Trigger runs at consentedWindow and by design (ADR-0025) reports the count and leaves the spool alone. A hooks-only install would therefore never rebuild, and the entry told those users nothing needs migrating by hand, so they had no reason to run the command that repairs it. It now names `wake ingest` and says what happens if they skip it. Comments and changelog prose only; no payload or key set is touched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
8d00fea to
d94fb86
Compare
The rename lengthened one line to 97 characters where its neighbours sit near 75. No lint rule enforces a width here, so nothing failed; the words are unchanged and only the line breaks move. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Both threads addressed — details in the replies on each. Summary of what landed:
Both reviews were right and both are applied. On the ADR citation I went with ADR-0005/ADR-0007 and stated the mechanism — version-checked-before-outcome, so without the bump those 159 records return One thing neither review asked for, worth recording since only the compiler was checking it:
|
…fault Synthetic fixtures choose their own key cardinality, and key cardinality is what bounds a block — a generated spool with four skill names says nothing about whether this is economical on real telemetry. Measured on a real 21.9 MB spool of 32,032 records: 69 blocks totalling 218 KB, 1.00% of the spool. A view read 12 blocks plus 502 records instead of decoding 32,032. A repeated seal wrote and pruned nothing. Coverage complete. The number that matters: 98 distinct (kind, name, outcome) keys across all 32,032 invocations. Real telemetry is far more repetitive than the fixtures, so the design is more economical on real data than the synthetic numbers suggest. Reads only what WAKE_TEST_SPOOL points at and writes only into t.TempDir(), and skips when the variable is unset, so no fixture is committed and CI is not gated. The doc comment says to point it at a copy. Incidentally confirmed the schema refusal against real data: the live spool is already at schema 7 from #57, and this build at 6 read a head of 0 rather than misinterpreting 32,032 records — which is the behaviour ADR-0007 asks for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Brings #57 (denied_policy -> denied_by_harness_rule) onto the epic. Two conflicts, both from the same cause: #57 and DG-99 each bumped SchemaVersion from 6 to 7 for an unrelated change. - internal/record/record.go — resolved by giving the two changes two numbers. Version 7 stays the rename, which is what shipped on main; the mcp_server dimension becomes version 8. A version whose records two builds disagree about is the one thing the constant exists to prevent (ADR-0004, ADR-0007). - internal/adapter/claudecode/reader.go — main renamed the constant, DG-100 changed outcomeFor's signature to return the unresolved half. Both kept. - internal/adapter/claudecode/reader_test.go — auto-merge kept the epic's hunk, which still named the pre-rename constant. Renamed. - internal/remote/testdata/golden.json — regenerated. The only difference is wake.schema_version 7 -> 8; the attribute key set is unchanged (ADR-0027, ADR-0030). - CHANGELOG.md — the textual merge left two ### Changed headings under Unreleased and a schema claim of "6 to 7". Collapsed, corrected to 6 to 8, and the mcp_server entry added. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
What
Renames the outcome
denied_policytodenied_by_harness_rule, and bumps therecord schema from 6 to 7.
Why
The value records the developer's own Claude Code permission rule refusing a
tool —
reader.goreaches it fromtoolDenialKind: "permission-rule". The namesaid policy, which in this product means the approved set, so a reader takes it
for a governance decision.
It is not one, and the gap is not theoretical. Wake was installed on a real
machine for the first time while investigating this:
denied_policy.builtin_tool: Bash. None was a skill, subagent or MCPserver — the categories governance is actually about.
Shipped to a client's sink, a dashboard row reading "policy denial" would look
like the governance layer working, and would be the developer's own permission
rule. A stored value whose name overstates the check it made is the defect
adr/0004exists to prevent.Why this is a schema bump
Same rule versions 4 and 5 used: no field is added, but a stored value changes
meaning, so a spool carrying the old one is refused on read and re-derived from
the harness's own history.
Nothing needs migrating by hand. The delivery watermark stamps the schema
version and starts over on a bump, so the wire is covered by the same mechanism.
Verification
make validate— clean.make lint— 0 issues.schema_version. No attribute keychanges, so the frozen key set and the privacy allowlist over it are untouched.
version 7, with the 159 landing under the new name and delivery still
off(
delivered through: 0) — so no record under the old name ever left a machine.Breaking
Anything grouping on the old string — a saved query, a dashboard panel — needs
updating. Called out under
## [Unreleased]→ Changed.