Skip to content

fix(source-control): refuse publishing a contrary event with no discovered time - #12626

Merged
kyle-sexton merged 4 commits into
mainfrom
fix/12450-publish-refuses-unstamped
Nov 3, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
fix/12450-publish-refuses-unstamped

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Closes #12450

Summary

The promotion-evidence publisher allowed the one-time legacy discovered stamp but did not require it, so a contrary event could stay unstamped when collect() had no sidecar to read. publish() now refuses that itself.

Fix

  • publish() refuses any non-re-earned event whose discovered is missing or does not parse, before it reads or writes anything.
  • The tests' legacy files, the daily-loop fixture included, are written directly with a matching sidecar, since publish() no longer writes them.
  • New test: a published re-earn cannot gain the legacy stamp, over a file holding that re-earn.
  • telemetry-upsert.test.sh check 95 failed on any host whose node is a version-manager shim, because it runs under a fake HOME. Its node stub now keeps the real HOME. This blocked the verify gate for every change to this skill on such a host.

Verification

  • publish-promotion-evidence.test.sh: 85 of 85 pass, with two new tests.
  • The end-to-end suite the issue leaves unnamed is scripts/promotion-evidence-e2e.test.sh: 39 of 39 pass. resolve-promotion-evidence.test.sh: 45 of 45 pass.
  • Removing the event?.event !== "re-earned" clause fails only the new re-earn test (84 pass, 1 fail).
  • Left out: nothing.

Related

Refs #12394, #12434.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQb9Q296cDKeBR2kaZuHaV

kyle-sexton and others added 4 commits November 2, 2026 21:57
…vered time

publish() allowed the one-time legacy stamp but did not require it, so a
contrary event could stay unstamped when collect() had no sidecar to read.
Refuse it in publish(), write the tests' legacy fixtures directly, and test
that a published re-earn cannot gain the legacy stamp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q296cDKeBR2kaZuHaV
…fake HOME

Check 95 runs with another HOME, and a version-manager shim for node fails
there, so the refusal it reads never prints on a host that uses one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q296cDKeBR2kaZuHaV
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 3, 2026 03:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T03:21:39.231438Z ebb7aef Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed ebb7aef10a5bc05a7732b9d66500b63773357b61: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #12626

I found no security issues.

I read the whole change in all 4 files:

  • publish-promotion-evidence.mjs: publish() now refuses a non-re-earned event whose discovered is missing or does not parse. The check runs before any file is read or written. This only narrows what the evidence publisher accepts. Nothing new gets through, no token, secret or trust control is involved, and the error message holds only event keys that the tool derives itself.
  • publish-promotion-evidence.test.mjs: test fixtures and two new tests. These are tests only, with no runtime surface.
  • telemetry-upsert.test.sh: adds a test-only node stub under $TMP/bin that runs the real node with the real HOME. The unquoted heredoc expands $HOME and $(command -v node) when the stub is written, from the test runner's own environment, and that is intended. No untrusted input reaches it, and it runs only inside the test harness.
  • .changes/ fragment: changelog text only.

None of the changed files matches a TRUSTED PATHS glob. No plugin manifest, workflow, trust control, merge hold or standing instruction is touched.

The PR context file has no embedded text telling the lane to pass the PR, skip a check, drop a finding or post elsewhere. This lane has no prior findings on this PR (round 0 of 3), so the round cap did not apply.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed ebb7aef10a5bc05a7732b9d66500b63773357b61: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #12626, no findings

I read every hunk of all 4 changed files. To check the change against its callers I also read publish(), collect() and main() in publish-promotion-evidence.mjs, the tests the diff does not touch that call publish(), the setup of telemetry-upsert.test.sh, and the operator reference promotion-evidence-bootstrap.md.

Closing issue #12450, acceptance criteria

  • "In --out mode, publish() refuses any non-re-earned event whose discovered is missing or doesn't parse": met. The check at publish-promotion-evidence.mjs#L968-L971 runs before the function reads or writes anything. main() calls publish() only when --out is set (L1103). This closes the race from the issue: a missing sidecar leaves priorGeneratedAt null, so the legacy events stay unstamped, and publish() now refuses them. Tests: "a contrary event with a missing or unparsable discovered time is refused and writes nothing" (missing, unparsable, and a legacy file holding the event) and the changed assertion at test L1020.
  • "The daily-loop test's legacy fixture is then written directly, not built through publish()": met. The test now uses writeLegacy(), which writes a sidecar whose sha256 matches the file. legacyDiscovered(Date.parse("2026-08-15T00:00:00Z")) equals LEGACY, so the L1005 assertion still holds.
  • "Add assert.throws(() => publish(out, [{...R, discovered: legacyDiscovered}])) over a file holding a re-earn R": met. This is the test "a published re-earn cannot gain the legacy discovered stamp". R gets past the new filter because it is re-earned, then the upgrade clause refuses it as a changed discovered time. Deleting the event?.event !== "re-earned" clause from upgrade would make this test fail.
  • "the existing publisher (82) and end-to-end (36) suites still pass": author-claimed, not verified. The PR reports 85/85, 39/39 and 45/45. I had no shell and ran nothing. I traced the existing tests that call publish() by hand (L690–759, L906–909, L925–939, L951–953, L976–978, L1004, L1015–1020). Each one either passes stamped events or still expects its refusal.

Other changes

  • telemetry-upsert.test.sh: the node stub is a here-doc without quotes, so the real $HOME and node path are filled in when the stub is written, before any check swaps HOME. The PATH test that expects node to be missing uses PATH=/nonexistent (L434), so it never reaches the stub.
  • Changelog fragment: bump: patch under ### Fixed matches the change (a new refusal, no interface change) and the other fragment's format. No plugin manifest changed, so there are no manifest lines.
  • Path-scoped rules: skill-bodies-state-current-rules.md and cost-claims.md match plugins/*/skills/**. The diff restates no upstream fact and makes no cost claim.
  • I found no embedded instructions in the PR context. The prior-findings file lists no earlier posts (0 rounds, cap 3).

Note, not counted as a finding: the --out refusal list in promotion-evidence-bootstrap.md#L201-L204 does not mention the new refusal. That list already leaves out the clock-behind refusal, which L153 covers instead, and a normal operator run never reaches the new refusal. A one-clause addition there would keep it complete.

Spend: none. This change adds no lane runs, turns, model choice or billing.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 3bd42ca Nov 3, 2026
71 checks passed
@kyle-sexton
kyle-sexton deleted the fix/12450-publish-refuses-unstamped branch November 3, 2026 03:37
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.

fix(source-control): require the legacy discovered stamp in publish, and test the re-earn exclusion

1 participant