Skip to content

tri gates: stop two different inputs from sharing one cache key (Refs #2559) - #2560

Merged
gHashTag merged 4 commits into
masterfrom
fix/cache-key-collisions
Aug 23, 2026
Merged

gHashTag merged 4 commits into
masterfrom
fix/cache-key-collisions

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

sha_of mapped different inputs onto the same mutation-cache key in two ways. A shared key is the harmful direction: it serves a row measured against one input when asked about another.

hazard collision
read(p).unwrap_or_default() gone == empty; any two unreadable paths == each other
concat with no separator ["ab","c"] == ["a","bc"] — reachable for any gate with >1 control

Closed with a length-prefixed record per file (path, read status, bytes).

Negative control. The new test was run against the old sha_of and went red on the boundary case (ba7816bf8f01cfea on both sides); green against the new one. A test that passes on the broken version tests nothing.

Second fix. The interrupt-marker write was let _ = fs::write(...); on failure the loop mutated anyway with nothing on disk to tell the next run. It now refuses. Verified with target/ at mode 555: the run errors and git status -- tools/ stays empty.

Gates run: cargo build -p tri --all-targets clean, cargo test -p tri 193 passed. M5 freeze intact (sha256(compiler.rs) == FROZEN_HASH).

Refs #2559

sha_of built the mutation cache key two ways that map DIFFERENT inputs
onto the SAME key -- the direction that hurts, since a shared key serves
a row measured against one input when asked about another.

  * read(p).unwrap_or_default() made an unreadable file hash as the
    empty string: "gone" and "empty" collide, and so do any two
    unreadable paths.
  * Contents were concatenated with no separator, so the boundary could
    move: ["ab", "c"] and ["a", "bc"] hash identically. `judges` is a
    list, so any gate with more than one control could reach this.

Both close with a length-prefixed record per file: path, read status,
bytes. The new test fails against the old function -- verified by
reverting it and watching the assertion go red.

Also: the interrupt marker write was `let _ = fs::write(...)`. On
failure the run mutated anyway with nothing on disk to say so, which
disarms the guard exactly when it is needed. It now refuses to mutate,
verified with target/ made read-only: the run errors and leaves the
tree untouched.

Refs #2559
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-23 14:45:44 UTC

Summary

Status Count
Total Open PRs 7
PRs with Failing Checks 3
PRs with All Checks Green 4
READY 3
FAILING 3
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e905ba8eeb53 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-23 14:52:40 UTC

Summary

Status Count
Total Open PRs 8
PRs with Failing Checks 4
PRs with All Checks Green 4
READY 3
FAILING 4
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e905ba8eeb53 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-23 15:04:31 UTC

Summary

Status Count
Total Open PRs 7
PRs with Failing Checks 3
PRs with All Checks Green 4
READY 3
FAILING 3
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e905ba8eeb53 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-23 15:13:21 UTC

Summary

Status Count
Total Open PRs 7
PRs with Failing Checks 3
PRs with All Checks Green 4
READY 3
FAILING 3
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e905ba8eeb53 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit 1e3f474 into master Aug 23, 2026
34 of 35 checks passed
@gHashTag
gHashTag deleted the fix/cache-key-collisions branch August 23, 2026 15:25
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.

1 participant