Skip to content

hooks: rename the local card check to fix the shownText clash on main - #73

Merged
gabe4coding merged 1 commit into
mainfrom
harness/ccm-72-shown-text-name-clash
Oct 26, 2026
Merged

gabe4coding merged 1 commit into
mainfrom
harness/ccm-72-shown-text-name-clash

Conversation

@gabe-bots

@gabe-bots gabe-bots Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Intent

hooks/register.tsx parses again on main. The card check from #66 gets the name cardText. The shownText import from #68 stays the same.

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Claude Code loads the hooks module] --> B{Does the module parse?}
    B -->|no, on main| C[Every hook fails to load]
    B -->|yes, with this change| D{Which action runs?}
    D -->|Approve or Discard on a card| E{Does the file still have the shown text?}
    E -->|yes| F[Act on the shown text]
    E -->|no| G[Refuse and ask for a new review]
    D -->|run_code returns| H[Cut the result on the shown text]
Loading

Cause

  • hints: Approve uses the text shown on the card #66 added a local async function shownText($, path, shown) at line 768. It checks that the file still has the text that the card showed.
  • run_code: cut on the shown text and keep it for recall (#64) #68 imports shownText(json) from hooks/protocol.ts at line 95. It turns a result into the text that the model sees.
  • The two functions do different work, so a merge is not possible. This change renames the local function and its two callers at lines 782 and 1116.
  • The version goes from 0.12.15 to 0.12.16. Claude Code caches a plugin per version, and 0.12.15 has the module that does not parse.

Why CI passed on each PR

Evidence

Base: main at c664e0c. Branch: harness/ccm-72-shown-text-name-clash. Node 24.22.1, Claude Code 2.1.296, the version that CI pins.

claude plugin test . on main: 176 tests fail, and the run reports one extra failure for the file.

(fail) run_code > routes sandbox calls to MCP tools and returns the value [32.20ms]
  HooksError: code-mode: hooks module did not load: /workspace/ccm-72/repo/hooks/register.tsx does not parse: "shownText" has already been declared (line 768, column 16)
...
(fail) the file ran to its end [0.00ms]
  a rejection nothing handled: code-mode: hooks module did not load: ... "shownText" has already been declared (line 768, column 16)

 68 pass
 176 fail
Ran 244 tests across 3 files. [1.10s]
exit: 1

The CI log of the main run 40291688357 has the same counts: 68 pass, 176 fail, Ran 244 tests across 3 files.

claude plugin test . on this branch:

 243 pass
 0 fail
Ran 243 tests across 3 files. [8.17s]
exit: 0

The named tests of #66 and #68 fail on main and pass on this branch:

== main
(fail) output projection > make it fail: a result cut only after pretty print is kept for recall [8.21ms]
(fail) the approval ledger > Approve of a file that changed after the band showed it fails and records nothing [7.19ms]
(fail) the approval ledger > Approve of a hint proposal that changed after the band showed it fails and records nothing [9.86ms]
(fail) the approval ledger > Approve of a function proposal that changed after the band showed it fails and records nothing [12.34ms]
== branch
(pass) output projection > make it fail: a result cut only after pretty print is kept for recall [72.85ms]
(pass) the approval ledger > Approve of a file that changed after the band showed it fails and records nothing [72.20ms]
(pass) the approval ledger > Approve of a hint proposal that changed after the band showed it fails and records nothing [80.35ms]
(pass) the approval ledger > Approve of a function proposal that changed after the band showed it fails and records nothing [79.07ms]

node tests/runner.integration.mjs with EXPECT_NETWORK_BLOCK=1: it passes on main and on this branch. It runs runtime/runner.mjs and does not load the hooks module. The CI jobs ubuntu-latest node 22.13, ubuntu-latest node 24 and macos-latest node 24 also passed on main.

== main (Node 24.22.1)
pass  the process has no network (unshare)
all passed
exit: 0
== branch (Node 24.22.1 and Node 22.23.4)
pass  make it fail: a 200000-char return arrives whole through a pipe
pass  make it fail: a 1000000-char return arrives whole through a pipe
pass  the process has no network (unshare)
all passed
exit: 0

The checks on this branch:

$ node tests/docs.check.mjs
all passed
$ node tests/code.check.mjs
all passed
$ npx -y -p typescript@7.0.2 tsc -p tsconfig.pure.json
exit: 0
$ sh scripts/format.sh --check .
All matched files use Prettier code style!
$ node tests/version.check.mjs origin/main
pass  version 0.12.15 -> 0.12.16 for 2 changed plugin files

The full type check and /verify need a Claude Code session that is logged in. They did not run here. CI does not run the full type check.

Closes #72

PR #66 added a local async function shownText that checks that the file
still has the text the card showed. PR #68 imports shownText from the
protocol module for the cut of a run_code result. Together the two give
a duplicate name, so hooks/register.tsx does not parse on main.

Rename the local function to cardText and keep the import. Raise the
version to 0.12.16, because 0.12.15 has the hooks module that does not load.

Closes #72
@gabe-bots gabe-bots Bot added the needs-gabe Needs Gabe's decision before work continues label Oct 26, 2026
@gabe4coding
gabe4coding merged commit c525f26 into main Oct 26, 2026
13 checks passed
@gabe4coding
gabe4coding deleted the harness/ccm-72-shown-text-name-clash branch October 26, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-gabe Needs Gabe's decision before work continues risk:t2-soft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

register.tsx: duplicate shownText breaks the hooks module on main

2 participants