Skip to content

test(pi): trim stale tool-mapping assertions - #1983

Closed
muunkky wants to merge 2 commits into
obra:devfrom
muunkky:fix/pi-tool-mapping-test
Closed

muunkky wants to merge 2 commits into
obra:devfrom
muunkky:fix/pi-tool-mapping-test

Conversation

@muunkky

@muunkky muunkky commented Jul 13, 2026 •

Copy link
Copy Markdown

Who is submitting this PR? (required)

Field Value
Your model + version Claude Opus 4.8 (claude-opus-4-8), 1M context
Harness + version Claude Code 2.1.207
All plugins installed gitban (muunkky.github.io/gitban-site), frontend-design, skill-creator, claude-patent-creator-standalone. Not superpowers itself.
Human partner who reviewed this diff Cameron Rout (@muunkky)

What problem are you trying to solve?

tests/pi/test-pi-extension.mjs fails on dev:

$ node --test tests/pi/test-pi-extension.mjs
not ok 6 - pi tools reference documents pi-specific mappings
  name: 'AssertionError'
# pass 5
# fail 1

The test loops over ['Skill', 'Task', 'TodoWrite', 'read', 'write', 'edit', 'bash'] and asserts each matches pi-tools.md. write, edit and bash are gone — e7ddc25 ("Prune per-harness tool-mapping boilerplate") removed those generic mapping rows on purpose. The test was never updated, so it fails on write.

What does this PR change?

The assertion in that one test. It now checks the mapping table itself:

-  for (const expected of ['Skill', 'Task', 'TodoWrite', 'read', 'write', 'edit', 'bash']) {
-    assert.match(text, new RegExp(expected));
-  }
+  const rows = text.split('\n').filter((line) => line.startsWith('|'));
+  assert.ok(rows.some((row) => /subagent/i.test(row)), 'mapping table documents subagent dispatch');
+  assert.ok(rows.some((row) => /todo|task/i.test(row)), 'mapping table documents task tracking');

pi-tools.md is not touched — the prune stays pruned. git diff --numstat dev → 3 3 tests/pi/test-pi-extension.mjs. Suite goes 5 pass / 1 fail → 6 pass / 0 fail.

Is this change appropriate for the core library?

Yes — it repairs a core test that is currently red.

What alternatives did you consider?

Restoring the deleted rows to pi-tools.md would also turn the test green, and that's what the earlier attempt did. It's the wrong fix: it reverts a deliberate decision to satisfy a stale assertion.

A straight trim of the token list — my first attempt, and it was wrong for a reason worth stating. I trimmed the list to ['pi-subagents', 'subagent', 'TODO.md', 'TodoWrite'] and it passed. Then I deleted the entire mapping table from pi-tools.md and it still passed: all four tokens survive in the prose around the table. The trimmed list guarded nothing — the same defect the original list has. So the assertions here anchor on the table rows instead. I verified it by deleting the table and watching the test fail, then restoring it and watching it pass.

That's three added lines rather than one, which is more than a pure trim. If you'd rather have the one-line version, it's yours, but it doesn't test anything.

Does this PR contain multiple unrelated changes?

No. One file.

Existing PRs

#1903 (@tianma-if) found this failure and the credit for spotting it is theirs. It was closed partly as one of a ten-PR batch, but also on the merits: it restored the pruned Read/Write/Edit/Bash rows, reversing e7ddc25. This does the opposite and leaves pi-tools.md alone. I said on that thread I'd stand aside if they wanted to write it; there's been no reply.

Environment tested

Harness Harness version Model Model version/ID
Claude Code 2.1.207 Claude Opus 4.8 claude-opus-4-8 (1M context)

Reproduced the failure on a clean dev checkout (Linux, node --test) before changing anything; confirmed green after; and confirmed the new assertions fail when the mapping table is removed.

Evaluation

Not applicable — test-only change, no skill prose touched, so there's no agent behaviour to eval. The verification is the test: red before, green after, and red again if the thing it checks is deleted.

Rigor

  • If this is a skills change: I used superpowers:writing-skills and completed adversarial pressure testing
  • This change was tested adversarially, not just on the happy path
  • I did not modify carefully-tuned content (Red Flags table, rationalizations, "human partner" language) without extensive evals

First box unticked: this is test-only, no skill content changed, so writing-skills doesn't apply.

The adversarial test is the mutation above: I deleted the mapping table and confirmed the assertions fail. That's what caught my first attempt, which passed with the table gone.

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

e7ddc25 pruned the generic read/write/edit/bash mapping rows from
pi-tools.md, but test-pi-extension.mjs still asserted they were there,
so 'pi tools reference documents pi-specific mappings' has been failing
since. Assert the mappings that survived the prune instead of the rows
it deliberately removed.
@muunkky muunkky closed this Jul 13, 2026
@muunkky muunkky reopened this Jul 13, 2026
@muunkky
muunkky marked this pull request as ready for review July 13, 2026 16:32
muunkky added a commit to muunkky/superpowers that referenced this pull request Jul 13, 2026
My numbers were wrong: 84.5% rejection (714 vs 131), not 76% — the old figure
came from a truncated page. 43% are closed with NO comment; silence is the
modal rejection. Of 131 merges, 89 are obra+arittr; only 42 are external, and
those are median 6 lines / 1 file. Small and boring wins.

The load-bearing finding: merit is evaluated, then overridden. 10 of the 28
AI-triage closures were correct code closed anyway. Three disqualifiers are
fatal on their own — batch, ANY false statement in the body (they verified a
'human reviewer' name against GitHub and found it didn't exist), and venue.
Wrong base branch is survivable (0 sole causes). Closures are appealable.

Logged three liabilities we created and fixed: a false statement on obra#1982's
thread (we promised to keep three PRs closed, then reopened them four minutes
later and left it standing), a checkable overstatement in obra#1983, and an
origin-prompt paragraph that read as the exact trawl signature that killed
obra#1907.
The previous version asserted bare tokens, which all survive in the prose
around the table — delete the entire mapping table and it still passed. That
is the same defect it was meant to fix. Anchor on the table rows instead.
gaurav0107 added a commit to gaurav0107/superpowers that referenced this pull request Jul 14, 2026
The pi tokens (subagent, pi-subagents, Task, TODO.md) also appear in the
surrounding prose, so matching the whole file passed even with the mapping
table deleted — the exact regression this test exists to catch. Filter to
table rows (lines starting with '|') so the assertion fails when the table
is gone and passes on dev.

Reported by @muunkky on obra#1987 (approach from obra#1983); verified failing-first
by stripping the table rows from pi-tools.md.
@muunkky

muunkky commented Jul 14, 2026

Copy link
Copy Markdown
Author

Superseded by #1987, which fixes this test and the antigravity one. @gaurav0107 took the table-scoped assertion in 0873545 — verified it now fails on a pi-tools.md with the mapping table stripped and passes on dev, which is the regression the old token list was missing.

@muunkky muunkky closed this Jul 14, 2026
muunkky added a commit to muunkky/superpowers that referenced this pull request Jul 14, 2026
…closed

Third of four additive reviews adopted. They reproduced our finding
independently before changing anything, shipped our table-scoped assertion
as 0873545, and credited obra#1983 in the commit message. We closed obra#1983 in
their favour, as promised on the thread.

Scoreboard corrected while I was in here: 'our work MERGED inside someone
else's PR' overstated it — none of those host PRs have merged, they are all
still open. Reworded to 'taken into', with the caveat stated. We are not
allowed to soften bad news about ourselves and we are not allowed to
inflate good news either.

The read is now sharp enough to state plainly: 3 of 4 additive reviews
adopted, 0 of 4 own PRs reviewed. The asymmetry is structural — a review is
free work on a PR someone already wants landed; our own PR asks the
scarcest thing a maintainer with 176 open PRs has. And on handoff the
tactic transfers, the relationships do not.
obra pushed a commit that referenced this pull request Jul 15, 2026
The pi tokens (subagent, pi-subagents, Task, TODO.md) also appear in the
surrounding prose, so matching the whole file passed even with the mapping
table deleted — the exact regression this test exists to catch. Filter to
table rows (lines starting with '|') so the assertion fails when the table
is gone and passes on dev.

Reported by @muunkky on #1987 (approach from #1983); verified failing-first
by stripping the table rows from pi-tools.md.
aznikline pushed a commit to aznikline/superpowers that referenced this pull request Jul 21, 2026
The pi tokens (subagent, pi-subagents, Task, TODO.md) also appear in the
surrounding prose, so matching the whole file passed even with the mapping
table deleted — the exact regression this test exists to catch. Filter to
table rows (lines starting with '|') so the assertion fails when the table
is gone and passes on dev.

Reported by @muunkky on obra#1987 (approach from obra#1983); verified failing-first
by stripping the table rows from pi-tools.md.
arittr pushed a commit that referenced this pull request Jul 24, 2026
The pi tokens (subagent, pi-subagents, Task, TODO.md) also appear in the
surrounding prose, so matching the whole file passed even with the mapping
table deleted — the exact regression this test exists to catch. Filter to
table rows (lines starting with '|') so the assertion fails when the table
is gone and passes on dev.

Reported by @muunkky on #1987 (approach from #1983); verified failing-first
by stripping the table rows from pi-tools.md.
arittr added a commit that referenced this pull request Aug 12, 2026
…ee-path router, SDD/Codex efficiency fixes (#2125)

* fix(codex): suppress SessionStart hook auto-discovery with empty hooks object

Codex auto-discovers a plugin's hooks/hooks.json whenever the Codex
manifest has no `hooks` field: load_plugin_hooks falls back to a
hardcoded DEFAULT_HOOKS_CONFIG_FILE = "hooks/hooks.json" and registers
it. hooks/hooks.json is the Claude Code SessionStart hook, it is tracked
in this repo, and the Codex marketplace installs the whole repo root
(source url "./"), so the fallback re-registered the SessionStart hook
and its install-time trust prompt on Codex.

Removing the Codex hook file and the manifest `hooks` pointer (commit
"Remove Codex hooks") did not disable the hook on Codex — it removed the
explicit declaration that was overriding the fallback, so the fallback
took over and found the Claude hooks/hooks.json.

Declare an empty inline hooks object ({}) in .codex-plugin/plugin.json.
It parses as an empty inline hook set and stops Codex reaching the
auto-discovery fallback. An absent field, an empty array ([]), and an
empty inline list all collapse back to the fallback, so the value must
be exactly {}.

Update the test to assert the manifest declares hooks: {} (and that
hooks/hooks.json exists, which is what makes the declaration necessary),
replacing the prior assertion that the field was absent — which passed
while the hook was still being auto-discovered.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Add Codex portal package script

* Harden Codex package script checks

* Default Codex portal package to zip

* Fix Codex plugin category

* chore(codex): remove orphaned session-start-codex hook + refresh hook docs

hooks/session-start-codex has had no caller since "Remove Codex hooks"
(#1845) deleted hooks-codex.json and its manifest registration; the
Codex manifest now declares an empty hooks object so Codex registers no
session-start hook at all. The script is Codex-specific dead code —
nothing executes it on Codex or any other harness.

- Delete hooks/session-start-codex.
- tests/hooks/test-session-start.sh: drop the two Codex cases that are
  redundant with the generic session-start tests (nested-format and the
  legacy-warning omission are already covered by the Claude Code cases).
  Re-point the "wrapper dispatches" case to the live `session-start`
  script so run-hook.cmd dispatch coverage — used by Claude Code and
  Cursor in production — is preserved rather than lost.
- docs/porting-to-a-new-harness.md: Codex is no longer a Shape A
  (shell-hook) harness, so re-anchor that worked example to Cursor (a
  live shell-hook harness that demonstrates the same per-harness field,
  schema, and matcher variance) and mark Codex as native skill discovery
  with no session-start hook. Clears the references to the deleted
  hooks-codex.json.
- docs/windows/polyglot-hooks.md: the "check hooks-codex.json" pointer
  referenced a file deleted in #1845; re-point to hooks-cursor.json.

RELEASE-NOTES.md keeps its historical mention of hooks-codex.json (it
accurately records what that release did). The tests/codex-plugin-sync
fixtures build their own synthetic session-start-codex and test the sync
mechanism generically, so they are intentionally left as-is.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs: re-anchor Shape A examples away from Codex

* Strip hooks from Codex portal package

* Preserve hooks in Codex package manifest

* Release v6.1.1: fix Codex SessionStart hook re-registration, add Codex portal packaging

* Revert "Remove Gemini CLI support"

This reverts commit 711d895.

* refactor(skills): fold Integration skill lists into points of use

The list-style Integration sections in subagent-driven-development and
executing-plans duplicated references that already exist where the flow
uses them (process digraph, When to Use, prompt templates, Step 3), so
they added maintenance cost without carrying behavior. The one entry not
duplicated anywhere — the using-git-worktrees isolated-workspace
requirement — moves to its point of use: SDD's Pre-Flight Plan Review and
executing-plans' Step 1. Micro-tested 5/5: controllers at skill start
establish or verify the worktree before reading the plan or dispatching
Task 1, including under skip-the-ceremony pressure. The prose Integration
sections in requesting-code-review and other skills are unchanged — they
carry placement content, not an index.

* refactor(skills): fold systematic-debugging Related-skills block into Phase 4

Same treatment as subagent-driven-development and executing-plans: the
test-driven-development entry duplicated the reference already at Phase 4
Step 1, and the verification-before-completion entry was a sole carrier —
it moves to its point of use in Phase 4 Step 3 (Verify Fix). Micro-tested
2/2: subjects at the just-implemented-a-fix point invoke
verification-before-completion before any success claim, including under
ship-pressure.

* refactor(skills): stop offering to discard work in finishing-a-development-branch

The completion menu dates from when throwing away branches was routine;
offering 'Discard this work' beside 'Merge' on every completion advertised
destroying finished, passing work. The menu is now 3 options (2 detached
HEAD); discard survives as an explicit-request-only path with the same
typed-confirmation ritual and cleanup mechanics. Fresh-eyes fixes in the
same pass: Option 2 actually creates the pull/merge request
(platform-neutral tooling) and reports the URL; Step 3's base-branch
detection drops a command that printed a SHA instead of choosing a branch
(ask when not known); Option 1 gains a failure branch (merged-result test
failures stop cleanup); description trimmed to trigger-only. Micro-tested
4/4: both menus verbatim with no discard, no discard offer even when the
human sounded lukewarm about the feature, and a prose 'throw it all away'
still required the typed confirmation before any deletion.

* refactor(skills): make PR creation forge-agnostic in finishing-a-development-branch

Naming gh and glab implicitly blessed two forges; Gitea, Forgejo,
Bitbucket and others are equally valid. Point at the forge's CLI or the
creation URL printed on push instead of naming tools.

* refactor(skills): compress finishing-a-development-branch, adopt rationalization table

Red Flags and Common Mistakes fold into one Common Rationalizations table
(house Excuse/Reality form); every prior entry maps to a table row or an
inline sentence in the step it guards. Instructions rephrase positively —
what to do rather than what to avoid — with negations remaining only in
statements of fact. Workflow prose tightens throughout; menus, detection
mechanics, cleanup provenance, and the typed-discard ritual are unchanged.
Re-verified 4/4 after the rewrite: both menus verbatim, the lukewarm-human
pressure arm cited the rationalizations table when declining to offer
discard, and a prose discard request still required the literal typed
word.

* fix(skills): capture worktree path before Step 5 changes directory

Step 6 recomputed WORKTREE_PATH after Option 1 and discard had already
cd'd to the main repo root, so --show-toplevel returned the main root:
the provenance check could never match, cleanup silently no-oped, and the
branch delete failed with the worktree still attached. A test subject had
to deviate from the literal skill to produce a working sequence. The
capture moves to Step 2 (still inside the workspace); Step 6 consumes
Step 2's values and drops its redundant recompute and MAIN_ROOT
derivation. Also: Option 2 gains the detached-HEAD push variant its menu
advertises, and the stale-green rationalization row states what a green
run proves instead of asserting the tree changed. Re-verified: merge-flow
and discard-flow subjects both walk the literal skill to correct cleanup
with concrete paths and no deviations.

* refactor(skills): reframe testing-anti-patterns as writing-good-tests

The disclosure doc becomes a catalog of what to do: six positively named
rules (assert on real behavior, cleanup in test utilities, mock at the
right level, mirror real data, tests ship with implementation, prefer
real components), each leading with the GOOD example and keeping the
violation as contrast. Iron Laws, gate functions, human-partner lines,
and warning signs all survive; The Bottom Line recap and the
TDD-prevents-these section fold into one Overview sentence. SKILL.md's
pointer moves into the Good Tests section it belongs with. Micro-tested
2/2: a mock-existence assertion got rewritten to a real-behavior
assertion citing Rule 1, and a test-only teardown method plus a
to-be-safe mock were both rejected citing Rules 2 and 3.

* fix(skills): broaden writing-good-tests trigger to any test writing

The pointer fired only on adding mocks or test utilities; the doc's own
load-when line already says writing or changing tests. The narrow trigger
would skip the rules exactly when an agent thinks no mocks are involved.

* feat(skills): absorb falsifiability discipline into writing-good-tests

Generalized from agentsview's testing-without-tautologies skill: a new
Iron Law and lead rule (name the production change that would fail the
test, derive expectations independently of the code under test), a
test-your-code-not-the-framework rule with the characterization-test
exception and the trivial-code guidance, branch-specific doubles folded
into Mock at the Right Level, a closing Mutation Check, and six new
warning-sign smells. Rule 1 carries the string-presence trap by name:
grep-style tests on scripts, skills, and prompts counterfeit
falsifiability — the observable is the artifact's behavior, never its
text — with a hard stop in the gate function. Repo-specific content
(testify, backend parity, test-level ladder) stays in the source skill.
Micro-tested: 3/3 tautology verdicts with correct rule citations and the
mutation check named unprompted; a RED-pressure subject refused the
10-second grep test and wrote a behavioral one citing the trap.

* fix(skills): close the change-detector hole in writing-good-tests

Fresh-eyes review found falsifiable-but-worthless tests passed every
rule: a constant assertion can fail, uses a literal, mocks nothing — and
protects nothing, firing on intentional decisions while sleeping through
bugs. Rule 1 gains the what-break-would-this-catch question (absorbed
from the source skill's quality gate, missed in the first pass) with a
gate stop for change detectors; Rule 6's trivial-code list regains
constants; Rule 7 gains the release valve that trivial-only changes earn
no ceremonial test; the coverage-theater and change-detector smells join
Warning Signs; the Rule 6 example stops modeling exact-copy brittleness.
Micro-tested: under a tests-with-every-PR norm, a subject rejected both
draft constant tests citing the new gate and replaced them with a test of
the retry behavior the constant controls.

* refactor(skills): compress writing-good-tests additions; doc changes earn no tests

Prose additions from the last two passes tightened to the terse guard
form: change-detector rule, string-presence trap, and Rule 7's release
valve each drop to a few sentences. Rule 7 now settles the jurisdiction
question outright: trivial code and human prose earn no test; skills and
prompts are pressure-tested per writing-skills when edits change
behavior, never text-asserted. Micro-tested: a subject with a README
rewrite plus a skill typo fix, under tests-with-every-PR pressure,
shipped zero tests — declining the string assertions and the ceremonial
subagent pressure-test alike.

* experiment: ground-up two-principle rewrite of writing-good-tests

Re-derived from scratch: every rule becomes a corollary of two principles
(every test names the break it catches; every test exercises the real
thing), one consolidated gate per principle, four example pairs kept, the
rest carried by prose. Scratch branch for comparison against the accreted
eight-rule version.

* refactor(skills): drop social proof from dispatching-parallel-agents

Real-World Impact restated the Real Example from Session as statistics;
Key Benefits and the time-saved line sold the skill to a reader already
executing it. Instructions unchanged.

* refactor(skills): drop social proof from systematic-debugging

Real-World Impact was statistics; the Overview opener restated the core
principle as motivation. The 95%-of-no-root-cause line stays: it guards
the bail-out point, which is rationalization control, not social proof.
Supporting Techniques/Related skills untouched (PR #1932 owns that).

* refactor(skills): drop persuasion sections from verification-before-completion

Why This Matters (failure-memory testimonials), the dishonesty reframing
in the Overview, and The Bottom Line recap all restate stakes the Iron
Law, gate function, and rationalization table already enforce. This is
the eval-gated class: the bet is that discipline holds without the
persuasion prose — evals on this branch decide.

* refactor(skills): trim quality claim from executing-plans subagent note

The tell-your-partner directive and the prefer-SDD instruction stay; the
significantly-higher-quality sentence restated them as a claim.
Integration section untouched (PR #1932 owns it).

* refactor(skills): drop Advantages section from subagent-driven-development

Five blocks of benefits and cost/benefit selling aimed at a reader who
has already invoked the skill; the vs-Executing-Plans comparison also
duplicates the one under When to Use. Integration section untouched
(PR #1932 owns it).

* refactor(skills): trim requesting-code-review, keep review guards as a table

Integration with Workflows restated the When to Request Review triggers
grouped by caller (each-task / before-merge / when-stuck all appear at
point of use) — detritus, so it goes.

The intro's crafted-context sentence guarded two things at once, so keep
both as Common Rationalizations rows (house Excuse/Reality form) rather
than deleting the sentence. The skill's reader is the coordinator, not
the code's author:

- Don't review the diff inline — that burns the coordinator's context
  window; dispatch a subagent so the diff and e