/soleur:workfrom soleur
Executes work plans efficiently while maintaining quality and finishing features. Orchestrates review, compound, and ship pipeline steps.
Ships in soleur. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Cloud Mode (Devin): before pipeline work run bash "${CLAUDE_PLUGIN_ROOT}/scripts/cloud-detect.sh". If CLAUDE_PLUGIN_ROOT is unset (cloud exec shells do not export it), resolve the root by IDENTITY, never by script basename: for d in "$HOME/.local/share/devin/cli/plugins/cache" and /opt/.devin/plugins, skip unless [ -d "$d" ], then MANIFEST="$(find "$d" -path '*/.claude-plugin/plugin.json' -exec grep -l '"name"[[:space:]]*:[[:space:]]*"soleur"' {} + 2>/dev/null | head -1)", ROOT="${MANIFEST%/.claude-plugin/plugin.json}" — one resolution, two consumers: $ROOT/scripts/cloud-detect.sh and $ROOT/scripts/precommit-guard.sh. (Shape check, not authentication: a planted {"name":"soleur"} dir passes — ADR-179 A11.) local or not-local:no-devin-env proceeds normally; any other not-local:<reason> applies <plugin-root>/devin/INSTRUCTIONS.md §Cloud Mode: emit the --banner, fan out sequentially with Reviewed-Coverage: sequential-fallback disclosure (never claim an independent review ran), message_user ack before any secrets read or production mutation, and run precommit-guard.sh before any git commit — hooks do not fire in cloud.
Grok Build (plugins/soleur/lib/harness.ts invokeSkill()): Read this SKILL.md in this process and run it to completion. A one-segment soleur:<name> in this document names a SKILL — on Grok Build, Read plugins/soleur/skills/<name>/SKILL.md in this process; it is not a nested tool_use. A multi-segment id such as soleur:<domain>:<name> names an AGENT: spawn it, never Read it, and on Grok Build spawn_subagent takes the id with its colons replaced by hyphens (agentIdToGrokSubagentType). Claude Code: Skill tool for a skill (soleur:<name>), Task tool with subagent_type for an agent. Forbidden is executing a subset, not the Read.
You are the implementation orchestrator for standalone soleur:work and one-shot Step 3:
soleur:review → soleur:compound → soleur:ship.## Work Phase Complete as a turn boundary when you own the pipeline (see Invocation Mode below).soleur:review, soleur:compound, soleur:ship via slash commands — never hand-roll ship steps.See plugins/soleur/lib/workflow-fidelity.ts (IMPLEMENTATION_TAIL) and Phase 4 Invocation Mode below.
"PROPAGATED" IS A MEASUREMENT ACROSS EVERY SITE ASSERTING THE CLAIM — NOT AN OBSERVATION ABOUT
THE ONE YOU EDITED. Grep for the OLD claim after correcting it, never for the new one: a residual
count over the new text is structurally blind to the sites still carrying the old. A superseded
position survives precisely where prose review does not look — machine-readable frontmatter, an
operative conclusion far from the edited paragraph, and a DIFFERENT document citing the old
position as its own contrast case — so a corrected document containing an uncorrected field clears
both the gates and the review. A literal grep is the WEAKEST of the three sweeps, and
PARAPHRASE is the mode with no coverage — wrap-insensitivity handles a blockquote splitting
a phrase, and neither handles a site that restates the claim in different words. Write the
claim as a SENTENCE and grep its paraphrases; the highest-risk position is a **Prevention:**
line, because that is the part a future session executes. Why: #7957 — a sweep that was
wrap-insensitive across all 9,684 tracked *.md returned 0 for a file it had just corrected,
while that file's ## Session Errors still prescribed "wait for the completion notification"
as the remedy for an error it names "Inferred a commit VERDICT". Why: #7349 — a legal record's controllership was corrected in
prose while its YAML controller: field FIFTEEN LINES ABOVE still asserted the superseded
position, along with the operative balancing conclusion and a sibling document; the signed-off
audit had already recorded that propagation as DISCHARGED. Same shape as the measurement rule
below, one level up: that rule protects a number's freshness, this one protects a correction's
reach. See knowledge-base/project/learnings/2026-08-12-every-blocking-finding-was-the-defect-class-the-pr-existed-to-close.md.
VERIFY A MEASUREMENT ONCE, BEFORE IT PROPAGATES. When a plan's sweep will write the same measured fact into more than one file, verify it at the granularity you are about to CLAIM it — before the first write, not after the last. A false measurement does not stay where you put it: downstream files, issue comments, and review agents all consume it as fact and build on it, so the cost of correcting it scales with how far it spread, and the correction itself has to be swept. Why: #7325 — "cx33 is available in hel1-dc2" was read off a FLEET-WIDE probe and written into 4 files and 2 issue comments. It is false per-datacenter. Six review agents read it and one built its top finding on it (recommending an amendment to a hard-rule exception), so the error had already propagated one level past the diff before a 15-second re-probe falsified it. Project every measurement onto the exact scope you will assert — per datacenter, per host, per environment — and re-probe rather than adjudicating between two readings of the record.
SINGLE-SOURCE THE RATIONALE BEFORE WRITING IT, NOT AFTER REVIEW SAYS SO. Prose is review surface: every restated paragraph is re-read by every agent and can drift independently. Write the reasoning ONCE at the artifact that owns the decision (the ADR for the element, the resource for the resource) and make every other site a one-line pointer anchored on content, not a line number. Why: #7325 — ~300 lines of justification prose across 8 files became the bulk of the review surface for a one-literal change, and two copies of the same probe table DIVERGED INSIDE THE SAME PR (one said "flipped twice", the other "three times") before any reviewer saw them. The review's own conclusion was to delete one copy. A short rationale plus a pointer is both cheaper to review and structurally unable to drift.
A ROLE TEST BUILT FROM AN ABSENCE DOES NOT DISCRIMINATE, AND ITS FIXTURE WILL AGREE WITH IT. When one artifact is rendered for two roles (a shared bootstrap, a shared workflow, a shared config), scope role-specific behaviour on a POSITIVE identity the role owns — and emit that identity as a field so the consumer can require it rather than infer it. Never scope on "the other role does not have X": you must then prove the negative, and the CI sandbox lacking X will pass the arm you labelled "the other role" while proving nothing about it. Fixture the role that HAS X, with every input present and only the identity differing. Why: #7695 gated a destructive-recut input on "is /mnt/data a mountpoint", commenting that the co-located web host has no /mnt/data; cloud-init.yml mounts the workspaces volume there, so the probe would have walked every user's repo tree hourly and shipped a store measurement from the wrong host into a gate whose clearance condition is 0. See knowledge-base/project/learnings/2026-09-02-i-built-a-host-discriminator-out-of-an-absence-and-fixtured-the-absence.md.
A CARDINALITY PIN COUNTS THE CONTAINER, NEVER OCCURRENCES OF THE MEMBERS YOU EXPECT — and a verbose-gated line is a silent one under every redirect. grep -c '<known-a>|<known-b>' -eq 2 is satisfied by a list holding both known members AND a third you did not name; the property "exactly two directories are searched for a payload to execute" is the arity of the for d in …; do line itself, so count ITS words. Same session, second shape: a skip line gated on verbose ([[ -t 1 ]]) prints nothing under a test's redirect or claude --bg, so a HELD branch and an UNCONSIDERED one produce identical stdout and the diagnosis goes to the wrong block. Before reading a guard's logic, grep the SUT for verbose-gated lines on that path. Why: #8418 — /srv/extra-plugins appended to all three go.md fences stayed green under -eq 2 over known spellings; A9's reaper printed nothing per-branch and cost a round on the wrong hypothesis. See knowledge-base/project/learnings/2026-09-20-every-defect-in-my-fix-was-a-sentence-i-could-have-run.md.
ASSERT THE VALUE THAT MUST NEVER APPEAR, AND PUT THE INSTRUMENT UPSTREAM OF EVERY ASSERTION. When a change exists to guarantee a value never occurs, assert that negative directly over every arm and every field — a positive "is it the token I expect" is satisfied by the correct answer AND by any arm that never reaches the field. Give each suite an instrument self-test that drives its pass/fail helpers once each and refuses to continue unless both counters moved, and report assertion-count floors with printf + exit 1, never through the helper they backstop (ADR-193). Why: #7695 — 16 of 24 mutants survived a 250-assertion battery; three flipped __UNREADABLE__ to the literal 0 that authorizes a destroy and stayed green, if eval "$condition" -> if true produced a byte-identical summary line, deleting the entire new block reported 232/232 passed, 0 failed exit 0, and the sibling suite's floor called the very fail() one edit disarms. Same learning file.
THE WRAPPER THAT REPORTS A GATE IS ITSELF A GUARD, AND IT IS THE ONE NOBODY REVIEWS. The suite under test gets mutation rows, assertion floors and an instrument self-test; the five-line bash that RUNS it and reports the verdict gets none, so the could-not-measure/measured-bad collapse survives there. Three rules: never take a verdict from a PARTIAL artifact, and never from the completion NOTIFICATION either — the notification is authoritative for LIVENESS (has it exited?), never for VERDICT (did it succeed?), and TWO INDEPENDENT mechanisms defeat the verdict reading. (i) Its exit code is that of the LAST command the shell EXECUTED, so a trailing git log for convenience becomes the verdict — measured in #7912 (filed as #7957): three commits notified exit code 0 while git commit had returned 1. (ii) A run killed mid-tsc by the memory reaper ALSO notified completed, with no trailing command involved at all — so ending the string with the command that matters does NOT make the notification trustworthy; a missing verdict line is UNRESOLVED, never a pass. Write the real code yourself — echo "RC=$?" >> log IMMEDIATELY after the command whose status matters, before any convenience line, because $? binds to the immediately preceding command — and read that; a per-step line is not the runner's verdict either. Never pipe a command whose exit code IS the result (cmd | tail takes the pipe's status and destroys the evidence in the same stroke — redirect and read $?); and make "the loop ran" observable, because grep -c exits 1 on zero matches, so 0 failures and 0 executions render identically. Put long-lived logs in the worktree — /tmp is swept between turns and leaves the writer holding a deleted inode — but never COMMIT the raw stream: a committed run record is the verdict block only (a full lefthook stream was 1.26 MB in #8207, against a ≤25 KB norm; knowledge-base/project/learnings/2026-09-15-my-legal-record-said-the-change-had-landed-inside-the-pr-that-lands-it.md). Why: #7828 — a partial lefthook tail read as "rejected" started a SECOND concurrent git commit in one worktree (two writers, one index); git commit | tail -25 reported success on a failed commit and destroyed the only copy of a 52-minute battery failure, which then had to be re-run; and a fleet loop reported 0 reds without proving it executed. Seven process errors, one shape — the same shape the PR's own 38 findings existed to remove. #7912 hit the two-writers case AGAIN by a different route: the harness reaped the parent git commit and its lefthook kept running, so a retry made two writers on one index. Before any git-write retry, check this worktree for a surviving hook process — a reaped task does not imply a reaped process tree. See knowledge-base/project/learnings/2026-09-07-every-instrument-i-built-to-check-my-own-work-could-not-tell-clean-from-never-ran.md.
A FILE-SELECTED SUITE SET CANNOT SEE A REPO-GLOBAL RATCHET — expect any change that adds a test, a floor, a regex or an operator-facing message to move a counter, and fix the code rather than the baseline. When the full gate is refused or contended, the sanctioned substitute is to run the suites covering your diff, chosen by grepping which ones REFERENCE the changed files. That selection is correct and has one structural blind spot: a ratchet counts a property across the whole tree and references nothing, so no file-based query can ever return it. The failure is therefore not carelessness and does not improve with effort — it recurs until the selection is widened by hand. These baselines ratchet DOWN only, so the remedy is always the code: reword the message, rewrite the regex, promote the file, regenerate the baseline the gate's own failure text prescribes. Why: measured three times in one session — #7997/PR #8023 shipped green on its selected suites while CI reddened on guard-vacuity-floor, lint-diagnosis-claims and fixture-relative-assert; PR #8092 then reddened no-control-regex (19→20) on a two-file diff whose own suites were 91/91; and PR #8177 left INDEX.md/kb-tags.txt stale, so kb-search --tag could not find the learning that documents this rule. None of those artifacts referenced a changed file AT SELECTION TIME — guard-vacuity-floor names one today only because promoting that suite was the remedy, which is why re-grepping later appears to refute this. See knowledge-base/project/learnings/2026-09-14-i-tested-both-endpoints-and-left-the-wire-between-them-unpinned.md.
REGENERATE A WHOLE-REPO RATCHET BASELINE ONLY AFTER THE MERGE COMMIT EXISTS — and name the SOURCE of every git restore. A baseline is a committed artifact; a mid-merge index is transient state, and regenerating one from the other bakes the merge into the tree. During an unresolved merge git ls-files emits a conflicted path once per STAGE, so a whole-repo scanner counts that file three times and the drift it reports is arithmetic, not content: measured, guard-vacuity-floor.test.sh recorded 18 sites for a file with 6 — exactly 6 x 3 — and the commit message then explained the delta as "exactly the merged union", which was false in both directions (the union added ZERO sites). The sibling trap in the same recovery: git checkout -- <file> restores from the INDEX, so on a path you already git add-ed it is a no-op that looks like an undo — the edit survives and the absence of an error reads as success. Name the source (git restore --source=HEAD --staged --worktree) and verify by grepping for the thing you meant to remove. Why: #8539/PR #8560 — the review that existed to find guards narrower than their names shipped a baseline recording a state no tree ever had, into the commit fixing that class; CI caught it, and the local reproduction of that CI failure returned rc=4 REFUSED and had measured nothing. See knowledge-base/project/learnings/2026-09-23-the-prose-stated-the-property-and-the-predicate-checked-a-subset.md.
A GUARD RUN WITHOUT THE ARGUMENT THAT BOUNDS IT REPORTS A VERDICT ABOUT THE WRONG POPULATION — and it reads as reassuring in both directions. Sibling to the rule above: that one is about which guards you SELECT, this one about how you INVOKE the ones you did. Two shapes, one root. (i) An anti-vacuity floor left below the count it now measures is pure slack, and slack in a floor is attack budget, not padding — the gap is exactly how many assertions can be deleted before the one guard that detects truncation notices, so raise the floor in the SAME edit that adds the row, never in a later tidy-up. (ii) A baselined linter invoked without --baseline re-reports its entire baseline as new findings; read the runner's own invocation (grep run_suite scripts/test-all.sh) rather than the script's name, because the bare form fails LOUD and wastes a triage round, while its mirror — a --baseline that silently absorbs a real regression — fails quiet. Why: #8386 shipped a stale floor twice in one session (MIN_CASES=44 while 49 cases ran, then 49 while 53 ran — each raised only after a review round noticed), and lint-shell-capture-exit.py run bare reported "201 NEW finding(s) across 60 file(s)" against a tree whose real count was 0. See knowledge-base/project/learnings/2026-09-20-my-probe-graded-itself-against-a-clock-its-grader-never-read.md.
"THE DOCUMENTED API IS THE ONLY WRITE PATH" IS AN ASSUMPTION, NOT A FINDING — AND A HAZARD IS SETTLED BY A REVERSIBLE EXPERIMENT, NOT AN ARGUMENT. Before declaring an operator step because a control-plane credential is dead, ask what OBJECT is being changed and enumerate every write path that reaches it — not just the API the ticket names. Then, when the automated path carries a lockout risk, design a throwaway probe that answers it in seconds instead of reasoning from documentation. Why: #7966 — both stored SUPABASE_PATs returned 401, and I concluded the credential rotation was blocked on minting a new PAT; the operator's one-line question, not my analysis, surfaced that the object was a POSTGRES ROLE and that ALTER ROLE postgres WITH PASSWORD over the pooler connection already held needs no PAT at all. The hazard (Supavisor caching a stale upstream credential would strand the ONLY reachable path into the database, the direct host being IPv6-only) was refuted by creating a throwaway role and watching the pooler authenticate a principal it had never seen. See knowledge-base/project/learnings/2026-09-10-every-assertion-i-wrote-to-prove-the-fix-could-be-satisfied-while-the-defect-was-live.md.
A DATED record is APPEND-ONLY. When a plan's sweep touches a probe table, ledger row, dated addendum or post-mortem, correct it by APPENDING a new reading/section that cites the old one — never by editing the old one's body or substituting a cell. Editing in place is what turns a correction into destroyed evidence, and the destroyed datum is disproportionately the one that supported your own claim. Use ## Addendum — YYYY-MM-DD (#N) or > **Superseded YYYY-MM-DD (#N):**, and put the record in the ADR that OWNS the element rather than the one you happened to be reading. Why: #7309 — a repin overwrote ADR-143's dated cx23 = YES — in stock cell, then asserted "Both read NO here" four lines above it; that deleted YES was the only in-repo evidence for the PR's own headline claim, and restoring it made the argument stronger than the one that replaced it. See knowledge-base/project/learnings/2026-08-06-i-deleted-the-measurement-that-was-my-own-evidence.md.
BEFORE FIXING A DEFECT CLASS, GREP THE LEARNINGS FOR IT — AND IF IT RECURRED, THE FINDING IS THE PROPAGATION FAILURE, NOT THE DEFECT. When the fix is a helper, the durable unit is the IMPORT, not the helper and not the write-up: a helper that must be re-derived per file will eventually be re-derived wrongly, and the wrong copy is disproportionately the one that does damage. Strip by PREFIX, never by a hand-listed set of names — a name list is a claim about which values the tool honours, and it is wrong the moment the tool adds one. Why: #7822 — a fixture spreading a raw process.env into git commit under lefthook committed onto the caller's live branch and CONSUMED an in-flight commit (GIT_DIR beats cwd, and beats git -C too). The identical mechanism was already documented five months earlier in the same directory (#1454), WITH two correct working copies in the tree; neither was importable, so neither propagated. The first fix hardcoded six GIT_* names — exactly what the prior learning's Prevention section said not to do, unread until after it was committed. Second harm: a case asserting "this directory is NOT a repository" inverts under the inherited variable and proves nothing while staying green. See knowledge-base/project/learnings/2026-09-04-a-learning-two-working-copies-and-it-still-got-re-derived-wrong.md.
A YAML run: | BLOCK APPLIES NO ESCAPE PROCESSING — VERIFY THE LINE AS THE RUNTIME WILL RECEIVE
IT, NOT AS YOU WROTE IT. A literal block scalar hands the command its bytes verbatim, so a
doubled backslash reaches sed as a LITERAL backslash: \\( is not a capture group in BRE, and the
expression silently matches nothing. Nothing rejects it — the step exits 0, the variable is empty,
and every condition downstream of it goes false. The same block has two more traps: no line inside
it may begin at column 0 (a heredoc terminator or a wrapped quote there ends the block), and a
templatefile()-rendered one needs $${…} for braced shell expansions. So never grade one of these
edits by reading it: parse the YAML, extract the command, and run it against a fixture whose correct
answer you already know. Why: #7500 — a fix hardening NIC_ALARM_VERDICT against injection
doubled the backslashes in its own anchored sed, so BOTH verdicts extracted empty on every run and
all four filing conditions went false: the alarm would have filed nothing on any verdict. That is
the #7242 "dark on exactly the verdicts it exists to raise" defect, reintroduced by the commit
fixing a different defect in the same file, and it was caught by a reviewer re-reading the
uncommitted tree rather than by any suite. See
knowledge-base/project/learnings/2026-09-08-every-field-my-alarm-trusted-came-from-the-region-it-did-not-trust.md.
Execute a work plan efficiently while maintaining quality and finishing features.
This command takes a work document (plan, specification, or todo file) and executes it systematically. The focus is on shipping complete features by understanding requirements quickly, following existing patterns, and maintaining quality throughout.
If $ARGUMENTS contains --headless, set HEADLESS_MODE=true. Strip --headless from $ARGUMENTS before processing the remainder as a plan path. Pipeline mode (file path detection) already covers all prompt bypasses for work's own prompts — --headless is only needed for forwarding to child skills in Phase 4.
Strip --max-<dim> N args for bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" init (merge-safe).
Pipeline tally (#9403): bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" init here, at skill start — before Phase-0.5 check 9's specialist auto-invokes and every tier spawn; bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" gate agent_rounds <N> before each spawn batch (<N> = width), bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr agent_rounds <N> after, show at checkpoints. STOP → append status: budget-capped + budget-capped: agent_rounds=<n>/<cap> (from show) to knowledge-base/project/specs/<feature>/session-state.md and exit. WARN/UNKNOWN continue.
<input_document> #$ARGUMENTS </input_document>
<decision_gate> API budget. This skill executes a work plan iteratively across many phases. Tier A (Agent Teams) carries ~7x per-task token cost; Tier B (Subagent Fan-Out) is moderate; Tier C is single-agent. Total cost scales with plan length, chosen tier, and per-task RED/GREEN/REFACTOR cycles. Soleur does not bill or proxy these calls — Anthropic does, against the key in your session. The Soleur LICENSE (BSL 1.1) disclaims warranty for runtime cost; you operate this loop against your own budget.
The tier offer fires inline at the right phase. Decline if running an unfamiliar plan against a tight budget. </decision_gate>
Load project conventions:
# Load project conventions
if [[ -f "CLAUDE.md" ]]; then
cat CLAUDE.md
fi
Clean up merged worktrees (silent, runs in background):
Navigate to the repository root, then run bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" cleanup-merged. Report cleanup results: how many worktrees were cleaned up, which branches remain active.
Check for knowledge-base directory and load context:
Check if knowledge-base/ directory exists. If it does:
git branch --show-current to get the current branch namefeat-, read knowledge-base/project/specs/<branch-name>/tasks.md if it existsIf knowledge-base/ exists:
Read CLAUDE.md if it exists - apply project conventions during implementation
If # Project Constitution heading is NOT already in context, read knowledge-base/project/constitution.md - apply principles during implementation. Skip if already loaded (e.g., from a preceding soleur:plan).
Detect feature from current branch (feat-<name> pattern)
Read knowledge-base/project/specs/feat-<name>/tasks.md if it exists - use as work checklist alongside TodoWrite
4.5. Read lane: from spec.md if present. Guard file existence first:
spec_path="knowledge-base/project/specs/feat-${branch_name}/spec.md"
if [[ -f "$spec_path" ]]; then
LANE=$(awk '/^lane:/ { gsub(/^lane:[[:space:]]*"?|"?$/, ""); print; exit }' "$spec_path")
case "$LANE" in
single-domain|cross-domain|procedural) ;;
"") LANE="" ;; # legacy spec; silent skip in announce
*) echo "work: invalid lane value '$LANE' in spec; ignoring."; LANE="" ;;
esac
fi
Lane is non-binding in skill logic — work code does not branch on LANE. Operators MAY use the announced lane as a heuristic when picking work Tier 0/A/B/C in Phase 2; binding behavior is deferred per Non-Goal #2.
Announce: "Loaded constitution and tasks for `feat-<name>`" — append " (lane=<value>)" when LANE is non-empty.
If knowledge-base/ does NOT exist:
Run these checks before proceeding to Phase 1. A FAIL blocks execution with a remediation message. A WARN displays and continues. If all checks pass, proceed silently.
Environment checks:
git branch --show-current. If the result is empty (detached HEAD), FAIL: "Detached HEAD state -- checkout a feature branch or create a worktree." If the result is the default branch (main or master), FAIL: "On default branch -- create a worktree before starting work. Run: bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" feature <name>"pwd. If the path does NOT contain .worktrees/, WARN: "Not in a worktree directory. You can create one via git-worktree skill in Phase 1."git status --short. If output is non-empty, WARN: "Uncommitted changes detected. Consider committing or stashing before starting new work."git stash (the hr-never-git-stash-in-worktrees hook denies even the read-only git stash list). Use git rev-parse --verify --quiet refs/stash — a zero exit means a stash exists; WARN: "Stashed changes found. Review stash list to avoid forgotten work." A non-zero exit means no stash; continue silently.Scope checks:
.md or starts with a path-like pattern), verify it exists and is readable. If not, FAIL: "Plan file not found at the specified path." If the input appears to be a text description rather than a file path, WARN: "Input appears to be a description, not a file path."git diff --name-only HEAD...origin/main to identify files that diverged between this branch and main. If output is non-empty, WARN: "Branch has diverged from main in [N] files: [file list]." If the git command fails (e.g., offline, no remote), skip this check silently. For plans that edit AGENTS.* (high-collision file class), plugins/soleur/skills/ship/SKILL.md (Phase 5.5 gates), OR any path under docs/legal/** / knowledge-base/legal/** (legal-doc cross-document gate; weekly compliance PRs collide on the same 4-file set), FAIL HARD instead of WARN — fetch + rebase BEFORE Phase 1 (git fetch origin main && git rebase origin/main); sibling PRs landing mid-session reliably obsolete plan-quoted budget baselines and trim-target line numbers. See knowledge-base/project/learnings/best-practices/2026-05-20-rebase-before-applying-agents-md-plan-edits.md and knowledge-base/project/learnings/2026-05-25-closed-field-list-must-classify-at-value-shape-not-column-name.md §Session Errors #5 (PR #4351 — caught at review time, not Phase 0.5).## Domain Review or ## UX Review heading (both are accepted for backward compatibility). If NEITHER heading found: scan the plan content for UI file patterns (page.tsx, layout.tsx, template.tsx, .jsx, .vue, .svelte, .astro, +page.svelte, app/, pages/, components/, layouts/, routes/). If UI patterns found, WARN: "Plan references UI files but has no Domain Review section. Consider running soleur:plan to add domain review before implementing." If either heading IS present: pass silently.6.5. Baselined-file lint drawdown. If any file in git diff --name-only origin/main...HEAD (or named in the plan's Files to Edit) appears in lint-shell-trace-credential-refusal.baseline.txt or lint-shell-trace-credential-refusal-d.baseline.txt, run lint-shell-trace-credential-refusal.py with --changed --base origin/main NOW and treat its count as scope: CI runs that exact --changed form, which bypasses both baselines for every touched file, so a one-line edit to a baselined script owes its whole debt in the same PR. Why: #8054 — the cutover orchestrator script (a baselined file) carried 25 pre-existing violations (no xtrace refusal; 24 unconfined credentialed curls) that surfaced only at the work phase's exit gate and had to be paid down unplanned. See knowledge-base/project/learnings/2026-09-11-the-gate-i-built-for-a-dark-host-was-blind-to-the-byte-shape-of-nothing.md §Session Errors 12.
6.6. New *.test.sh ⇒ run the fixture ratchets before its first commit. A new shell suite that writes under a
mktemp -d root from OUTSIDE the function that bound it adds rows to the P1b ratchet
(plugins/soleur/test/fixture-relative-assert.test.sh, row-by-row baseline) that the suite's own green run cannot
see; run it plus fixture-dir-operand-assert.test.sh and python3 scripts/lint-shell-capture-exit.py --baseline scripts/lint-shell-capture-exit.baseline.txt <file> on the new file, and guard each writing window with the canonical
assert_fixture_dir rather than regenerating the baseline. Why: #8056/#8135 — each caught only by the full
battery. The guard must be the canonical helper, copied
byte-for-byte — an inline case "$out" in /*) … esac is NOT recognised (fixture-scan.py's _rel_guarded
docstring records the four ways an inline case was defeated and why it was dropped); and read the ratchet's rc from
rc=$? on its own line — echo "$(basename $t) RC=$?" prints basename's status and reported this ratchet green
while its log carried FAIL (#7968).
6.7. A new anti-vacuity floor ⇒ build to guard-vacuity-floor.test.sh's shape and run it first (see learning 2026-10-06-a-new-anti-vacuity-floor-joins-the-meta-guard…).
6.8. A shim/fixture script written from a new *.test.sh: quoted heredoc; name sibling scripts by BASENAME. fixture-scan.py reads $VAR inside a single-quoted printf on a redirect line (root=never-bound), and a full path literal makes test-affected-kb-consumers.test.sh hop into that script and charge your suite with its knowledge-base/ reads. See knowledge-base/project/learnings/2026-10-13-a-locale-pin-fix-needed-the-guard-around-the-prune-and-the-repos-own-ratchets.md.
Design artifact checks:
git ls-files '*.pen' '*.fig' '*.sketch' | grep -i "<feature-name>" and check knowledge-base/product/design/ for related files. If design artifacts exist AND the current tasks include UI/page implementation (patterns: .njk, .html, .tsx, .jsx, .vue, .svelte, pages/, components/, layouts/): store the artifact paths as DESIGN_ARTIFACTS for use in Phase 2.Specialist review checks:
If a plan file was provided (check 5 passed) and a ## Domain Review section exists with a ### Product/UX Gate subsection: check whether domain leader assessments recommended specialists (soleur:marketing:copywriter, soleur:product:design:ux-design-lead, soleur:marketing:conversion-optimizer) that are NEITHER listed in **Agents invoked:** NOR in **Skipped specialists:**. If the **Decision:** field says reviewed (partial), WARN: "Domain review was partial — some specialist agents failed. Review the Domain Review section before proceeding." If any recommended specialist is missing from both fields: Interactive mode: FAIL with message listing the missing specialists and options: (a) "Run <specialist> now" — invoke the specialist agent directly, update the plan file's **Agents invoked:** field, then continue; (b) "Skip with justification" — prompt for reason, add to the plan file's **Skipped specialists:** field, then continue. Pipeline mode (headless/one-shot): auto-invoke each missing specialist agent. If the agent succeeds, add to **Agents invoked:**. If it fails, add to **Skipped specialists:** with note (auto-skipped — agent unavailable in pipeline) and WARN. Do not FAIL in pipeline mode. If all recommended specialists are accounted for (in **Agents invoked:** or **Skipped specialists:**): pass silently.
UX-skip-on-UI-plan hard gate (within check 9): Determine "UI plan" by matching the plan's ## Files to Create AND ## Files to Edit against the shared UI-surface term list + glob superset (plugins/soleur/skills/brainstorm/references/ui-surface-terms.md) — NOT just *.tsx/*.jsx. The superset includes *.njk, *.html, *.vue, *.svelte, *.astro, and email templates, so an Eleventy/Svelte/email UI surface does not slip the gate (wg-ui-feature-requires-pen-wireframe). On a UI plan, FAIL when EITHER: (a) soleur:product:design:ux-design-lead appears in **Skipped specialists:**, OR (b) the plan has no ### Product/UX Gate subsection at all (the gate was never run). Message: "Plan touches a UI surface but has no committed .pen (soleur:product:design:ux-design-lead skipped or gate never ran). Invoke the specialist or provide an explicit override naming the specific UI surfaces being shipped without review." This overrides the "all accounted for → pass silently" branch. A documented skip — or absent gate — on a UI plan is a process gap, not process compliance. See knowledge-base/project/learnings/workflow-patterns/2026-05-26-ux-design-review-skip-must-fail-hard-on-ui-plans.md.
UX artifact commit checkpoint (after each specialist in check 9): After each specialist agent completes successfully (interactive "Run specialist now" or pipeline auto-invoke), commit the output:
git status --short to discover new/modified files from the specialistgit add <discovered files>git commit -m "wip: <specialist-name> artifacts for <feature-name>"Each specialist gets its own commit so partial progress is preserved if a later specialist fails. Do not commit on specialist failure.
On FAIL: Display the failure message with remediation steps and stop. Do not proceed to Phase 1.
On WARN only: Display all warnings together and proceed to Phase 1.
On all pass: Proceed silently to Phase 1.
Pipeline tally: show at each checkpoint (initialized at skill start — see Headless Mode Detection).
Pipeline detection: If $ARGUMENTS contains a file path (ends in .md or matches a path-like pattern), this skill is running in pipeline mode (invoked by one-shot or another orchestrator). In pipeline mode, skip all interactive approval gates and proceed directly. If $ARGUMENTS is empty or a plain text description, this is interactive mode — keep the approval gates below.
Read Plan and Clarify
47 encodes today's base; when a sibling raises the base mid-flight the number is silently wrong and the rebase conflicts exactly where both PRs land. Derive it (main's floor + 1), state the increment in the comment, and re-read the base from git show origin/main:<file> at ship rather than at plan time — measured, one suite's floor moved 44 -> 46 -> 48 -> 49 over four days across three PRs, and the branch's own in-flight 47 was never a value that shipped, so a literal carried from it would have been wrong in a direction no local test could see. (b) set -e does not fire on a failing NON-FINAL member of an AND-OR list (bash -c 'set -e; sh -c "exit 100" && true; echo reached' prints reached), so setup_a && setup_b lets a failing setup_a fall through into the code under test with its preconditions unmet — which then surfaces as whichever later guard trips, asserting a cause that never occurred. Split such pairs into separate statements so each failure aborts with its own rc. Why: #7291 — a floor literal and an apt-get update && apt-get install both shipped, the second producing a hard FAIL naming a deterministic fixture defect that had not happened. See knowledge-base/project/learnings/2026-08-16-every-number-i-inherited-was-stale-and-the-panel-found-the-defect-class-inside-my-fix.md..bun-version/.nvmrc/.tool-versions vs <tool> --version) and, if they differ, re-capture under the pinned version in a scratch install before merging — a format difference turns every CI run into the fail-closed branch, on a version you never observed. State in the artifact which versions the format was verified on, so the next reader knows the claim's scope. Why: #7466 — every byte capture, fixture and terminator claim was measured on bun 1.3.11 while CI installs 1.3.14 from .bun-version; verified identical only because the shard runner's preamble happened to print the mismatch. Do not let the discovery depend on that.gh pr view --json mergedAt that proves it, never the comment: a quick summary of a run written into an issue becomes "fact" for every artifact that copies it. Why: #8171 — a sweep whose purpose was retiring false sentences copied three from its own #8010 comment (a poll message that never printed, a replace run called the birth, an authoring date called the merge date); review caught all three against the logs. See knowledge-base/project/learnings/2026-09-14-the-sweep-that-retired-false-sentences-wrote-new-ones-from-my-own-issue-comment.md.gh issue view N --json title every #N the sentence labels (the title is the label's falsifier), and for every "X refuses/drives Y" sentence read the code path and name the line that performs the transition. Why: #7695/PR #8314 — "#7761/#8019 gate fixes" (#7761 is the Doppler-name root-exec fix) and "G3.7 refuses into terminal aborted" (G3.7 exits before any write) reached ADR-100, the runbook and a posted issue comment; only the count was caught by the existing number-re-derivation reflex. See knowledge-base/project/learnings/2026-09-18-three-sentences-i-pasted-from-the-plan-were-inherited-not-measured.md.git diff origin/main...HEAD before ticking it, and before interpreting a vendor error gh issue list --state all -L 200 --search "<literal error>" and read the resolution. Why: #8178/PR #8262 — a "measured" 2m37s budget shortfall came from the NEXT host's row, four ticked items were unmet, and an addendum re-affirmed a CLUSTER_DOESNT_EXIST reading #7867 had retracted. See knowledge-base/project/learnings/2026-09-18-the-measured-facts-my-resume-brief-handed-me-were-the-defects.md.bun test … reports X, wc -c < AGENTS.md = N, "cumulative ~Y words; ~Z headroom", git ls-files | wc -l), re-run the measurement at soleur:work start before depending on it. Plans authored hours-or-days earlier observe a moving target; parallel branches landing in main invalidate the measurement. PR #3501 plan claimed ~186 word headroom against an actual 15 and required inline trim of the gate description. See knowledge-base/project/learnings/2026-05-10-handshake-schema-drift-and-stale-precondition-budgets.md.local method="$1" path="$2" "so the classifier can see path"; measured with the allowlist deleted, the SPLIT is what made the classifier stop requiring it, and the plan's two "linter re-flags this" mutation rows were vacuous for the shipped shapes (a derived _si_host operand and every var="$(curl …)" site are outside Rule D's destination limb). See knowledge-base/project/learnings/2026-09-11-the-linter-i-cited-as-my-oracle-passed-with-the-guard-deleted.md.:- default arm pointing at the repository's plugins/soleur directory; the variable is unset in bash, so the default arm expands to that CWD-relative path — the defect itself. Measuring the remedy (~30s) is what caught it, and the same PR then shipped an unmeasured safety claim about its replacement that review falsified. See knowledge-base/project/learnings/2026-08-11-i-measured-the-issues-remedy-then-asserted-my-own-without-measuring.md.main. Cheapest gate: re-run the refuting command after the final rebase for any premise you declined to act on. Why: #7160 — a deferral claiming scripts/test-all.sh carried a stale "21 suites" header was correctly refuted (no numeric suite claim existed anywhere in the file), and #7146 merged that exact line an hour later. See knowledge-base/project/learnings/2026-08-03-my-guards-error-channel-was-published-before-its-writers-ran.md.|delta| < spread, report "this harness cannot resolve it" and measure the PRIMITIVE that changed instead (25 reps of the one cp/diff/parse has negligible variance where a whole-suite run does not); (b) ask whether the SIGN is physically possible — a result showing strictly-less-work as slower is a broken instrument, not a finding. When the decision is right for a non-timing reason (coverage, correctness, blast radius), justify it that way and drop the number entirely. Why: #7001 — a plan-mandated fast path was removed on a 5-pair whole-suite A/B reading 6.86s WITH vs 6.60s WITHOUT; the real effect is ~89ms against a ~±590ms (1σ) floor needing ~160 pairs, and the sign was impossible. The removal was correct on coverage grounds alone. See knowledge-base/project/learnings/2026-07-27-my-ab-could-not-resolve-the-effect-i-concluded-from-it.md.main — every other rigor check protects the SUBJECT of a measurement, and nothing protects its REFERENT. Interleaving, noise floors, sign checks and rep counts all interrogate how well you measured the two things you chose; none asks whether either is the status quo. When a change is built in stages the natural comparison is stage-N vs stage-N+1 ("do these excludes earn their place?"), which is a legitimate question whose number has the identical shape to the one a PR body actually claims ("is this better than today?"). Before reading any delta, write out arm A = <literal command>, arm B = <literal command>, and answer which one runs on main right now; if the answer is "neither", the result can support a claim about a choice INSIDE the change and none about the change. The status-quo arm usually has to invoke the real thing (exec -a ugrep "$CLAUDE_BIN" …), not a reconstruction of its flags. Why: #7165 — a carefully-run interleaved benchmark (noise floor stated, cold rep excluded, sign checked, and it even corrected the plan's figure downward) compared new-without-excludes to new-with-excludes and shipped a 2.25x regression as a win; the three-arm re-run showed today 243 ms vs new 548 ms, with the dominant term the single-threaded-engine swap rather than the .gitignore loss the spec blamed. See knowledge-base/project/learnings/2026-08-03-my-ab-had-the-wrong-baseline-arm-so-i-shipped-a-regression-as-a-win.md.x="$(cmd)"; rc=$? capture is only correct where errexit is OFF — write rc=0; x="$(cmd)" || rc=$?, which holds under set -e too; and a guard that reads a state's SYMPTOM (MERGE_HEAD exists) is wrong in both directions against one that reads its CAUSE (git said rc 1): enumerate every state that produces the observation before acting on it. A bare assignment's status IS the substitution's, so under an errexit host shell the shell dies at the assignment before the failure branch runs — the defect being fixed, by another route. Why: #8339/PR #8378 — the rc-capture fix keyed its --abort on MERGE_HEAD presence (aborting a merge the operator started during the fetch window, rc 128) and misdescribed a rebase conflict as "not a conflict, nothing to abort"; three of nine review seats converged on the one gap. See knowledge-base/project/learnings/2026-09-19-the-fix-keyed-on-the-symptom-of-the-state-and-the-old-tags-were-never-notifications.md.--help — the unit is the highest-risk part. When the plan names a CLI/config flag value (--postgres-conn-max-idle-time 30, a timeout, a size, a percent), resolve the pinned version and read that version's flag registration for type + unit + default + validation before writing it — a wrong unit (minutes/seconds/ms, bytes/KB, count/%) passes typecheck AND the binary's own validation, so only the source catches it. The plan is authoritative for intent (e.g. "drain idle conns fast"), never the literal value. Why: #6258 — the plan's SECS=30 for --postgres-conn-max-idle-time was seconds-intent, but the inngest v1.19.4 flag is an IntFlag in MINUTES (default 5) → 30 = 30 min, defeating the drain; corrected to 1. See knowledge-base/project/learnings/best-practices/2026-07-09-plan-quoted-tool-flag-value-and-unit-are-claims-verify-against-pinned-source.md.curl -D <file>, never body-only) and treat a deprecation/sunset header on a successful response as the durable signal — it is served on 200s too, which is the half that is always observable. Never retry a 410: a retry long enough to swallow a brownout necessarily also masks the permanent post-sunset case the check exists to catch. Why: #7590 — a 2026-07-17 session re-probed a 410, got a clean plan, and wrote "the 410 was transient" into versions.tf; the endpoint had been deprecated since 2026-05-14 and the 410 carried x-sentry-deprecation-date + x-sentry-replacement-endpoint all along. Measured in BOTH states inside one session on 2026-08-19 — 410 at ~20:5x, 200/200/200 at 21:23, same token, same host, no change on our side. See knowledge-base/project/learnings/integration-issues/2026-08-19-a-vendor-brownout-is-not-a-flake-and-the-header-said-so-all-along.md.notFound(), the 404 response, the empty-state component) and walk the redirect/call chain to the exact determining condition, confirming or falsifying each plan hypothesis against code. Code-tracing is a valid substitute for a plan-prescribed live repro when the repro needs hard-to-synthesize state. Verify route classifications by reading the route's exported HTTP methods (a "read route" with no GET is a write route). Why: #4543 follow-up — the plan's two 404 hypotheses + its "redirect lands on /dashboard" reconciliation were all wrong; a 4-file trace (invite-actions → settings/team/page.notFound() → null-org resolver → accept-invite never set active workspace) found the real cause. See knowledge-base/project/learnings/bug-fixes/2026-06-01-symptom-root-cause-trace-the-actual-redirect-not-the-plan-hypothesis.md..git probe (FR2/FR3) would have skipped the in-dispatch ensureWorkspaceRepoCloned self-heal, dead-ending connected-repo resume; reverted + descoped. See knowledge-base/project/learnings/best-practices/2026-06-14-short-circuit-guard-must-sit-after-the-recovery-it-gates.md.UNREMOVABLE emit was nested under the regular-lock staleness gate, so a fresh non-regular config.lock slipped straight into the doomed git config EEXIST write; 3 review agents converged on a gap noticed at write-time. See knowledge-base/project/learnings/best-practices/2026-07-02-fail-loud-guard-must-not-nest-under-a-different-state-class-gate.md.not_delivered as "still waiting", re-check the vehicle: gh issue view <N> --json state plus its closing comment, because a CLOSED ordered path is the signal the rider is spent, not the probe. Better, state the falsification condition when recording it ("if #N closes without this delivering, the rider is spent") so it is checkable rather than implicit. Corollary for the correction sweep afterwards: index by CLAIM, not by literal — three engineering-corpus literals returned 0 across knowledge-base/legal/ and that zero was read as "not relevant", while the claim as the legal corpus phrases it returned 4; the same bound missed the ORIGIN text on punctuation alone (backticks around the command; INERT UNTIL PROVISIONED ≠ … A PROVISIONING), and correcting every paraphrase while leaving the origin standing makes the repo self-contradictory where it was merely stale. Why: #7455 — the rider rode a step-6 replace that had fired ~45h BEFORE the shipper merged, so the change sat inert on a host born before it existed and the probe would have reported not_delivered accurately for the full 90-day horizon. See knowledge-base/project/learnings/2026-08-13-a-rider-is-only-valid-while-its-vehicle-is-still-pending.md.session-state.md ### Decisions entry is INTENT, not an accomplishment — verify each against the live artifact before treating it as done. The section is written in the past tense by a session that was still mid-flight, so a decision reading "met the intent via a correcting comment on #N" / "filed the follow-up" / "re-titled the issue" records what the author RESOLVED to do, and the step is exactly what a mid-task death (API timeout, compaction, crash) leaves undone — the resume then inherits the claim without the act. Cheapest gate: for every Decisions line naming an outward-facing artifact, probe it (gh issue view N --json comments --jq '[.comments[]|select(.body|test("<cite>"))]|length', gh issue view N --json title, ls <path>) and re-open it in the task list on a zero. This is the outward-facing sibling of the artifact rule below (which covers FILES the contaminated session wrote); a GitHub comment leaves no working-tree trace at all, so nothing else surfaces its absence. Why: #6497 — session-state.md recorded a #6416 correcting comment as met; gh issue view 6416 showed ZERO comments citing #6497, and the resumed session nearly shipped the claim in its PR body. See knowledge-base/project/learnings/2026-07-16-a-mutation-battery-only-covers-what-you-mutate.md.session-state.md documents that the originating session's tool layer was contaminated/degraded (batched output, warnings prepended to Read results), the contamination taints every FILE that session wrote, not just the status claims it retracted ("applied"/"GREEN"). Re-derive each artifact from its authoritative source: read the real migration/file it claims to mirror and rewrite it as a verbatim delta (diff to prove byte-identity), then re-establish status from scratch (apply + verify the live DB; re-run RED→GREEN). For SQL, a misread RETURNS type is a free tripwire — CREATE OR REPLACE cannot change a function's return type, so any "applied GREEN" against a return-type-changed body is self-evidently false. Why: #4709 — 089 was authored against a misread of 088 (RETURNS void vs integer, dropped NULL-auth + 22023 gates); caught only by reading the real 088 body. See knowledge-base/project/learnings/2026-06-01-resumed-session-artifacts-from-contaminated-tool-layer-are-unverified.md.grep -cE '^[[:space:]]+-target=' <workflow>, wc -l <list>, etc.) and copy the integer into every comment/AC reference. Plan-prose mental tallies drift by ±1-2 during expansion; multi-agent review reliably catches it (P3 polish) but the inline grep at write-time is free. Why: PR #4122 — workflow header carried "68 explicit targets" from plan §Phase 0.3 mental tally while grep returned 67; caught by soleur:engineering:review:code-quality-analyst + soleur:engineering:review:pattern-recognition-specialist at review. See knowledge-base/project/learnings/best-practices/2026-05-20-plan-time-pr-vs-issue-disambiguation-and-self-derived-counts.md.<predicate>") reads like rigour and is not: the prose leaves per-line-vs-per-match, unique-vs-all, marker position, and language-correct-markers free, each worth 10–30%. A number pinned to prose rots exactly like a citation pinned to a line number — both name a referent without fixing it — so the fix is the same: anchor on content (the command), not on a description. If the figure is load-bearing, also show the conclusion survives the plausible range. Why: #6517/PR #6527 — a reviewer measured and adopted "403, where site = a line in a code file bearing a comment marker AND citing <path>.<src-ext>:<N>" as canonical; at soleur:work, 18 faithful readings of that exact prose returned 319–583 and never 403 (two independent resolvers also disagreed on the sibling counts). Shipped as ~360 + a git grep … | wc -l; the conclusion was invariant across the whole range (0.17–0.31%), which is why the false precision survived a 5-agent panel — nothing depended on it. See knowledge-base/project/learnings/2026-07-16-advisory-first-precedent-is-a-claim-to-measure-and-a-coordinate-citation-carries-no-claim.md Session Errors #3.lint-shell-trace-credential-refusal, lint-trap-tempfile-ownership, …) live in the scripts shard and read every file, so a hook or test file added under .claude/hooks/ is in their corpus even though no unit suite names it. Why: PR #8354 — AC12 (TEST_GROUP=scripts) was left as "run separately"; the ship battery then went red on a variable named S_PAT (read as a credential) and a mktemp without an owning trap, costing a fix commit, a main re-merge and a second CI cycle at the last gate.-i, alternate a second spelling, swap a space for .), and the widened form is a DIFFERENT predicate: it can pass while the AC's own bytes fail. The AC is the contract and the plan-quoted command is part of it, so paste it verbatim; if it fails, fix the artifact or amend the AC explicitly — never quietly satisfy a looser one. Same family as cq-assert-anchor-not-bare-token (anchor on what is actually asserted) and the plan-quoted-number rule above (re-derive, don't restate). Why: #6178/PR #6933 — AC9's grep -c 'function discovery' was self-reported satisfied after running grep -c 'function.discovery\|FUNCTION-DISCOVERY'; the literal command returned 0, and a checked tasks.md line already claimed every AC baseline had been re-confirmed. See knowledge-base/project/learnings/2026-07-25-i-added-the-field-that-closes-the-gap-and-nothing-read-it.md.grep -cE '^- \*\*\([a-z]\)\*\* ' (or equivalent, using [a-z] NOT [a-N]) across each file BEFORE the first letter-inserting Edit. Counts AND letter-sets must match; anything else means the plan's lockstep claim is paraphrase-from-stale-read. PR #3755 (#3708): plan asserted DPD §(a)-(k) lockstep; canonical actually had §(l) DSAR; AC1 caught the §(l) collision but the cheaper gate is re-lockstep at soleur:work-start. See knowledge-base/project/learnings/2026-05-14-discrete-enumeration-relockstep-and-pr-introduced-asymmetry.md.### N.M-numbered section, the Edit anchor MUST target the LAST ### N.M block before the desired slot (not the lexically-adjacent one). Confirm with grep -nE '^### [0-9]+\.[0-9]+ ' <file> | tail -3; the new M must be greater than the picked anchor's M. PR #3755 (#3708): §5.10 was anchored on §5.9-Resend's block start and landed BEFORE §5.9. One-grep prevention. Same learning file.assertWriteScope for cross-tenant integrity, GDPR write-boundary checks), enumerate ALL write sites where the property applies — not just diff sites. Run git grep -nE '\.from\("<table>"\)\.insert\(' <scope> (or the equivalent for the boundary type) at Phase 0 and verify every match is sentinel-gated, then file follow-up tasks for any uncovered sites BEFORE entering Phase 1. See knowledge-base/project/learnings/2026-05-12-type-widening-cascades-and-write-boundary-sentinels.md; hard rule hr-write-boundary-sentinel-sweep-all-write-sites. Why: PR-A2 #3603 — sentinel placed at assistant-row write but not user-row write at cc-dispatcher.ts:1008; same service-role-bypass surface.unknown/any/jsonb boundary (compiler cannot enforce optionality at the consumer), git grep -nE '<field-name-pattern>' apps/ across every consumer and verify each respects the new optionality. For Message-class fields the canonical grep is git grep -nE '\bmessage\.usage\.(input_tokens|output_tokens|completed_actions)\b' apps/ (adapt per field family). See learning 2026-05-12-type-widening-cascades-and-write-boundary-sentinels.md; hard rule hr-type-widening-cross-consumer-grep. Why: PR-A2 #3603.workspacePathForWorkspaceId, an active-workspace resolver, any join(root, id) path builder), the guard THROWS on every test fixture that fabricated that id with a short non-UUID literal. Before sizing the change as "1 file", grep the fixture surface — git grep -nE '"(user-1|ws-[A-Za-z0-9]|owner-[A-Z]|[a-z]+-workspace)"' apps/web-platform/test/ — and trace which hits reach the guarded function; size the fixture sweep at plan time, not at GREEN. The fix is realistic UUID fixtures (cq-test-fixtures-synthesized-only), never a looser guard. Why: #5344 — a "1 source + 1 test file" estimate broke ~34 fixture files. See knowledge-base/project/learnings/2026-06-15-id-shape-guard-test-fixture-blast-radius-and-syntactic-sast.md.$1 only puts the fixture seam ABOVE the code under test — assert the argv the SUT must send. When a suite stubs an external CLI (docker, gh, psql, curl), a stub that returns a fixture regardless of --filter/--format/subcommand cannot detect the SUT querying the WRONG thing, so the query shape ships unpinned: measured, switching a gate from .NetworkSettings.Ports to .HostConfig.PortBindings and corrupting its label selector (so it matched zero rows and passed forever) BOTH left a 12/12 suite green. Make the fake exit 64 on a missing required flag, and key multi-entity output per id (FIXTURE_<id>) so an early-break is detectable — a fake that answers identically for every entity makes "one clean, one dirty" fixtures impossible. .claude/hooks/stub-argv-fidelity.test.sh codifies this class but scopes to .claude/hooks/ with STUB_CMDS="gh|jq|git", so a stub elsewhere is unguarded. Why: #7081 — 11 of 17 mutations survived. See knowledge-base/project/learnings/2026-07-30-every-green-signal-i-had-certified-a-gate-with-six-fail-open-paths.md. The same seam also sits above every property the VENDOR validates, so an external-API client needs one verification on the REAL request path. The rule above pins the argv the SUT sends; this is the half nothing local can reach. A fake that answers regardless of the request cannot observe request ENCODING, parameter FORMAT, header shape or auth form — and a mutation battery cannot either, because it perturbs the SUT and then scores it THROUGH that same fake, so every row is judged by an oracle blind to the class. Exercise the real path once, end to end, with the CLIENT's own argument construction; probing the endpoint with hand-written arguments probes the endpoint. Then teach the stub to reject what the vendor rejects, one exit code per contract violation. Why: #7706 — to_iso emitted a timestamp with no timezone designator, which the vendor answers with HTTP 400 on EVERY ref, window and source, so the tool could not complete one live query; green through 3 suites, 2 batteries reporting no survivors, 12 review agents, shellcheck and actionlint, and the plan's own live probes missed it because a hand-written curl carries the Z by reflex. See knowledge-base/project/learnings/test-failures/2026-09-02-my-fake-curl-put-the-seam-above-everything-the-vendor-validates.md. And a PATH shim must resolve the real binary to an ABSOLUTE path BEFORE mutating PATH, with its unwind in a try/finally, not a promise.finally(). A shim that execs the tool by NAME re-enters itself — PATH still has the shim dir first — and recurses until the runner's timeout; the damage is not the failing row but that a test-framework timeout rejects the promise WITHOUT running a .finally() handler, so the PATH pollution outlives the row and every later test in the file inherits it. Measured (#8427): four unrelated must-PASS rows timed out at 16 s each, which reads as four regressions rather than one harness defect.git grep -nE '<syntactic anchor>', a directory walk, the array's own definition) — a remembered list is a snapshot, and the next one-line edit invalidates it. A mutation protocol validates a FIX; it never tells you the fix's POPULATION is right — this is the trap, because the protocol feels like the rigorous part and it is orthogonal to scope. Two tells that the population is wrong: (a) the fix lives INSIDE an array/window/branch while the sink is reachable from outside it; (b) you can describe the fix as "at site A" rather than "at every site that reaches S". Why: the preflight Check 10 work (merged 2026-08-10) — the /home re-bind was fixed inside BWRAP_ARGS and validated FOUR ways; three more mount-injection entry points existed outside that array (GIT_BIND, BWRAP_PROC, the exec line), and three separate one-line edits each re-opened the operator's credential surface with the whole suite green, verified against live bwrap reaching the Doppler token, ~/.ssh and the gh token store. Five review rounds each found a different instance of that one unperformed enumeration. See knowledge-base/project/learnings/2026-08-10-a-guard-that-cannot-be-driven-red-is-vacuous-four-rounds-four-instances.md. When the deliverable is itself a guard, the plan's ## Guard Contract (plan Phase 2.12) already names the assembly — implement against THAT, not against the finding's example site.git grep -nE '<pattern>' <scope> | grep -vE '<safe-form>' | wc -l = 0), run the grep ONCE at Phase 0 to enumerate the authoritative work-list (capture it via targets="$(mktemp -d -t soleur-run.$$.XXXXXXXX)/t" and write the hits there — never a fixed /tmp name a sibling session would clobber), fix each line, then re-run the grep after each batch. The plan's narrative enumeration of "files X, Y, Z" is a starting hypothesis; the grep result is the work-list. Same applies to regex widenings: enumerate the configs/verbs/paths invoked by the IN-SCOPE runbooks, not the configs the incident occurred against — the incident is one data point; the trap-class config-set is the full union of every config the runbooks touch. Why: PR #4031 — initial sweep handled 9 named runbook hits but missed 2 buried in deeper sections of the same files; widened regex covered (prd|prd_terraform|dev|ci) per the plan's leak-footprint enumeration but missed prd_orchestration which 2 in-scope runbooks operate against. Pattern-recognition + soleur:engineering:review:security-sentinel caught both at multi-agent review. See knowledge-base/project/learnings/best-practices/2026-05-18-sweep-class-fixes-grep-enumerated-not-intuited.md.knowledge-base/project/learnings/2026-09-19-a-sibling-merge-took-the-apply-workflow-over-githubs-byte-limit-and-nothing-in-repo-said-so.md.--postgres-uri and never parses redis). Run grep -cF -- "$tok" "$file" for every (file, token) pair at Phase 0 and let the matrix define the per-file token set; asserting the full set on a file that uses a subset false-fails a correct codebase. The plan is authoritative for the guard's intent, never its exact token/file set (same class as hr-when-a-plan-specifies-relative-paths-e-g). Corollary: plan-quoted AC verify commands are preconditions to re-derive, not facts — a git diff origin/main | grep -c 'ssh ' proxy false-positives on self-referential prose + branch-divergence in cited-but-unedited files; scope it to the changed code files. Why: #5553 — the drift-guard spec required 4 tokens on all 3 ExecStart parsers, but inngest-wiped-volume-verify.sh references only 2; scoped per-file at soleur:work. See knowledge-base/project/learnings/best-practices/2026-06-18-cross-file-drift-guard-verify-per-file-token-usage.md.knowledge-base/project/learnings/2026-08-12-my-ladder-rung-ended-in-a-label-so-it-fell-through-to-the-unsafe-branch.md.## BLOCKING section is a WORK-LIST, not context — check each finding off against the diff before review, and do not trust a subagent's summary for what that list contains. Two failures compose here and both are cheap to prevent. (a) The findings a plan marks blocking are written before implementation and read during it, so they are exactly the items an implementer treats as already-absorbed background; grep the plan for its blocking identifiers at Phase 0 and record a disposition per identifier, because "I read that section" is not a disposition. (b) A planning subagent's Session Summary is a CLAIM ABOUT A FILE — verify every identifier it cites exists in the artifact, since a summary that invents or renames findings sends you to check things that do not exist while the real ones go unchecked. Why: #7569 — the plan named F14/F15/F16/F18 as blocking, the summary reported F2/F4/F7 (none of which exist), and F15 — an unanchored --grep letting one row that merely QUOTED a marker suppress the alarm indefinitely — shipped unimplemented into review, which rediscovered it independently. See knowledge-base/project/learnings/2026-08-17-an-empty-read-is-three-states-and-my-guard-shipped-two-fail-opens.md.knowledge-base/project/learnings/2026-09-03-my-guard-blocked-the-recovery-and-missed-the-hazard.md.soleur:engineering:cto (soleur:legal:clo) with the evidence (file:line), the options and "do NOT use AskUserQuestion", implement exactly what it returns, record Ruled by CTO agent (an ADR for an architecture decision); a "surface it, do not decide it" brief changes nothing technical. Operator-only list: technical-ruling-delegation.md. Why: #5325, #7347 — forks and legal calls were first offered to the operator.grep per item, output the item id next to a hit/miss — and treat any miss as blocking. Applies with equal force when the implementation was delegated: the delegate's report names what it did, never what it forgot. Why: #7347 — a 6/6-green prohibition sweep (T&C untouched, §3.1(b)/(d) unasserted, "eleven processing activities" unchanged, no PR refs, pre-existing drift untouched, no forbidden term-classes) shipped a diff that had silently dropped two amendments recorded as binding by the PR's own plan review, plus a third closed-list fix applied in one document and not its sibling. Same learning file.knowledge-base/project/learnings/2026-08-09-three-green-gates-and-the-published-page-was-still-wrong.md.knowledge-base/project/specs/<branch>/decision-challenges.md (append, one Decision Classes row; alongside session-state.md) — never a mid-pipeline pause. ship Phase 6 renders that artifact into the PR body and files the action-required issue the operator actually sees. The one exception to no-pause: a security/feasibility regression halts terminally before merge (see the reference doc).UNIONs two sources (or a check ANDs two probes), verify each answers INDEPENDENTLY before relying on the pair: a UNION ALL over a healthy arm and an absent one fails entirely, so the read errors on every attempt regardless of the data — and if the loop only inspects results when rc == 0, "the read failed" becomes indistinguishable from "the read found nothing". The damage is downstream: the code then consults a CONTROL source, which is a DIFFERENT table whose health licenses nothing about yours, and emits a substantive verdict off a query that never ran. Track whether the read ever succeeded, report UNKNOWN when it did not, and carry the transport error so the next reader does not re-derive it. Why: #7855 — a round-trip probe's readback UNIONed an archive arm whose named collection does not exist for that source (669, measured), so it failed on every poll and the probe posted a public vendor data-loss accusation off it; the same PR's own header claimed the opposite behaviour. See knowledge-base/project/learnings/security-issues/2026-09-06-the-file-i-added-to-fix-a-p1-shipped-a-p1.md.run: body the diff adds or rewrites is a CODE PATH with zero behavioural rows unless you give it some — grep-shaped ACs pin its spelling, not its decisions. Extract the body with PyYAML, execute it under the runner's shell (bash --noprofile --norc -eo pipefail) with a stubbed gh, and pin what each arm DECIDES; precedent plugins/soleur/test/registry-host-replace-dispatch-verdict.test.sh. And when a test stub dispatches on ONE axis of the request (which SHA) and ignores the others (which range, which path), every wrong request reads the right fixture — make the stub refuse a request it did not expect (STUB_EXPECT_* + exit 64), and red the row on any stub-miss line in stderr. Why: #8279/PR #8355 — the review P1 (an "unchanged since the watermark" sentence keyed on prs= instead of commits=) was the only untested path, and five URL-construction mutants survived a 98-row suite. See knowledge-base/project/learnings/2026-09-19-the-one-defect-lived-in-the-only-code-path-with-no-test-and-my-stub-answered-every-question.md.Setup Environment
First, check the current branch by running git branch --show-current. Then determine the default branch by running git symbolic-ref refs/remotes/origin/HEAD and extracting the branch name. If that fails, check whether origin/main exists (fallback to master).
If already on a feature branch (not the default branch):
[current_branch], or create a new branch?"If on the default branch, you MUST create a worktree before proceeding. Never edit files on the default branch -- parallel agents cause silent merge conflicts, and this repo uses core.bare=true where git pull and git checkout are unavailable.
Create a worktree for the new feature:
SOLEUR_SKILL_NAME=work SOLEUR_EXPECTED_DURATION_MIN=240 \
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" --yes create feature-branch-name
Then cd into the worktree path printed by the script. The worktree manager handles bare-repo detection, branch creation from latest origin/main, .env copying, and dependency installation. The env vars wire a session lease so sibling cleanup-merged invocations refuse to reap this worktree.
Phase Exit (release lease). At the end of the workflow — after soleur:ship returns OR if you exit without shipping — release the lease so a sibling cleanup-merged can reap the worktree once it's actually merged:
# Degrade open (#7409): releasing is advisory — an unreleased lease expires
# on its own window — so a missing library must not fail the pipeline here.
SS_LIB="${CLAUDE_PLUGIN_ROOT}/scripts/lib/session-state.sh"
if [[ -r "$SS_LIB" ]]; then
bash "$SS_LIB" release_lease "$(basename "$PWD")" || true
else
echo "SOLEUR_SESSION_STATE_UNAVAILABLE path=$SS_LIB reason=lease-not-released"
fi
The release is a no-op if the lease was already removed by the multi-signal trap (EXIT/INT/TERM/HUP fires on abnormal exit). Stale leases get swept after 24 hours regardless.
Use a meaningful name based on the work (e.g., feat-user-authentication, fix-email-validation).
Create Todo List (TDD-First Structure)
Structure tasks as RED/GREEN/REFACTOR units, not as "implement everything, then test":
property=generated-input contract test (property-testing); e2e tests carry pyramid-justified: or a ## Test Pyramid blockblockedBy dependency (GREEN blocked by RED)Anti-pattern to avoid: Creating a task list like [implement A, implement B, implement C, ..., write tests, lint]. This structure guarantees TDD violation because the agent executes tasks in order. The correct structure is [RED(unit): test A, GREEN: A, RED(integration): test B, GREEN: B, lint].
Post-creation validation (HARD GATE): After creating all tasks, scan the task list for any non-exempt implementation task (GREEN) that does NOT have a corresponding RED test task in its blockedBy list. If found, restructure the task list before proceeding. Do not start Phase 2 with an invalid task structure. Why: In PR #2428, the agent created flat tasks ("Fix X", "Write tests") and started implementation before tests — the user had to intervene and force a restructure. The anti-pattern instruction was not enough without a validation gate.
Output discipline (all tiers). Long execution phases blow the response-token ceiling and truncate mid-pipeline, losing the thread. Keep inline output bounded: when a command's output is large (full diffs, build logs, test dumps), write it to a file and reference the path rather than pasting it — never echo a diff over ~200 lines inline (d="$(mktemp -d -t soleur-run.$$.XXXXXXXX)/d"; git diff > "$d"; echo "DIFF=$d" then summarize, citing the path). After each task or logical unit, emit a one-line ## Work Phase <N> complete checkpoint marker so an interrupted run has a clear resume point. This bounds your narration of commands; hr-never-run-commands-with-unbounded-output bounds the commands.
Execution Mode Selection (HARD GATE — must complete before executing ANY task)
Analyze independence first, select the tier, then begin — sequential-by-default because "the first tasks feel simple" forfeits the remaining tasks' parallelization savings.
Before starting the sequential task loop, check for parallelization opportunities:
Step 0: Tier 0 pre-check (Lifecycle Parallelism)
Read the plan. Apply a single judgment: "Does this plan have distinct code and test workstreams that can be assigned to separate agents with non-overlapping file scopes?"
Read plugins/soleur/skills/work/references/work-lifecycle-parallel.md now for the Tier 0 protocol; on execute go to Phase 3 after its Step 06, on decline fall through to Step 1.
Fanning out agents that run suites while the lead commits .ts/.js is self-contending by construction. lefthook's bun-test hook fires test-all.sh --affected on any staged .ts/.js — and a degraded selection (runner/index touched) promotes it to the full battery — and that run serializes on a repo-global flock — so the lead's commit QUEUES behind the fan-out's own suite runs and produces no output for as long as they take. Measured 2026-09-18: 13 minutes with an empty log, indistinguishable from a hang; the flock -w 3600 waiter SURVIVES killing the runner and holds lefthook open until it is killed by name. Commit .md-only batches during fan-out and hold .ts changes until the agents are done, or the queued battery measures a tree the agents are still mutating — a result that describes neither the before nor the after state. Also put "your final assistant message IS the deliverable; nothing you print to a tool log reaches me" in the SPAWN prompt, not only on resume — two agents in that session ended on a status line and each cost a SendMessage round-trip to recover work already done.
Standing constraint for EVERY tier — a spawned agent never runs the FULL gate.
Spawned agents run only the suites targeting the files they were given — mechanically,
test-all.sh --affected (the #8322 declared-edge gate); the compat spelling
TEST_GROUP=affected bash scripts/test-all.sh also survives as a deprecated
ALIAS of the same axis (#8621 — the #8591 heuristic selector was folded after
its decline set missed 49-355 suites per diff against the declared index).
Both are exempt from both refusal arms, so the spawn prompt needs no hand-derived
suite list. What a spawned agent must not run is a
full-gate-shaped invocation: test-all.sh --full,
apps/web-platform/infra/run-registered-suites.sh, or any other full-battery runner —
concurrent full-gate runs inflate each other's timings and corrupt the measurement. Measured
2026-08-11 — three agents running lints and suites at once turned an 860 s battery into 1675 s,
and that 1.9x figure was then nearly used as the suite's cost budget. The lead runs the gate
ONCE, after collecting fan-out work — step 9's bash "${CLAUDE_PLUGIN_ROOT}/scripts/gate-or-skip.sh"
(the same --affected run; rc table: affected-gate-contract.md),
previewed by bash scripts/test-all.sh --print-selection and reported with the selected N of M (an AFFECTED_GATE_SKIPPED line is not a pass). Two mechanical backstops exist, and neither depends on an
agent volunteering anything: a --full or degraded-full scripts/test-all.sh
exits 4 when it MEASURES a sibling full-gate run already in flight (#7553), and tc_acquire's
advisory lock (ADR-133) serialises whatever gets past that. SOLEUR_SUBAGENT=1 is a convention
a lead MAY export before spawning — the harness does not set it (measured 2026-08-19 from
inside two independent spawned agents: UNSET in both, and no repo-controlled spawn path exists
to set it); under it a full-shaped run exits 4, an affected run does not — so it remains agent
discretion for the non-concurrent case, written as an instruction, not a claim about the harness.
Step 1: Analyze independence
Read the TaskList. Identify tasks that have no blockedBy dependencies and reference
different files or modules (no obvious file overlap). Count the independent tasks.
If fewer than 3 independent tasks exist, skip to Tier C: Sequential below.
If 3+ independent tasks exist, proceed through the tiers in order (A, then B, then C). Each tier either executes or falls through to the next.
Pipeline mode override: If running in pipeline mode (plan file argument detected in Phase 1), auto-select Tier 0 if eligible (Step 0 above). If Tier 0 is ineligible, skip Tier A entirely and auto-accept Tier B without prompting. Do not present "Run as Agent Team?" or "Run in parallel?" questions -- proceed directly to Step B2 of the Subagent Fan-Out protocol if 3+ independent tasks exist, otherwise fall through to Tier C.
Tier A: Agent Teams (highest capability, ~7x token cost)
Read plugins/soleur/skills/work/references/work-agent-teams.md now for the Agent Teams protocol; on decline or failure fall through to Tier B.
Tier B: Subagent Fan-Out (fire-and-gather, moderate cost)
Read plugins/soleur/skills/work/references/work-subagent-fanout.md now for the Subagent Fan-Out protocol; on decline or failure fall through to Tier C.
The or failed is load-bearing and was missing: Tier 0 and Tier A both read "If
declined or failed, fall through", so a spawn FAILURE has a defined next step.
Tier B said only "If declined" — leaving a spawn failure (agent tool withheld, 529 Overloaded, headless run with no agent surface) undefined at the LAST tier that can
degrade. When it fires, say so: "Tier B fan-out unavailable () — executing
sequentially" rather than silently running Tier C as though it were the chosen tier.
Tier C: Sequential (default)
Proceed to the task execution loop below.
Task Execution Loop
Design Artifact Gate (before first UI task): If DESIGN_ARTIFACTS was set in Phase 0.5, spawn the soleur:product:design:ux-design-lead agent with the artifact paths for an implementation brief (its "Wireframe-to-Implementation Handoff" workflow) — the binding input for all UI tasks. Do not write markup before it arrives.
UX artifact commit checkpoint (after Design Artifact Gate): commit the brief and any generated design files (git add them, git commit -m "wip: UX implementation brief for <feature-name>") so it survives session crashes.
For each task in priority order:
while (tasks remain):
- Mark task as in_progress in TodoWrite
- Read any referenced files from the plan
- If task creates UI/pages: verify implementation brief exists (HARD GATE)
- TDD GATE: (see below)
- Look for similar patterns in codebase
- RED: Write failing test(s) for this task's acceptance criteria
- GREEN: Write minimum code to make the test(s) pass
- REFACTOR: Improve code while keeping tests green
- Run the touched-file suites after changes — **full suite instead if the project has no CI-enforced merge gate; see **Full-suite fallback** in Phase 2 §9**
- Mark task as completed in TodoWrite
- Mark off the corresponding checkbox in the plan file ([ ] → [x])
- Evaluate for incremental commit (see below)
No mid-plan pause gates (HARD GATE). A multi-phase plan
(tasks.md Phase 0 through Phase N) is a SINGLE execution unit.
Do NOT insert "Pause for review or continue?" prompts between
phases. Do NOT end a turn after one phase commits with "Continue
into Phase N+1 next turn?". The skill's Phase 4 handoff is the
only sanctioned stopping point — until then, chain straight
through every phase the plan defines, including phases the plan
labels "Pre-merge verification" or "Post-merge (operator)" if
they're automatable per the next gate. Why: the founder is a
solo operator; every "continue or pause?" is a context switch
that defeats the entire point of a multi-phase plan. Pipeline
mode (file-path arg in Phase 1) means pipeline mode for the WHOLE
plan, not per-phase.
Operator-step automation gate (HARD GATE). Before treating
any task in tasks.md as "operator-driven" (apply migration,
verify pg_cron, verify Storage bucket, run end-to-end smoke,
gh pr ready, gh pr merge --auto), check whether it is
automatable via a loaded MCP server or CLI:
cron.job queries + Storage bucket
existence + RLS spot-checks → mcp__plugin_supabase_supabase__*
with Doppler DATABASE_URL_POOLER fallback when MCP is
unavailable — see "Supabase fallback chain" below. When a
migration needs a SECURITY DEFINER RPC (e.g. to bypass an RLS /
column-grant restriction), start from
sql-security-definer-rpc-scaffold.sql
— it encodes the search_path pin + 4-role REVOKE + auth.uid()
authorization pin that test/migration-rpc-grants.test.ts enforces.gh pr ready / gh issue close → Bash via gh CLIsoleur:ship (review-evidence arm check)mcp__plugin_soleur_playwright__* — dedicated persistent profile; a flow needing stored auth that lives in a different registration's profile uses that registration)mcp__plugin_soleur_cloudflare__*mcp__plugin_soleur_stripe__*If automatable, EXECUTE it inline as part of the work pipeline —
never list it back to the operator. The soleur:ship skill already
handles gh pr ready + auto-merge + migration verification (see
plugins/soleur/skills/ship/SKILL.md); chain to soleur:ship
at Phase 4 and let it run. For migration apply to dev (vs
verify), invoke mcp__plugin_supabase_supabase__apply_migration
inline at the phase where the migration lands, not as a
post-merge todo. Why: see ship/SKILL.md:1027 ("Every 'please
run this manually' is a context switch") and ship/SKILL.md:1177
(PR #1375 — migration verification was left as a manual
"post-merge todo" instead of being executed; deployed code
expected the new schema and broke). Same class as the
Playwright-first audit in Phase 4: if a tool exists, use it.
Supabase fallback chain (when MCP OAuth fails). The Supabase
MCP OAuth flow at https://api.supabase.com/v1/oauth/authorize
intermittently rejects valid URLs at the dashboard auth_id
handoff (cause: external — Supabase-side). When that happens, do
NOT fall back to "paste this SQL into the dashboard SQL editor"
handoff — that's a manual-step rationalisation that violates
hr-never-label-any-step-as-manual-without. Instead walk down the
hr-exhaust-all-automated-options-before priority chain:
(1) Doppler DATABASE_URL_POOLER — already provisioned for every
env; the migration apply path. (2) Verify the project ref in the
URL matches the plan's stated dev/prd refs — Doppler is the
source of truth (plan-quoted project refs are preconditions to
verify, never facts; the plan can drift). (3) Rewrite the URL's
port :6543 → :5432 so the pooler runs in session mode (multi-
statement DDL works; transaction mode rejects with SQLSTATE 42601
"cannot insert multiple commands into a prepared statement").
(4) Apply via pg (node-pg, bun-installed in /tmp if missing)
wrapped in BEGIN; <migration>; COMMIT;. The direct DB host
db.<ref>.supabase.co:5432 is IPv6-only and typically
unreachable from operator/CI networks; the pooler is IPv4.
(5) Post-apply, verify schema via the same connection — RLS
enabled, policy_count, trigger names, RPC signatures + SECURITY
DEFINER flag, UNIQUE constraints. Write the verification artifact
to knowledge-base/project/specs/feat-<name>/migration-checklist.md.
Why: PR #3853 / #3205 — Supabase MCP OAuth was rejecting URLs
at the auth_id handoff; the agent first proposed "paste SQL into
dashboard" (manual-step violation), then pivoted to Playwright-
first audit on dashboard navigation (correct), then discovered
Doppler had the working DATABASE_URL_POOLER and applied via
pg directly — the path it should have taken at step 1.
Session stickiness: once the MCP OAuth handoff has failed even
once in the current session, treat Doppler DATABASE_URL_POOLER as
the default for ALL subsequent Supabase operations this session — do
not re-attempt the OAuth flow per-operation. Re-probing a known-flaky
external auth each time is the wasted-cycle trap; the fallback is not
slower once you are already authenticated to Doppler.
Pre-apply collision check (always, even on first attempt).
Before invoking pg apply (or supabase migration up) against any
shared env, run git fetch origin main && git ls-tree origin/main -- apps/web-platform/supabase/migrations/ | awk '{print $4}' | grep -oE '^[0-9]{3}_[^.]+' | sort -u. For each LOCAL migration
file the branch introduces, assert no DIFFERENT filename with the
same 3-digit prefix exists in that list. A collision means a
sibling PR is landing the same number window; renumber FIRST,
then apply under the final filename. Why: PR #4225 — applied
053–057 in the morning; PR #4251 landed 054_schema_migrations_ content_sha.sql 10 hours later and main's CI drift probe flagged
the entire branch; the recovery (renumber 054→058, 055→059, 056→060,
057→061 + reconcile public._schema_migrations on both dev + prd
via git hash-object content_sha) took ~30 min and could have been
zero-cost if the operator had grepped origin/main first.
The collision window extends through soleur:ship, not just work-time. This
check at work-start is necessary but NOT sufficient: a sibling migration can
land on main DURING the (often 30–90 min) ship phase — especially under a
fast-moving-main burst where soleur:ship Phase 7 performs repeated git merge origin/main auto-syncs on OPEN BEHIND. Each sync that pulls in a sibling
supabase/migrations/NNN_*.sql sharing your prefix is a silent collision the
BEHIND loop pushes straight to CI (where the migration drift/shape gate fails,
~16 min later). After ANY ship-time sync whose merge output lists
supabase/migrations/, re-run the prefix check above and renumber-during-ship
(git mv both up/down + update every in-repo reference: migration headers,
code comments, plan/tasks/learning) BEFORE the next push. Why: PR #5760 —
114_disk_io_top_wal_statements (a #5739-sibling) landed mid-ship; my
114_prune_cron_job_run_details collided and surfaced only at CI after ~6
auto-syncs; recovery was a renumber to 115. See
knowledge-base/project/learnings/workflow-patterns/2026-06-30-migration-number-collision-mid-pipeline.md.
The collision set includes the shared DEV DATABASE, not just origin/main. The
check above greps origin/main, and a sibling branch's migration is invisible there
until it merges — but it is fully visible in dev's _schema_migrations, because the
sibling session APPLIED it. Query all three sources and take the union: origin/main,
every worktree's supabase/migrations/, and
SELECT filename FROM public._schema_migrations ORDER BY filename DESC LIMIT 5 over
Doppler DATABASE_URL_POOLER. Why: #7829 — 136 was free on origin/main and
already applied to dev by a sibling; the collision surfaced only when a live probe for
an unrelated question happened to list the applied set, after the number had been
written into a function body (which Postgres stores in prosrc), an Article 30
register cell, and 38 prose sites.
Tracking row in the SAME transaction as the migration body.
The project's canonical apps/web-platform/scripts/run-migrations.sh
writes INSERT INTO public._schema_migrations (filename, content_sha) VALUES ('<basename>', '<git-hash-object>') in the same transaction
as the migration SQL. The Doppler+pg fallback MUST mirror this —
bare BEGIN; <migration>; COMMIT; produces a phantom-applied state
where the schema reflects the migration but _schema_migrations
does not, and the next deploy attempts re-apply (failing on
non-idempotent statements like CREATE TRIGGER). The reconciliation
pattern (UPSERT with ON CONFLICT (filename) DO UPDATE SET content_sha = EXCLUDED.content_sha) is the recovery shape — but
doing it inline is cheaper.
PostgREST schema cache reload via session-mode pooler does NOT
work. NOTIFY pgrst, 'reload schema' over a :5432 pooler
connection does not reach PostgREST's LISTEN (PgBouncer
multiplexes; LISTEN/NOTIFY channel scope is bound to backend
process identity, not session). 90 attempts over 5 minutes
returned PGRST205. After a direct-pg apply: either wait for the
natural ~10-min schema poll cycle, OR use the Supabase Management
API to restart PostgREST. The direct DB host
(db.<ref>.supabase.co:5432) is IPv6-only and typically
unreachable from operator networks, so the canonical "NOTIFY via
direct connection" workaround documented upstream isn't available.
Storage-bucket migrations: down.sql cannot DELETE storage tables;
column-takeover proof is permissive-vs-restrictive, not name-count.
Supabase installs a platform BEFORE DELETE trigger (protect_objects_delete
→ storage.protect_delete()) that blocks direct DELETE FROM storage.objects
AND storage.buckets ("Direct deletion from storage tables is not allowed").
So a bucket migration's down.sql reverts only SQL-droppable objects
(policies → function → column) — NOT the bucket/objects (Storage-API/operator
teardown; 019/042 precedent ship none; 071's DELETE FROM storage.buckets is
a dormant bug). Runtime cleanup uses service.storage.from(b).remove([...])
(allowed). And when verifying "no client can write column X" (read-proxy
trust), assert no PERMISSIVE INSERT/UPDATE/DELETE/ALL policy (a
RESTRICTIVE FOR ALL like workspaces_jti_not_denied only denies, never
grants) + a behavioral authenticated UPDATE affecting 0 rows. The
pooler also presents a self-signed CA chain → transient node-pg verify
scripts use ssl:{rejectUnauthorized:false} (dev-only, mirrors
run-migrations.sh sslmode=require; no committed code disables TLS verify).
See knowledge-base/project/learnings/2026-06-04-supabase-bucket-migration-down-and-rls-takeover-proof.md (#4916).
TDD Gate (HARD GATE): Before writing ANY implementation code for a task, determine if the task has testable behavior:
Emit rule-application telemetry (records that the TDD gate was reached — see AGENTS.md cq-write-failing-tests-before):
echo 'SOLEUR_RULE_APPLIED rule=cq-write-failing-tests-before note=Write failing tests BEFORE implementation code whe'
count === 2 while two slots are held) in addition to the final-state assertion. A test that passes identically with and without the primitive isn't testing the primitive. See knowledge-base/project/learnings/test-failures/2026-04-18-red-verification-must-distinguish-gated-from-ungated.md. Test-environment fidelity: if the SUT's buggy code lives behind a guard (if [[ -d "$X" ]], if (cache.has(key)), etc.), the harness MUST seed the precondition the guard requires — otherwise both buggy and fixed paths short-circuit identically and any negative-space assertion passes vacuously. See knowledge-base/project/learnings/test-failures/2026-04-22-red-test-must-simulate-suts-preconditions.md. Early-exit shadowing: if the SUT has a guarded fast path (substring strip like replaceAll(arg, ""), cache-hit, env-flag short-circuit) that handles a superset of inputs the slow path under test handles, RED inputs MUST choose identities ONLY the slow path can produce. Sharing a fixture across the fast/slow boundary lets the fast path scrub first and the regex/branch under test never fires — the assertion passes without testing the fix. Add an invariant guard test asserting the fast/slow fixtures do not collide. See knowledge-base/project/learnings/2026-05-04-vacuous-red-via-shared-fixture-and-toolchain-pinning.md. In-component state machines (RTL): when the gate-under-test is component-local state (useState/useRef/useReducer), drive the SUT through state transitions with result.rerender(<C />) — never unmount() + fresh render(). Remount resets the in-component bookkeeping that IS the gate, producing vacuous green. See knowledge-base/project/learnings/test-failures/2026-05-11-rerender-not-remount-for-in-component-state-machine-tests.md. Laundered-target resolvability (normalizer/strip/prefix-mangle security fixes): a regression guard for an anchored-strip / path-canonicalization / allowlist-key fix is vacuous unless the fixture makes the LAUNDERED (mis-normalized) target resolvable to an observable effect — if the downstream gate rejects it for an unrelated reason (nonexistent skill/row/file), the test passes identically with and without the fix. Litmus: under the buggy impl, does this input produce a DIFFERENT output than under the correct one? See knowledge-base/project/learnings/test-failures/2026-07-05-security-fix-regression-guard-must-make-the-laundered-target-resolvable.md. Fixture-space cardinality (ask this per contract sentence, and note that your own passing mutation battery cannot answer it): for each property the test claims, name the SET it quantifies over and count how many distinct members the FIXTURE instantiates — one member is a sample, not a proof, and code-mutation coverage does not detect a fixture-space gap. Three shapes recur: (a) a temporal contract (a wait/retry/debounce/convergence) sampled only by STATIC fixtures probes t=0 and t=∞ but never the transition — the case the guard exists for — so deleting the loop's break stays green; drive it with a stateful stub that changes on the Nth invocation and assert the success arm was reached VIA the loop; (b) a bidirectional guard (-w, an ordering, a comparison) must be fixtured in the direction where the weaker implementation gives a FALSE POSITIVE, not the direction that fails either way; (c) a stub that ignores argv, or a sleep/clock stubbed to a no-op, silently voids the call-shape and budget contracts — validate "$*" in the stub and COUNT the stubbed calls against the design's bound. Why: #6441 — a 7-mutation battery reported 7/7 RED while nine unimagined mutations (loop-break deleted, grep -qwF→-qF, addr show→link show, bound 30→1, sleep 2→600) all survived. See knowledge-base/project/learnings/2026-07-19-my-own-mutation-battery-was-the-false-confidence.md. A SURVIVING mutant is a result, and it has exactly two readings — label which: either the fixtures do not exercise the property (fix the FIXTURES, not the guard) or the mutant is EQUIVALENT (prove no verdict changes, and record that it survives). Leaving it unlabelled is how a guard that is merely adjacent to a working one ships. Measured: two anchoring fixes survived their own mutations because an earlier action= split already caught every fixtured row, and both were reachable in production once the fixture used a field whose sanitiser PERMITS the colliding literal; a third survived and was correctly left alone as equivalent. Why: #7220 — see knowledge-base/project/learnings/2026-08-05-my-anchoring-fix-survived-its-own-mutation-and-three-gates-were-green-elsewhere.md. A DISJUNCTION needs one fixture per disjunct, ALONE — and when the operands come from @tsv, check the parse before the logic. A fixture that satisfies every arm of an || at once proves the set is non-empty and nothing else: dropping either arm keeps the suite green, so a load-bearing signal and a dead one are indistinguishable. The sharpest instance is not a missing fixture but a PARSE bug the all-arms fixture hides: tab is IFS-whitespace, so while IFS=$'\t' read -r a b c COLLAPSES runs of tabs and drops empty middle fields, and @tsv emits an empty field for an absent key — so digest<TAB><TAB>unknown parses as b="unknown", c="", shifting every later field one position left. The arm reading c is then unreachable in exactly the case where it is the only signal. Sentinel every optional @tsv field ((.x // "-")) so no field is ever empty, and fixture each disjunct in isolation. Why: #7378/PR #7379 — the guard written to stop crane validate gunzipping an in-toto attestation layer sent that layer to crane validate whenever the annotation was absent, while emitting a message asserting that was impossible; five further guards in the same PR (a > 0 count that could not see partial enumeration, an untested ref_repo, two verify_die arms with no failing fixture, and the whole new block behind no assertion floor) were vacuous the same way. See knowledge-base/project/learnings/2026-08-10-the-guard-i-wrote-to-close-7378-reopened-it-one-field-to-the-left.md. A numeric predicate that is a LOWER BOUND ONLY cannot distinguish a measurement from a CONSTANT — bound it on both sides, against a value the artifact itself reports. value >= N over any measured quantity (an elapsed, a count, a byte size, a row total) passes identically against a hardcoded literal, so a suite of them tests that something happened and never that the something is a function of its inputs. Litmus per assertion: name a constant that satisfies it — if you can, it is a shape check wearing a measurement's clothes. Prefer a ceiling derived from the output itself (the banner prints its own budget; the report prints its own input size) over a second magic number, and place the two bounds so no single value can satisfy both arms at once. Why: #7484 — a PR whose entire thesis was "report the measured wait instead of asserting one" had all three elapsed predicates as one-sided floors and the discriminating premise ("a free lock reads single-digit ms") sitting in a PROSE COMMENT; printf '%sms' 1500 passed 95/0, and dropping the /1000 printed a claimed 33-minute wait against a 2-second budget, also green. Its 7-row mutation battery could not see either: every row perturbed the SUT toward small or absent, so a plausible constant was outside the axis it edited. See knowledge-base/project/learnings/2026-08-13-a-lower-bound-cannot-tell-a-measurement-from-a-constant.md. A row that pins a SPELLING is vacuous until its fixture makes the other spelling disagree — and a verdict that rides on a pipeline's EXIT STATUS is decided by a shell option you do not set. Two halves of one question: what does this check read, and who controls it? (a) A row written to justify a precise form (refs/remotes/origin/main over origin/main, .. over ..., a fetch over a reachability ping) passes trivially when the fixture's state makes both forms return the same answer — construct the state where they DIFFER and confirm the row reds under the other form, because a row passing for the wrong reason is indistinguishable from one passing for the right one. (b) { …arms… } | grep -q . && A || B reports the LAST arm's status and takes SIGPIPE on a successful match, so under an operator-profile set -o pipefail it answers B on a real hit — capture the output and test the string ([ -n "$( … )" ]). A harness that deletes SHELLOPTS/BASHOPTS for hermeticity is correct AND blind to this, so add a row that drives set -euo pipefail explicitly. Why: #8470/PR #8567 — the branch-scoped ship probe shipped both, green through a 14-row battery whose every fixture put origin/main at the branch point; .claude/hooks/grep-q-pipe-guard.test.sh had banned the pipeline shape for hooks and the ban had not travelled to skills. See knowledge-base/project/learnings/2026-09-23-my-verdict-rode-on-a-pipeline-status-and-my-test-deleted-the-option-that-inverts-it.md.Skipping this gate — writing implementation before tests — is a workflow violation equivalent to committing directly to main. The rationalization "this is simple enough to not need test-first" is exactly the reasoning TDD is designed to prevent.
x=$(fn) where fn backgrounds a child (daemon … &; echo $!) waits FOREVER unless the child's stdout is redirected — command substitution returns only when every writer of its pipe closes, and the backgrounded process inherited that pipe. Redirect the child (… >/dev/null 2>&1 &), and bound any container/harness call that could hang with timeout -k plus a named, force-removed container, or a hang eats the CI job's clock and the stale completion notification reads exit 0. Why: #6680 — a docker runtime arm hung 10 minutes on WEB_OK=$(sshd_on …).
Six shell-authoring traps that fail SILENTLY and cost a full debug cycle each. (a) Tab is IFS whitespace, so while IFS=$'\t' read -r a b c collapses a LEADING or empty field — a sentinel emitted as \t__MARK__\t12 arrives as a=__MARK__ b=12 c=, and the count lands in the wrong variable. Put a sentinel in a non-empty FIRST field. (b) An apostrophe anywhere inside awk '…' closes the block — including in a prose comment written to explain the code ("split on the shell's own separators"), which surfaces as a bash syntax error pointing at an unrelated line; grep the block for ' after editing. (c) A case glob's * matches / but the pattern is still ANCHORED: a root-anchored <dir>/*.sh pattern covers arbitrary depth BELOW that directory and matches no same-named directory elsewhere in the tree, so a two-pattern list read as "covers everything" while missing ~185 tracked scripts. When claiming a pattern's reach, name the axis and test a member on the OTHER one. Why: #7084/PR #7566 — (a) reported "parsed 0 jobs" and would have been "fixed" by lowering the floor; (c) shipped in a commit message asserting the opposite. See knowledge-base/project/learnings/security-issues/2026-08-16-a-guard-asserting-absence-was-backwards-and-my-floors-counted-the-wrong-thing.md.
(d) A BACKTICK INSIDE SINGLE QUOTES IS ALREADY LITERAL — escaping it changes the regex's meaning, and the failure is a matcher that accepts EVERYTHING. '^[ ]?[ ]?[ ]?(\``|~~~)'looks like careful quoting and is not: GNU grep reads`` as the buffer-start anchor, so the alternation degenerates to zero-width anchors and matches the empty string at position 0 of EVERY line. A branch gated on it fires on every input and any arm below it is unreachable. Litmus for any new pattern: run it against an input it must NOT match.
(e) DEFINE VERDICT HELPERS AFTER SOURCING A SUT, and give every suite an instrument self-test. A suite that sources the script under test inherits that script's function namespace — so a fail() declared ABOVE the source is silently replaced by the SUT's own, every verdict routes through the SUT's logger, and the suite's counters never move. The accounting check then fires on a suite whose assertions all ran correctly. Drive both helpers once and assert ALL their observables moved (the counters AND the append-only ledger the verdict reads).
(f) ANCHOR AN EXTRACTION ON CONTENT, NEVER ON SHAPE. A test that slices a program out of another file by its closing delimiter (^ '\), a trailing brace, a blank line) is coupled to every future edit of the sliced program: adding one fallback truncates the slice, and the oracle then reports a divergence in the SUT when the fault is in the instrument. Use content markers the sliced file carries deliberately, and REFUSE on an extraction lacking the constructs that define it — a truncated program is worse than an absent one, because it parses and answers. Why: #7490 — (d), (e) and (f) each fired in one session, every one producing a confident wrong reading rather than a failure. See knowledge-base/project/learnings/2026-09-18-every-instrument-i-built-to-check-the-guards-needed-checking.md.
An anti-vacuity floor's SUBTRAHEND must be a literal ADJACENT to the floor, and a NUL-framed stream cannot be captured through $(...). (a) guard-vacuity-floor.test.sh proves a floor fires by slicing the if plus its CONTIGUOUS simple assignments into a mutant with every counter zeroed; a subtrahend bound 130 lines up (SELFTEST_PASSES=$passes after the self-test) is unbound in that slice, the mutant dies at set -u, and the floor scores CONSTRUCTION — never FIRES — so three brand-new suites joined the meta-guard's uncovered set at once. Write SELFTEST_PASSES=1 (the self-test already asserts passes == 1, so the literal is proven) directly above REAL=$((passes - SELFTEST_PASSES)). (b) bash command substitution DROPS NUL bytes ("ignored null byte") and trailing newlines, so a parser emitting printf '%s\0' cannot be tested through out=$(…): count records with | tr -cd '\0' | wc -c INSIDE the pipeline and read bytes back through | tr '\0' '\n'. Why: #8302 — three floors and three parse cases, all green locally, all wrong. See knowledge-base/project/learnings/2026-09-18-every-p1-lived-in-a-guard-i-added-and-two-fixes-reintroduced-their-class.md.
Two jq idioms that fail SILENTLY and both shipped in one projection module. (a) list | index(.key) evaluates .key against the LIST (the pipe rebinds .), so a membership test written that way errors on the first element with Cannot index array with string "key" — bind first: .key as $k | (list | index($k)). (b) paths(scalars) DROPS every false and null leaf, because paths(f) keeps a path only when f is truthy on the VALUE and scalars yields the value itself — a leaf diff built on it renders enabled: false as <absent>. Walk with paths(type != "array" and type != "object"), and give every leaf-diff suite a false/null fixture. Why: #8050 — (a) was caught by rc 5 on the first parity run, (b) by a suite row that flipped enabled; the pre-existing probe carried (b) for months.
A gate placed AFTER a cheap pre-filter is only reachable for inputs the filter admits — give every gate a counter, or its removal has no observable. When a walk is structured as cheap-filter-then-expensive-check, ask per gate which inputs actually reach this line. Measured: an own-uid gate inside the classifier counted ZERO against a real /proc, because a foreign process's /proc/<pid>/fd is mode 500 so the fd/255 pre-filter rejected it first — the gate could not fire and deleting it changed nothing, which is a guard that no test can falsify. Moving it ahead of the pre-filter as a fork-free [[ -O ]] took it from 0 to 390 of 627. Same session, same shape one level out: (( x < $SEAM )) on a NON-numeric seam does not abort — it errors and evaluates the if as FALSE, silently skipping the branch, so an unvalidated MIN_AGE_S=10m signalled a two-second-old process while every counter reported a clean walk. Validate numeric seams as ^[0-9]+$ at the boundary. Why: #7537 — see knowledge-base/project/learnings/2026-08-20-my-test-suite-reaped-the-live-box-and-every-gate-was-green.md.
When adding MCP tools to an existing registration block in agent-runner.ts, verify each tool's prerequisites are independent of the block's guard condition. Write a test that validates the new tool works WITHOUT the existing block's prerequisites (e.g., Plausible tools work without GitHub installation).
When adding route handler tests that require vi.mock(), create a separate test file from existing unit tests that import the real module. Vitest hoists all vi.mock() calls to the top of the file, clobbering real imports for the entire file regardless of describe block scope.
When creating test files with vi.mock() factories that reference shared variables, use vi.hoisted() from the start -- vitest hoists vi.mock to the top of the file before const/let declarations execute.
When a NEW shared module will be imported (directly or transitively) by files that already have test suites mocking a node builtin (vi.mock("node:child_process") with spawn-only factories is the common case), do NOT destructure that builtin's exports at module top level (promisify(execFile) crashes EVERY sibling suite at import). Lazy-import inside the function that uses it. Why: #5091 — _cron-safe-commit.ts's top-level promisify(execFile) broke 28 cron-bug-fixer tests at module load. See knowledge-base/project/learnings/2026-06-10-bot-cron-safe-commit-substrate-symlink-removal.md.
Before adding a vi.mock("<module>") to an EXISTING test file, grep the file for a pre-existing mock of the same module (grep -n 'vi.mock' <file> | grep <module-basename>) and wire your spy into that block instead. Vitest registers one mock per resolved module per file; a duplicate does not error — it silently picks one, and your hoisted spy captures zero calls. Why: PR #5090 — a new egress-posture-log spy was added as a second @/server/logger mock while the factory test already mocked it ~150 lines down; cost 4 debug cycles. See knowledge-base/project/learnings/bug-fixes/2026-06-10-sandbox-network-plane-not-token-plane-error-shape-triage.md.
A WHOLESALE vi.mock("<module>", () => ({...})) replaces the ENTIRE module, dropping every export the factory omits — so a module with multiple named exports (@/server/logger exposes default AND createChildLogger; observability, db-helper, supabase wrappers similarly) breaks any REAL sibling in the SUT's import graph that consumes a different export. Default to vi.mock(spec, async (importOriginal) => ({ ...await importOriginal(), <override> })); reserve wholesale factories for modules you fully replace — or skip the mock entirely if the thing under test already mocks the export's consumer. Detection is free: run the FULL test file (never -t "<new test>" alone) — the RED run surfaces unexpected sibling failures naming the missing export. Why: #5689 — a wholesale @/server/logger mock dropped createChildLogger (used by probe-octokit.ts via _cron-shared), breaking 10 unrelated arm-2 tests. See knowledge-base/project/learnings/test-failures/2026-06-29-wholesale-module-mock-drops-named-exports-needed-by-transitive-siblings.md.
A partial vi.mock(spec, async (importOriginal) => ({ ...actual, B: spy })) override only changes what importERS see — it does NOT intercept a call made by a REAL sibling function A (kept via ...actual) to B within the same module; A references B through the module's internal lexical binding, not the export object. Symptom: the spy reports 0 calls even though the path clearly runs B. To observe B while keeping A real, mock the deeper boundary B itself crosses (fetch, the DB client, child_process) and assert there. Decision rule: mock the seam the unit under test does not own. Why: #5728 — overriding postSentryHeartbeat didn't intercept the real finalizeOutputAwareHeartbeat's internal call; fixed by keeping it real + stubbing fetch + asserting the POST URL. See knowledge-base/project/learnings/test-failures/2026-06-30-partial-module-mock-does-not-intercept-intra-module-calls.md.
When mocking child_process.spawn, fetch, or any constructor returning an event-emitter-like object, use mockImplementation(() => factory(...)) rather than mockReturnValue(factory(...)). mockReturnValue evaluates the factory eagerly at test-setup time; any queueMicrotask / setTimeout / setImmediate scheduled inside the factory fires BEFORE the SUT attaches its listeners, producing empty event data or an "uncaught error" test timeout. See knowledge-base/project/learnings/test-failures/2026-04-17-vitest-mockReturnValue-eager-factory-async-event-race.md.
A vi.fn(() => value) mock declared with a ZERO-parameter implementation cannot be invoked via a (...args) => mock(...args) forwarder (the standard vi.mock factory shape) — tsc rejects the spread with TS2556 "A spread argument must either have a tuple type or be passed to a rest parameter", even though the vitest run is GREEN (vitest type-checks test files lazily). Give the impl a rest param: vi.fn((..._args: unknown[]) => value), matching sibling vi.fn() mocks. Only a standalone ./node_modules/.bin/tsc --noEmit catches it. Why: #5817 — execFileSyncMock = vi.fn(() => Buffer.from("")) passed 36/36 tests but failed tsc. See knowledge-base/project/learnings/test-failures/2026-07-01-vitest-zero-arg-mock-cannot-take-spread-suite-green-tsc-red.md.
When the SUT awaits something (mkdtemp, a config read, a lock) BEFORE it calls the mocked spawn/fetch and attaches listeners, emit the child's close/error/data events from INSIDE the spawn mock (spawnMock.mockImplementation(() => { queueMicrotask(emit); return child; })), NOT from a sibling top-level queueMicrotask in the test body. A test-level microtask scheduled right after calling the SUT fires during the pre-spawn await gap — before listeners exist — so the settle-once promise never resolves and the test times out (16s). The emit must be scheduled relative to when spawn is actually invoked. Why: PR #4970 — adding await mkdtemp before spawn in c4-render.ts timed out 6 tests until the emit moved inside the mock; see knowledge-base/project/learnings/best-practices/2026-06-05-external-cli-exit-0-is-not-proof-validate-the-artifact.md.
When using vi.doMock("specifier", () => { throw new Error("X") }) to simulate a module-init failure, do NOT assert on the inner error message via the SUT's caller. Vitest wraps factory throws with its own synthetic Error ("[vitest] There was an error when mocking a module...") and the inner string is unobservable. Assert on the SUT's observable contract (return shape, observability mirror call) instead — the throw is a trigger, not a contract. See knowledge-base/project/learnings/2026-05-07-vitest-domock-factory-throw-wrapped-message.md.
To prove a cache-hit skips work (not just that the response status is correct), wrap the real implementation in a spy via vi.importActual rather than stubbing the return value: vi.mock("@/module", async () => { const actual = await vi.importActual(...); return { ...actual, expensiveFn: (...args) => { spy(...args); return actual.expensiveFn(...args); } }). Stubbed returns break any downstream behavior that depends on the real output (hash-match, SQL row shape, etc.); wrapping preserves the contract while exposing call counts for assertions like expect(spy).toHaveBeenCalledTimes(1) across a HEAD+GET sequence. Why: In PR #2515, verifying that HEAD populates shareHashVerdictCache so a follow-up GET skips the SHA-256 drain required counting hashStream calls, not stubbing its return — a stubbed return would have broken the post-drain hash-equality check and masked the very regression the test was meant to catch.
When testing decorative images (alt="") with happy-dom, use container.querySelector instead of screen.getAllByRole("img", { hidden: true }) -- happy-dom excludes presentational elements from role queries even with hidden: true.
When asserting against a conditional render branch in a component test, grep the test file's vi.mock(...) factories for the inputs the branch reads and confirm the mock returns values that activate the target branch. Mocks that simplify (e.g., getDisplayName: (id) => id.toUpperCase()) often skip production branches like leader.title.includes(displayName) — assertions on the skipped branch fail for non-bug reasons. Why: PR #3427 — see knowledge-base/project/learnings/2026-05-07-test-assertion-must-verify-mock-activates-branch.md.
A wait-on-ABSENCE (await vi.waitFor(() => expect(queryByTestId(x)).toBeNull())) is vacuous — it passes on the FIRST tick, before the async work resolves, so it never proves "absent AFTER the state commit." Anchor the wait on a positive settle signal (e.g., a .finally(() => { settled = true; }) flag on the mocked response body), then assert absence. Also: vitest's vi.waitFor and RTL's waitFor/findBy* have independent 1 s defaults and independent config surfaces — a global RTL asyncUtilTimeout bump does not touch vi.waitFor call sites. Why: #5113 — see knowledge-base/project/learnings/test-failures/2026-06-10-parallel-load-flake-two-mechanisms-and-vacuous-absence-waits.md.
An intermittent absence-wait that times out at the FULL (explicit) timeout is a component/state RACE, not a timeout-floor problem — raising the timeout cannot fix it. Discriminator: if the failing vi.waitFor site already carries an explicit { timeout }, the floor is irrelevant; trace the component's effect ordering. A passive effect that resets state on EVERY render where a condition holds (if (cond) setX(false)) rather than on a prev→curr transition races any user action that should win (React runs passive effects AFTER commit, so it can land after the click and undo it) — gate such effects on the transition via a prevValue ref. Why: #5796 — see knowledge-base/project/learnings/test-failures/2026-06-30-vi-waitfor-floor-vs-component-rearm-race.md.
When testing a fallback ladder or mode option (primary-then-degrade, retry-then-cache, mergeMode direct→arm-auto-merge), assert the FIRST rung was attempted (the primary call fired), not just the fallback's effect — an effect-only assertion passes identically against an option-ignoring implementation whose default path yields the same end state. Why: PR #5133 — two mergeMode-direct fallback tests passed against the pre-#5111 helper; see knowledge-base/project/learnings/2026-06-11-pipeline-consolidation-behavior-preserving-migration-traps.md.
When adding sessionStorage usage to React components, ensure the component's test file includes sessionStorage.clear() in its beforeEach block. Shared jsdom environments leak sessionStorage between tests, causing ordering-dependent failures.
When adding a React-context-dependent hook (useTheme, useRouter, any provider-gated hook) OR a new provider import to a SHARED component, grep test/ for every file that renders that component DIRECTLY (not via a vi.mock of its module) and add the provider stub in the SAME commit. tsc and the component's own test pass; sibling direct-render tests fail at RUNTIME with <hook> must be used inside <Provider>. Why: PR #5217 — C4Canvas gained useTheme(); c4-fullscreen.test.tsx (the only direct <C4Canvas> renderer) broke 8 tests until stubs for theme-provider + @mantine/core were added. See knowledge-base/project/learnings/2026-06-12-likec4-mantine-color-scheme-seam-and-vendored-theme-preservation.md.
To reproduce a provider's SSR-hydration "no-bootstrap" state in jsdom (lazy useState initializer landed on a server fallback like "system" WHILE durable storage holds the real value AND the DOM attribute is absent), do NOT use a Storage.prototype.getItem call-count spy — it bleeds across tests in the shared jsdom worker (passes in isolation, fails in-suite) and a leftover DOM attribute pollutes later inits. Instead use REAL localStorage (empty at init) and write the stored value from inside the matchMedia.matches getter (fires during the resolved-state initializer — after both init storage reads, before the first-mount effect); scrub the attribute + clear storage inside the mount helper and cleanup() in afterEach. Pair it with a precondition self-check (if (!released) throw) so a future init refactor that stops touching matchMedia fails as a clear FIXTURE error, not a phantom SUT regression. A naive client-only mount masks the bug (initializer reaches the durable value directly → vacuous green). Why: PR #5312 — see knowledge-base/project/learnings/test-failures/2026-06-15-ssr-hydration-no-bootstrap-theme-test-gate.md.
When asserting on vi.getTimerCount(), remember that vi.useFakeTimers() mocks every timer-like API by default — including requestAnimationFrame, setImmediate, queueMicrotask, requestIdleCallback. The count is a SUM across all fake timer types, not just setTimeout. Prefer stability assertions (count before N extra calls === count after) over magnitude assertions (count === 1) so refactors that add a well-behaved rAF or microtask don't falsely read as leaks. See knowledge-base/project/learnings/test-failures/2026-04-17-vitest-getTimerCount-counts-requestAnimationFrame.md.
When a component exports an interface that a test harness consumes (e.g., ChatInputQuoteHandle), have the test import it via type X = ExportedInterface — never shadow with a local duplicate. Duplicate interfaces silently drift when the exported type gains a method; the tsc --noEmit failure surfaces only at build time.
When adding a new npm dependency, check the installed major version (node -e "console.log(require('<pkg>/package.json').version)") and read the type definitions before using API from docs or training data. Library APIs change across major versions (e.g., react-resizable-panels v4 uses Group/Separator/orientation/useDefaultLayout, not v2's PanelGroup/PanelResizeHandle/direction/autoSaveId).
For sizing APIs from third-party libraries, always pass explicit units as strings (e.g., "18%", "100px", "1rem") rather than bare numbers. Docstrings may claim a default unit but runtime parsers often treat numbers as pixels. Why: react-resizable-panels v4 doc said "Percentage of the parent Group (0..100)" for numeric sizes, but the runtime treated 18 as 18px, producing a ~18px-wide sidebar in production. Explicit units make intent visible at the call site and survive library version upgrades.
Test environment setup: If the project's test runner cannot run the type of test needed (e.g., React component tests require jsdom but vitest is configured for node), set up the test environment BEFORE starting the task. This is part of RED — the test infrastructure must exist for the test to fail properly.
await import() for all subsequent dependencies — static ES imports are hoisted before any imperative code, causing libraries like @testing-library/react to initialize without DOM globals. See knowledge-base/project/learnings/test-failures/2026-04-03-bun-test-dom-preload-execution-order.md.word in ${VAR:?word}, so quotes there are consumed, not printed — and an UNBALANCED one is a whole-file parse error reported far from its cause. : "${d:?git -C '' would retarget}" prints git -C would retarget (note the double space): the '' never reaches the operator, so it buys nothing and costs the parse hazard. One extra apostrophe — a possessive like caller's alongside a '' pair — makes three, and bash then reports syntax error near unexpected token at a line 150 below the real one. Write these messages quote-free (git -C <empty>), which removes the hazard class rather than balancing it, and run bash -n over the WHOLE file after any edit rather than eyeballing the edited region. Why: #7709 — hit twice on one branch, the second time after the trap was written into a commit message. See knowledge-base/project/learnings/2026-09-03-every-p1-was-in-the-verification-not-the-fix.md.*/ inside a /* … */ / /** … */ block comment — it closes the comment early. The trap is documenting a regex that ends in */ (/--[^\n]*/g, foo/**/*): esbuild/tsc then parses the trailing prose as code and reports Expected ";" but found <token> at a line deep inside the docstring (a red herring — the real cause is the stray */ upstream). Describe the regex in prose or use a // line comment; grep -nF '*/' <file> after authoring confirms every hit is real code. Why: #5920 — a */g in a JSDoc comment broke collection of byok-rpc-body-markers.test.ts. See knowledge-base/project/learnings/build-errors/2026-07-03-jsdoc-block-comment-closed-early-by-regex-star-slash.md.pdfjs-dist, sharp, puppeteer, playwright, @xenova/transformers, onnxruntime), pre-warm the module in beforeAll(async () => { await import("<module>"); }, 30_000). The cold-start cost (~5-10s on CI runners) otherwise lands on the first it() and blows the default 5s vitest timeout — the second test in the same file runs at warm ~9ms because subsequent calls hit the module cache. Cheapest detection: git grep -lE '(pdfjs-dist|sharp|puppeteer|playwright|@xenova/transformers|onnxruntime)' -- '*.test.ts' and check for sibling beforeAll. Why: PR #3681 pdf-text-extract.test.ts cold-start flake (7s vs 9ms, #3687)./tmp/). Playwright MCP restricts file access to the repo root. When Google Search Console offers Cloudflare auto-verification, prefer "Any DNS provider" manual flow — the popup OAuth flow opens an external tab that crashes the Playwright browser context.browser_evaluate(filename: ...) from the FIRST attempt — the return value otherwise enters the conversation transcript and the token is leaked even after revocation. AND the filename parameter JSON-encodes the result (surrounding quotes), so the canonical pipe is python3 -c "import sys,json; sys.stdout.write(json.loads(open('<path>').read()))" | doppler secrets set <KEY> --no-interactive. Validate via the vendor's API (HTTP 200 + length check) before shredding the file — some vendors silently tolerate quoted tokens via Authorization: Bearer "abc", but Terraform's HCL parser does not. For ●●●-masked UI tokens (Doppler personal tokens), click the in-page copy button via browser_evaluate, then xclip -selection clipboard -o > <path>; clear with xclip -i </dev/null. Doppler TF var storage convention: drop the TF_VAR_ prefix from the secret name — --name-transformer tf-var ADDS the prefix at injection time (DOPPLER_TOKEN_TF → TF_VAR_doppler_token_tf; storing the already-prefixed TF_VAR_DOPPLER_TOKEN_TF produces TF_VAR_tf_var_doppler_token_tf). See 2026-03-21-doppler-tf-var-naming-alignment.md. Why: PR #3973 (#3960) — full pattern + recovery flow at 2026-05-18-vendor-token-mint-and-oci-image-content-carrier-patterns.md.Write whose hook output emits a warning (security, style, rule), immediately Read the file to verify the full content landed. PreToolUse hooks that print error output but return non-blocking status can still cause partial writes — detecting this only when tests fail wastes a debug round. See knowledge-base/project/learnings/2026-04-15-kb-share-binary-files-lifecycle.md.readFileSync(path) + expect(src).toMatch(...)) as a negative-space regression gate after an extraction, put them in a standalone *.test.ts file — never add them to an existing test file that already mocks node:fs or node:path. The existing vi.mock("node:fs", ...) factory likely omits readFileSync, and the new test will fail at collection with "No readFileSync export is defined" before any assertion runs. Also trim the gate to only the assertion that cannot be expressed behaviorally — usually the negative "symbol-not-present" check. Positive assertions (import regex, await-call regex) duplicate coverage that mock-based behavioral tests already provide and are brittle to barrel re-exports, aliases, and whitespace. See knowledge-base/project/learnings/best-practices/2026-04-17-regex-on-source-delegation-tests-trim-to-negative-space.md.hits=$(grep …) # rule-grep) with an initialiser above it — deleting a done < <(grep …) loop tail yields a syntax error, which is neither a pass nor a fail; and anchor the sed/perl on the marker, not the SUT's syntax, keeping the row's "mutation did NOT land" guard (it caught a multi-line regex breaking a single-line anchor). Why: #7946 review — see knowledge-base/project/learnings/2026-09-11-every-sentence-my-runbook-inherited-was-false-when-measured.md.>= N, floor == inventory count, a derived-list equality, a run-time re-assertion) all held while one config was swapped for another, so reach shrank and the scan reported a clean 13/13. Tightening the counts never closes it — they measure the wrong thing, which is exactly why the gap survives review. Assert the SET (e.g. a superset check against the merge base, with an explicit ack array for deliberate removals), and prefer the MERGE BASE over origin/main's tip so an un-rebased branch does not red for a shrink it did not make. (b) An anti-vacuity PASS + FAIL >= N floor counts assertion CALLS, not BODIES: deleting the new guard's whole comparison loop still reported 61/61 and exit 0, because a gutted control still calls pass(). Give a loop-based assertion its own accounting (count what it examined, reconcile against the expected input size) and mutation-prove it — reading the guard is not sufficient, this one was written by someone who knew the vacuity class. Why: #7234 — see knowledge-base/project/learnings/2026-08-04-a-count-framed-ratchet-cannot-see-a-rename.md.readFileSync + toContain/toMatch over .tf/.yml/.ts), and the obvious correction — slice a narrower region — FAILS when a file puts explanatory comments INSIDE the construct: there is then no scope that holds the config but no prose. Anchor on something a comment cannot produce (^\s*key\s*= — a comment line starts with #; a call shape Fn\(\s*arg), never a bare word. Treat every toContain of a token that also appears in a nearby comment as guilty until mutation-tested, and give every slice helper an explicit lower bound plus an indexOf === -1 guard (slice(-1) yields the last character, so .not.toMatch() against it always passes). Why: #6456 shipped FOUR — /value\s*=\s*2/ matched its own "WHY value = 2 AND NOT 3" comment; toContain("IssueOwners") matched an in-body comment while the entire actions_v2 block was deleted (the rule then paged nobody — the outcome the test was named for) and stayed 10/10 green; a boundless scopeResource swallowed the next resource's comment so a GROUPING-anchor check was satisfied by the pointer to the paragraph it was meant to find. All four were read-and-believed; only mutation caught them. Count failures from the runner's summary line after stripping ANSI — grep -cE '^\s+×' always returns 0. See knowledge-base/project/learnings/2026-07-15-narrowing-is-not-anchoring-and-a-documented-class-recurred-four-times-in-one-pr.md..sh/.test.sh body-grep gate, an AC grep -n … | head -1 order check), anchor it on the syntactic write/call construct (rest/v1/<table>, a function-call shape) — NEVER a bare token (<table>, <flag-name>) that the same file also names in a COMMENT or header-inventory. A body-grep sees comments too, so the moment a task requires both a "must / must-not contain X" assertion AND documenting X in a comment, they collide: a negative ! grep -qE 'X' false-FAILs on the explanatory comment, and a grep -n X | head -1 order check returns the comment line, not the code. Reword forbidden-literal comments to drop the literal. Same class as the source-reading-regex rule above, for bash. Why: PR for #5501 — seed-live-verify-user.sh's user_session_state upsert: the test's ! grep '/rpc/set_current_workspace_id' tripped on a comment naming the RPC, and the AC3 bare grep user_session_state matched the new header-inventory line. See knowledge-base/project/learnings/test-failures/2026-06-17-grep-assertion-over-script-body-false-matches-own-comments.md.(?:list|ls)\b lets … list --json extract the bare … list (a member) and pass GREEN while the real command is a non-member — and (b) match EVERY shape the producer can legitimately emit (optional bash prefix, env-prefixed direct-exec) — an unmatched shape silently escapes the guard, it is not caught drift. Litmus: mentally mutate the producer (add a flag, drop the prefix, change the anchor) and confirm the test goes RED for each; .trim() the extract to mirror the checker's own normalization. Do NOT assert a failure consequence in the docstring you haven't traced in the gate code (e.g. "DENIED on server" when the path only degrades to the review-gate). Why: PR #6152 (#6121) — the plugin-root list/ls coupling test's regex false-GREENed on trailing-arg + no-bash drift; caught by test-design + user-impact review. See knowledge-base/project/learnings/best-practices/2026-07-07-drift-guard-extraction-must-mirror-production-checker-boundaries-and-all-emission-shapes.md. process.env.* or globalThis.*, capture originals at module top-level (before any describe) and restore in afterEach using delete when the original was undefined — bun test runs every file in a single OS process, so mutations leak to sibling files and to any spawnSync subprocess launched after the mutation. Vitest isolates files in workers by default; bun does not, and has no built-in stubEnv/unstubAllEnvs equivalent. Why: PR #2579 — bot-fixture-helpers.test.ts stubbed SUPABASE_URL in beforeEach with no restore, causing 4 integration tests in bot-fixture.test.ts (same run) to ConnectionRefused against the stub host. See knowledge-base/project/learnings/test-failures/2026-04-18-bun-test-env-var-leak-across-files-single-process.md.process.env.X === "true"-gated default-off path, add vi.stubEnv("X", "") to beforeEach regardless of whether the current Doppler/CI config injects the var. vi.unstubAllEnvs() reverts vi.stubEnv writes only — it CANNOT delete a process-inherited env var (Doppler dev / CI secrets / direnv / devcontainer envs). The test passes locally with plain npx vitest run and fails deterministically under doppler run -p soleur -c dev -- npx vitest run when the dev config flips the flag on. Tests that need the flag on continue to call vi.stubEnv("X", "true") in their own it() bodies — the local stub overrides the beforeEach default (overwrite-semantics). Why: PR #4141 (#4128) — cc-dispatcher.test.ts > T-W4-basic-off failed 1/1 under Doppler dev because CC_PERSIST_USAGE=true injection survived unstubAllEnvs(). See knowledge-base/project/learnings/test-failures/2026-05-20-vitest-unstub-does-not-clear-process-inherited-env-vars.md.if (!condition) { retry; return; } which let attempt-1 leaks slip through. See knowledge-base/project/learnings/test-failures/2026-04-19-retry-once-early-return-masks-first-attempt-failures.md._data/*.js files: (a) name the file in camelCase matching a valid JS identifier — kebab-case filenames produce hyphenated template variables that Nunjucks dotted access cannot resolve; (b) keep the module default-export-only — sibling export statements silently disable Eleventy's data-module registration (no error, no warning, the benchmark log omits the file); attach test helpers as properties on the default export. Verify each new _data/*.js appears in the build's Benchmark ... (Data) ... log. Why: PR #2596 — see knowledge-base/project/learnings/build-errors/2026-04-18-eleventy-data-module-loading-and-nunjucks-null-test.md.is null / is not null test — the parser accepts {% if x is not null %} but evaluates it unpredictably for numeric values. To distinguish undefined / null / 0, precompute a boolean in the _data/*.js module (e.g., { stars, showStars: stars != null }) or accept a truthy guard. Why: PR #2596 — see same learning file.WITH fixtures AS (VALUES (<input>, <expected>), ...) SELECT input, expected, <sql-expr> AS actual, expected = <sql-expr> AS ok FROM fixtures query. The WHERE-clause idempotence guard (col <> <normalized-expr>) is necessary but not sufficient — it only catches drift on re-runs, not on first apply. Idempotence fixtures must include at least one repeated-suffix case per strip-class (.git.git, trailing //) so a \.git$ that should be (\.git)+$ is forced to fail. Why: PR #2817 — migration 031 had a P1 operator-precedence bug (.git stripped before trailing /) and a P2 non-idempotency bug (bar.git.git), both caught only at multi-agent review. See knowledge-base/project/learnings/best-practices/2026-04-22-ts-sql-normalizer-parity-when-shipping-backfill-migration.md.IMPORTANT: Always update the original plan document by checking off completed items. Use the Edit tool to change - [ ] to - [x] for each task you finish. This keeps the plan as a living document showing progress and ensures no checkboxes are left unchecked.
Incremental Commits
After completing each task, evaluate whether to create an incremental commit:
| Commit when... | Don't commit when... |
|---|---|
| Logical unit complete (model, service, component) | Small part of a larger unit |
| Tests pass + meaningful progress | Tests failing |
| About to switch contexts (backend → frontend) | Purely scaffolding with no behavior |
| About to attempt risky/uncertain changes | Would need a "WIP" commit message (exception: UX artifacts use wip: prefix) |
| UX specialist produces artifacts (wireframes, copy, brief) | Specialist is still generating (mid-output) |
| Domain leader review cycle completes (feedback applied) | Review feedback not yet incorporated |
| Brand guide alignment pass completes | Alignment still in progress |
core.bare=true repos), verify typecheck and tests pass manually, then use LEFTHOOK=0 git commit. Always check for stalled lefthook processes (pgrep -fa lefthook) before retrying.LEFTHOOK=0 also bypasses the c4-model-regenerate pre-commit hook. If the diff edits a .c4 file, run bash "${CLAUDE_PLUGIN_ROOT}/scripts/render-c4-model.sh" and stage the updated model.likec4.json BEFORE the LEFTHOOK=0 commit — otherwise c4-model-freshness.test.sh reds — a *.c4 edge is declared for it in scripts/lib/test-affected-paths.sh, so the Phase 2 affected gate selects it whenever the diff touches a *.c4 file; if you must check by hand it is in the scripts group. c4-render.test.ts/c4-code-syntax.test.ts do NOT check the committed artifact. Why: #6549 — a model.c4 edit committed under LEFTHOOK=0 shipped a stale model.likec4.json.git mv old new, never git add old (the pre-rename path) — the stale pathspec exits fatal pathspec 'old' did not match and ABORTS the entire git add, silently dropping every other path, so the commit captures only the rename (0 insertions). Stage the NEW path (or git add -A <dir>) and verify git show --stat HEAD shows the full expected file set before trusting the commit; a rename-only stat on a content change is the tell. Why: #6448 — a git add …/docker-daemon.json after renaming it to .tmpl produced a rename-only first commit; fixed by --amend.git commit -m "…" — bash command-substitutes them and the text is silently EATEN. The same trap has two more homes, and one of them is silent. (a) A backtick inside a double-quoted BASH ARRAY ELEMENT is substituted the same way — "path | reason <backtick>x.md<backtick> ..." made a guard exit 127 with x.md: No such file or directory, which at least fails loudly. (b) A backtick inside an unquoted heredoc (<<PY, reached for whenever a shell variable must be interpolated into a Python/awk script) is substituted before the interpreter ever sees the file, so a backticked path inside a STRING LITERAL vanishes and leaves a sentence with a hole in it — measured, it ate a filename out of a GitHub issue body and nothing failed. Use <<'PY' and pass values through the environment (export X=… / os.environ["X"]); markdown backticks are safe in markdown and unsafe in every shell-quoted context that carries them. The message is double-quoted, so every `…` span runs as a command and is replaced by its stdout (usually empty). The commit still succeeds, the shell prints an unrelated-looking command not found you skim past, and the log carries a sentence with a hole in it — which is worse than a garbled one, because the remaining prose still reads as complete. Measured: three spans (`before`, `declare -F plan_gate_assert_readable`, `grep -L …`) vanished from a commit whose whole subject was that command's vacuity. Use --file <path> (Write the body first) or a quoted heredoc (git commit -F - <<'EOF' — note the quoted 'EOF', which is what disables substitution); verify with git log -1 --format=%B | grep '`'. Same class as the sed replacement & trap: & expands to the whole match, so an unescaped & in a sed replacement silently duplicates the matched text. Why: #7035.Allowlist-Widened-By:, Signed-off-by:, Reviewed-by:, etc. — anything downstream parses via git log --format='%(trailers:key=NAME,valueonly)'), keep the FINAL paragraph as a pure contiguous block of Token: value lines. Two silent-drop shapes: (a) blank line between the new trailer and Co-Authored-By: makes the former part of the body, not a trailer; (b) ANY non-key:value line in the final paragraph (e.g., Closes #3877., Refs #3874 (precedent).) invalidates the WHOLE block — both legitimate trailer lines below it drop silently. Put Closes/Refs/Fixes in mid-body prose; GitHub auto-close still works anywhere in the body. Verify locally with git interpret-trailers --parse < <(git log -1 --format=%B) — empty output for a trailer that should exist is a hard fail. See knowledge-base/project/learnings/2026-05-16-git-trailer-parser-requires-contiguous-key-value-block.md.Heuristic: "Can I write a commit message that describes a complete, valuable change? If yes, commit. If the message would be 'WIP' or 'partial X', wait."
git checkout — and the fix it tests must be COMMITTED first. git checkout -- <file> restores to HEAD, which is a different thing from "what I had a moment ago" in exactly the situation a battery runs in: a fix in flight. Measured: a P0 battery restored that way against an UNCOMMITTED fix, so row 1 reverted the fix and every later row scored the DEFECT against itself — two rows reported SURVIVED while measuring a file that no longer contained the thing under test. The only thing that caught it was the battery's own diff pristine vs SUT restore check at the end, which most batteries omit. Add that check, cp a pristine copy before row 1, and commit the unit before mutating it. Why: #7104 PR-B. See knowledge-base/project/learnings/2026-08-19-my-battery-reverted-the-fix-it-was-testing.md.\" before """ raised
SyntaxError, and the suite reported 37/37 PASS exactly as it had before — the only tell was
an assertion count that did not move. After ANY scripted multi-edit, assert the ARTIFACT
changed (grep the new anchor, or diff against a pre-edit copy); never infer that an edit
landed from a passing suite, which answers "does the tree pass", never "did my edit apply".assert old in s) RAISES before the write, so the
tree is untouched and the NEXT measurement returns the baseline — which is the reassuring
answer. The guard is correct and its failure mode is the same shape it guards against, one
level up: a drifted anchor or a literal retyped rather than copied aborts the heredoc, nothing
is written, and any mutation row, lint or suite run afterwards measures the UNCHANGED artifact
and reports exactly what a working fix would report. Measured: four mutation rows scored an
unmutated rule this way, all four returning the verdict that said "fine". Print the changed
line back (print([l for l in open(p) if l.startswith("X=")][0])) rather than trusting the
batch's own success message, and treat any post-edit result identical to the pre-edit baseline
as UN-RUN rather than as evidence. Cheapest structural form: git status --short <file> — a
file absent from that listing did not change, whatever the script printed.PATH. PATH=/nonexistent
removes cat, sed and every other external the fallback itself needs, so the fallback under
test could not have run either and the empty output proves nothing about it. Put a stub that
exit 127s on a scratch dir at the FRONT of the real PATH. Why: #6488 — a column-absence
proof "passed" against a condition that had disabled the remedy along with the tool.worktree-manager.sh carries a "Syncing on-disk files from git HEAD" pass that restores tracked files to HEAD, and .claude/hooks/guardrails.sh can invoke it mid-session; anything verified-but-uncommitted is silently lost. Never hold verified work in the working tree across a long-running background job (a full test-all, a review agent), and treat the worktree as immutable while that job is active — defer doc, ledger, and learning edits until its owning session exits. Where an edit must be followed by a commit, do BOTH IN ONE Bash call (cat > file <<'EOF' … EOF; git add …; git commit) so no window exists. Corollary: a reconciliation script that silently no-ops on a missing anchor (python str.replace, sed s///) will print success against a reverted file — assert the anchor (assert old in s) or the edit is unverified. Why: #6578 — two full re-applications of verified work; the revert was caught only because a re-run printed numbers that contradicted a result verified minutes earlier.UX artifact heuristic: "Did a specialist just produce or revise artifacts? If yes, commit with wip: UX <description> for feat-X. UX artifacts are high-effort and low-recoverability -- err on the side of committing too often rather than too rarely."
The wip: prefix is intentional -- UX artifacts are valuable at every revision stage, and WIP commits are squashed on merge with no impact on final git history. Do not run compound before UX WIP commits -- compound runs once in Phase 4.
Compound-before-commit scope: AGENTS.md Workflow Gates says "Before every commit, run compound." Within this skill, that rule applies to the final Phase 4 commit (the one that closes the feature), not to Phase 2 incremental commits. Running compound per incremental commit is recursive (compound creates commits) and defeats the point of incremental checkpoints. A single compound at Phase 4 covers the whole feature's session-error inventory and learnings.
Commit workflow:
# 1. Verify tests pass (use project's test command)
# Examples: bin/rails test, npm test, pytest, go test, etc.
# 2. Stage only files related to this logical unit (not `git add .`)
git add <files related to this logical unit>
# 2b. Commit-on-main backstop (Soleur Cloud Mode, FR5): PreToolUse hooks do
# not fire in cloud sessions, so the hook's block-commit-on-main arm is
# absent there. Run the canonical check directly — a no-op locally where the
# hook already guards, load-bearing in cloud.
#
# Resolve the plugin ROOT by IDENTITY and name the script relative to it,
# never by the script's own basename (#8402): a basename search accepts any
# directory under the cache holding a file with that name and then EXECUTES
# it. The identity preflight is a shape check, not authentication — a planted
# `{"name":"soleur"}` manifest passes it (ADR-179 A11).
GUARD="${CLAUDE_PLUGIN_ROOT}/scripts/precommit-guard.sh"
# Arm 2, mirroring go.md's arm order. Grok Build addresses the plugin by GROK_PLUGIN_ROOT
# (lib/agent-registry.ts), and omitting it made this ladder fall through to `exit 1` on a
# Grok box with a perfectly good plugin root — turning a fail-open into a hard stop for the
# one harness that cannot satisfy arm 1.
[ -f "$GUARD" ] || GUARD="${GROK_PLUGIN_ROOT:-}/scripts/precommit-guard.sh"
if [ ! -f "$GUARD" ]; then
GUARD=""
for d in "$HOME/.local/share/devin/cli/plugins/cache" "${SOLEUR_DEVIN_CACHE_OPT:-/opt/.devin/plugins}"; do
[ -d "$d" ] || continue
MANIFEST="$(find "$d" -path '*/.claude-plugin/plugin.json' \
-exec grep -l '"name"[[:space:]]*:[[:space:]]*"soleur"' {} + 2>/dev/null | head -1)"
[ -n "$MANIFEST" ] || continue
GUARD="${MANIFEST%/.claude-plugin/plugin.json}/scripts/precommit-guard.sh"
[ -f "$GUARD" ] && break
GUARD=""
done
fi
# BOTH arms must block, and before #8402 NEITHER did. The old form was
# `[ -n "$GUARD" ] && bash "$GUARD" …` followed by an UNCONDITIONAL
# `git commit` — no `&&`, no `|| exit`, no `if` — so an unresolved guard fell
# through to the commit, AND a guard that resolved and REFUSED fell through to
# the same commit. In a cloud session this is the only commit-on-main
# protection that exists, which made it the opposite of a backstop.
#
# stdout, not stderr: stderr is invisible under `claude --bg`, and a backstop
# that cannot resolve itself must say so where the operator will see it.
if [ -z "$GUARD" ]; then
# The block's own justification is "hooks do not fire in cloud". LOCALLY the PreToolUse
# hook is present and already blocks a commit to main, so a hard stop there would block a
# commit that previously succeeded without buying any protection. Refuse in cloud, warn
# locally — and say which, so the operator is not left guessing.
echo "SOLEUR_PRECOMMIT_GUARD_HALT reason=no-soleur-root-in-plugin-cache"
case "${SOLEUR_SESSION_CLASS:-unknown}" in
not-local*) exit 1 ;;
*) echo "[warn] proceeding: the PreToolUse hook guards commits on a local session" ;;
esac
else
# `else`, not a fall-through. The first draft ran this line unconditionally after the
# warn above, so on a LOCAL session with no resolvable guard it printed "proceeding" and
# then executed `bash ""` — `No such file or directory`, `|| exit 1` — and the commit was
# never reached. The comment said warn-and-proceed; the code halted. Found by DRY-RUNNING
# the block in both session classes rather than reading it (qa/SKILL.md, #8288 class).
bash "$GUARD" "git commit -m \"feat(scope): description of this unit\"" || exit 1
fi
# 3. Commit with conventional message. Reachable through a guard that resolved AND
# passed, or — locally only, where the PreToolUse hook is the real gate — through the
# warned no-guard arm. In cloud the no-guard arm exits above and never gets here.
git commit -m "feat(scope): description of this unit"
Handling merge conflicts: If conflicts arise during rebasing or merging, resolve them immediately. Incremental commits make conflict resolution easier since each commit is small and focused.
Note: Incremental commits use clean conventional messages without attribution footers. The final Phase 4 commit/PR includes the full attribution.
Follow Existing Patterns
- [ ] → - [x], and never append to a markdown table row past its closing pipe. Two write-time foot-guns that both convert unverified work into work that reads as verified. (a) A bulk checkbox replace marks every AC "verified" at once with zero verification performed; run each AC's command and let the output decide (in #6781 a bulk toggle marked 15 ACs done and AC13 was then measured FALSE). This is the session-state.md decisions-are-intent rule applied to your own artifact in the same session. (b) Appending prose after a table row's trailing | creates a cell beyond the header count, and GFM discards it — so the text survives in raw markdown, passes any grep-based AC, and renders as though the edit never happened. That shipped an Article 30 statutory-register amendment that displayed as unamended. Cheapest gate after any table-row edit: awk '{n=gsub(/\|/,"|"); print NR, n}' <file> and compare the row's pipe count against a sibling row. See knowledge-base/project/learnings/2026-07-21-the-guard-i-shipped-could-never-have-fired-and-my-fake-certified-it.md.ls + grep the app's canonical lib/ directory (e.g., apps/web-platform/lib/) for equivalents. Canonical helpers are often single-purpose small files named by verb (relative-time.ts, format-currency.ts); typecheck and tests will not catch duplicated logic. See knowledge-base/project/learnings/2026-04-17-grep-lib-before-writing-format-helpers.md.acquire_conversation_slot (029) is a concurrency slot, so its DELETE-on-release is correct there but silently breaks a fencing-token contract (the next acquire resets lease_generation to the column default → the git-data reject gen < max fence inverts into a write outage). The fix lives at the lock service, never the resource server; route the data-model fork to the soleur:engineering:cto agent. tsc + the precedent-cloned ACs pass green — only soleur:engineering:review:architecture-strategist, prompted with the downstream contract (the ADR), catches it. Why: #5274 PR A — DELETE-on-release vs ADR-068 §3 monotonic-max; CTO ruled tombstone-on-release. See knowledge-base/project/learnings/best-practices/2026-06-30-precedent-mirror-for-new-role-breaks-fencing-token-monotonicity.md.git grep the corrected path's basename across the diff scope and fix EVERY secondary citation in the same edit cycle. The plan often appears as an authoritative path source in multiple secondary artifacts (Article 30 register entries, runbooks, ADRs, README references); fixing only the primary landing site leaves a silent drift the reviewer must catch. The plan is authoritative for intent, never for paths (hr-when-a-plan-specifies-relative-paths-e-g). Why: PR #4287 — plan §6.2 named knowledge-base/engineering/runbooks/cron-retention-monitor.md; runbook landed at the correct engineering/operations/runbooks/... but the PA-20 Article 30 entry cited the plan's wrong path; caught at multi-agent review by soleur:engineering:research:git-history-analyzer. See knowledge-base/project/learnings/2026-05-22-or-semantics-allowlist-inverse-lint-and-keyset-cursor-tiebreak.md.…web-2 plus a dedicated git-data host. Stored workspace git data sits on a LUKS-encrypted volume…) the tail reads as a claim about that host; unbound it reads as a claim about the live substrate. Litmus: after removing X from "…A, B, and X. X does P, Q, R." — ask what does "does P" now attach to? If the answer changed, you rewrote a claim you never meant to touch. Verify mechanically (per-file clause counts byte-identical to main), never by eye. Prose sibling of cq-ref-removal-sweep-cleanup-closures. Why: #6538/PR #6568 — removing a never-provisioned git-data host left its LUKS encryption-at-rest clause dangling onto hcloud_volume.workspaces (plain ext4), converting a scoped falsehood into a live false Art. 32 claim on the published privacy policy; 4 review agents converged, the edit cycle never saw it. See knowledge-base/project/learnings/2026-07-16-removing-a-false-claim-can-strengthen-the-false-claim-that-leaned-on-it.md.grep -E '176\.11|595\.82|92\.81') misses the same quantities written as rounded prose (~$176/mo, 4 paying users, ~93%) — and rounded prose is where outward-facing summary sections live, so the miss lands on the highest-consequence text. Enumerate the derived figures first (subtotal → each break-even → each margin → each rounded restatement), then grep per figure. Same root as cq-assert-anchor-not-bare-token. Why: #6538 — a "clean" sweep left §6 Pricing Gate asserting the exact ~93% framing §5 retired one screen above.knowledge-base/legal/tc-version-bump-policy.md) that pre-decide the option space; presenting a forbidden option gets it chosen, then retracted. Why: #6538 — offered "repin SHA, no TC_VERSION bump" for a T&C edit; the CLO-signed rubric makes Tier 3 (no bump) typos/whitespace/markdown only and Tier 2 clarifying BUMP REQUIRED, tie-break "if unsure, treat as clarifying". The operator's real intent (no forced re-acceptance) was served by not editing the T&C at all.path.md:N/:N-M line-number citation pointing INTO that doc (from the plan, tasks.md, PIR, ADRs, sibling runbooks — including files this PR isn't "about") goes stale below the edit point. After the insertion, grep -rn '<doc-basename>:[0-9]' knowledge-base/ and fix every hit in the SAME edit cycle; for churn-prone targets, prefer an insertion-stable section/anchor reference over a bare line range. tsc/tests are blind to prose offsets — review catches it as a P2 round-trip. Why: #5548 — a 10-line runbook §A callout shifted :71-74→:81-84 and :126→:132 across plan/tasks/PIR; caught by pattern-recognition + code-quality. See knowledge-base/project/learnings/best-practices/2026-06-18-doc-insertion-stales-cross-artifact-line-citations.md.hr-when-a-plan-specifies-relative-paths-e-g: plan is authoritative for intent, never completeness. For terraform show -json captures, always prepend del(.variables) regardless of the plan's prescribed filter — terraform-show-json embeds plan-input variables verbatim including sensitive=true declarations (sensitive masks render-time text output, NOT JSON serialization). After redaction, run a mandatory canonical scan: ! grep -qE 'BEGIN [A-Z ]*PRIVATE KEY|ghp_[A-Za-z0-9._~+/=-]{20,}|gho_[A-Za-z0-9._~+/=-]{20,}|ghu_[A-Za-z0-9._~+/=-]{20,}|ghs_[A-Za-z0-9._~+/=-]{20,}|ghr_[A-Za-z0-9._~+/=-]{20,}|github_pat_[A-Za-z0-9._~+/=-]{20,}|sk-ant-api03-[A-Za-z0-9_-]{20,}|sk_(test|live)_[A-Za-z0-9]{20,}|sbp_[A-Za-z0-9]{20,}|xoxb-[A-Za-z0-9-]{20,}|AKIA[0-9A-Z]{16}|dp\.(pt|st|sa|ct)\.[A-Za-z0-9_-]{40,}' <fixture> ; it must return rc=1. A token-prefix-only scan (the plan's typical no token values, no actor IDs framing) misses PEM headers. Why: PR #4420 — the captured-real fixture initially shipped with the full GitHub App RSA private key embedded under .variables.github_app_private_key.value; caught at post-implementation multi-agent review by soleur:engineering:review:security-sentinel AFTER 9 other agents had read the file. Full incident post-mortem at knowledge-base/project/learnings/security-issues/2026-05-25-terraform-show-json-leaks-sensitive-variables-into-fixtures.md. Backstop: PreToolUse hook git-commit-secret-scan.sh runs gitleaks on the staged index at every git commit regardless of .git/hooks/pre-commit installation state.apps/web-platform/test/helpers/mock-supabase.ts) to confirm it covers every operator the code under test uses. If not, extend it at the START of Phase 2, not after the first cryptic test failure..select(`…`) against an UNTYPED client, neither tsc nor a select-arg-discarding mock catches a non-existent column — it ships green and errors with Postgres 42703 at runtime (silently returns []). Add an arg-capturing select-string test (capture chain.select.mock.calls[i][0], assert no auth.users-only column like raw_user_meta_data) AND/OR an opt-in *.integration.test.ts vs dev. The embed FK target users resolves to public.users, NOT auth.users. See knowledge-base/project/learnings/2026-06-01-untyped-supabase-select-nonexistent-column-ships-green.md (#4715/#4713)..update()/.delete().eq(...) returns NO error when the WHERE matches 0 rows — a write whose success path returns 200 WITHOUT reading back what it wrote silently no-ops (the active id has no row / a stale resolved-id). Append .select("id") and assert data.length === 1 (!== 1, not < 1) → fail loud + distinct Sentry breadcrumb instead of a false success. A sound robustness guard — but do NOT assume a 0-rows no-op is the cause of a "didn't persist"-shaped bug without a live read proving the row is actually absent (see the cautionary case below). Mirrors .update().select() precedents in account-delete.ts/ws-handler.ts. See knowledge-base/project/learnings/bug-fixes/2026-06-08-supabase-update-eq-zero-rows-silent-noop-and-code-trace-repro.md.<img>/<script>/<link>) to a SIGNED STORAGE URL must emit it on a host present in the matching CSP fetch directive. createServiceClient signs against SUPABASE_URL (raw <ref>.supabase.co), but CSP img-src is built from NEXT_PUBLIC_SUPABASE_URL (the public custom domain) — so the redirect target is silently CSP-blocked in the browser (onError → fallback) while server-side curl succeeds (no CSP). Rewrite the signed URL's origin to NEXT_PUBLIC_SUPABASE_URL before redirecting; grep createSignedUrl whose result reaches the browser and confirm its host is in the CSP directive. Why: #4996→#5012 — workspace logo persisted + served 200 but never displayed; the 302 host was absent from img-src. See knowledge-base/project/learnings/bug-fixes/2026-06-08-supabase-update-eq-zero-rows-silent-noop-and-code-trace-repro.md.apps/web-platform/server/conversation-writer.ts) with a new chained method (.eq, .select, .in, .maybeSingle, etc.), grep apps/web-platform/test/ for every supabase mock chain — both shared helpers (test/helpers/*-mocks.ts) AND inline vi.mock("@supabase/supabase-js", ...) setups — and extend each one in the same edit cycle. tsc is silent on chain-shape drift; only the full vitest suite catches it. Recursive-by-default mock chains (every chained call returns the same chain object) survive future extensions transparently. Same class as cq-raf-batching-sweep-test-helpers and cq-preflight-fetch-sweep-test-mocks but for the data-layer fluent API. See knowledge-base/project/learnings/best-practices/2026-04-27-wrapper-extension-test-mock-chain-sweep.md.use-conversations repo scope moved from users.repo_url to fetch("/api/workspace/active-repo")), the test blast radius is {tests importing the hook} − {tests that vi.mock the hook away}. Derive it via git grep -l '<hookName>' apps/web-platform/test/ minus the vi.mock("@/hooks/<hook>" set, and stub the NEW source in every one. Never name-filter that list by topic — page-level renderers (command-center.test.tsx, start-fresh-onboarding.test.tsx) render the real hook without the feature word in their filename, so a topical grep silently drops them and they fail only once their whole shard runs — which, since #7352, is at the soleur:ship Phase 4 full-battery checkpoint rather than at the Phase 2 exit. Derive the list from the import graph, not from filenames. Why: PR #5317. See knowledge-base/project/learnings/best-practices/2026-06-15-hook-source-swap-sweep-all-real-hook-renderers-not-name-filtered.md..on() registration to a Supabase Realtime channel chain (e.g. adding an event: "INSERT" handler beside an existing "UPDATE"), every test whose channel mock returns a non-chainable subscribe-only stub from .on() (vi.fn().mockReturnValue({ subscribe })) breaks with on is not a function. Same blast radius as the .from()-chain sweep above, for the realtime channel API: git grep -l '<hookName>' apps/web-platform/test/ minus the vi.mock("@/hooks/<hook>") set, and make each channel mock chainable (.on() returns the channel object) in the same edit cycle. tsc is silent; only the full vitest suite catches it. Relatedly, a new realtime event handler that maintains a client list must scope-guard on the SAME columns the list query filters on (a subset surfaces rows the refetch drops). Why: PR #5391. See knowledge-base/project/learnings/best-practices/2026-06-16-realtime-event-guard-must-equal-fetch-query-scope.md.users → workspaces + service-role resolveActiveWorkspaceKbRoot), the migration is NOT done until git grep <oldResolver> returns 0 — WRITE routes (kb/share, kb/upload) are consumers too and are easy to miss because the READ routes already "work." An unmigrated write route keeps the old resolver's divergent failure surface (here: a tenant-scoped read of stale users.workspace_status → silent 503), and if that route has un-mirrored failure branches the divergence is invisible until a user hits it. Pair the consumer-sweep with an observability pass over the unmigrated route's silent returns (mirror each to Sentry with reason=<code>) BEFORE/with the swap so the fix is confirmed, not assumed; and when the new resolver returns an id that downstream code reuses, thread the ONE resolved id through all sites (a second independent resolve re-introduces divergence). Why: PR #4953 — share/upload left on resolveUserKbRoot after ADR-044. See knowledge-base/project/learnings/best-practices/2026-06-05-adr-resolver-migration-must-sweep-write-routes-not-just-read-routes.md.createPrivateKey, a JWT, a config blob) that runs BEFORE a mocked constructor/boundary, sweep every test that stubs that input — not just the test for the file you edited. Mocking the downstream SDK (vi.mock("@octokit/app")) no longer shields tests from malformed placeholder fixtures once real parsing runs first; bogus stub keys ("…BEGIN RSA PRIVATE KEY…\nfake\n…") start throwing at parse time. Grep git grep -lE '<ENV_OR_FIXTURE_NAME>' -- 'test/**', and for each hit decide whether it exercises the REAL factory (replace the stub with a synthesized real value via generateKeyPairSync, per cq-test-fixtures-synthesized-only) or mocks the factory wholesale (fixture irrelevant — no change). See knowledge-base/project/learnings/2026-05-29-credential-parsing-before-mocked-sdk-breaks-stub-key-fixtures.md. Redundant mutations mask trigger regressions — production signup silently breaks while the test keeps passing. Turn the setup step into a canary: read the row the trigger should have created, assert it exists. See knowledge-base/project/learnings/security-issues/2026-04-18-rls-for-all-using-applies-to-writes.md.setState updater — advertises purity the call site doesn't honor and recreates the StrictMode/concurrent-rendering hazard the extraction was meant to eliminate. See knowledge-base/project/learnings/best-practices/2026-04-14-pure-reducer-extraction-requires-companion-state-migration.md.async body out of a useEffect into a useCallback/helper for reuse, carry the effect's CLEANUP-scoped state with it (cancellation flag, AbortController, interval/timeout/subscription teardown). The lift looks mechanical but strips the callback of the effect lifecycle — a stale fetch can resolve after the precondition changed and clobber newer state. Restore via a liveness predicate the caller owns (the effect passes () => active and flips it on cleanup; synchronous callers default to always-current). tsc + happy-path tests pass; only a stale-response test or multi-agent review catches it. Why: PR #4947 — checkShare extraction in share-popover.tsx dropped the cancelled guard. See knowledge-base/project/learnings/best-practices/2026-06-04-extracting-fetch-effect-to-usecallback-drops-cancellation-guard.md.export const NAME = ... binding to a new module and re-exporting from the source, grep the source file for internal NAME references and add a sibling import { NAME } from "./new-module" — the re-export alone does NOT put NAME back in local scope. tsc --noEmit flags this as TS2304 but ESM-friendly bundlers may silently swap in undefined. Same class as cq-ref-removal-sweep-cleanup-closures but for module-level bindings. Why: #2653 — see knowledge-base/project/learnings/2026-04-19-enoent-on-optional-mount-should-not-alarm.md session errors.await import() becomes eager. Importing a heavy module just for one symbol (an error class for instanceof, a constant) drags its module-init side effects (top-level createChildLogger, promisify(execFile), client construction) into every consumer's test-collection graph and crashes sibling tests with incomplete mocks. Use import type + duck-type (err.name === "ByokLeaseError" && err.cause === "escape") or a lazy thunk. ALSO: a new server/** file importing createServiceClient must be added to .service-role-allowlist in the same commit, and you MUST run the EXISTING tests that exercise the extracted code path (vitest run test/<donor>-*.test.ts) — the new file's own test + tsc passing is not sufficient. Since #7352 the Phase 2 exit runs only your touched shards, so run the donor's existing suites yourself — do not wait for the merge gate to find it. Why: PR #5409 — auto-sync-trigger.ts extraction pulled byok-lease's static graph into /api/repo/setup and missed the allowlist. See knowledge-base/project/learnings/best-practices/2026-06-16-extracting-helper-from-route-pulls-heavy-static-graph-and-misses-existing-tests.md.reportSilentFallback runs in an environment where the "error" path is a known degraded state (e.g., readdir on an optional mount that doesn't exist in dev/CI), filter the error code before paging. ENOENT on a configured-but-optional path is not a silent fallback — it's a documented zero, and routing it through Sentry exposes every request to any bug in the alarm pipeline itself. Only page on truly unexpected errors (EACCES, I/O, pathological). Why: #2653 — same learning file.{{ site.url }}<path> interpolations from the source, build the site and grep rendered output for host-letter concatenation artifacts. {{ site.url }} + path-without-leading-slash produces https://soleur.aiblog/... when site.url has no trailing slash — Eleventy emits it without warning; source-grep cannot detect it (the source diff is plausibly "consistent with the original"). Cheapest gate: grep -oE "https://${HOST}[a-zA-Z]" _site/<page>/index.html — every hit is broken. Why: #2705 — see knowledge-base/project/learnings/best-practices/2026-04-21-eleventy-site-url-concatenation-broken-without-leading-slash.md."use client" component or a lib/ module reachable from client code, never import from @/server/observability or any @/server/* module that transitively pulls pino. next.config.ts serverExternalPackages only externalizes for the server chunk; pino will bundle into the browser. Use @/lib/client-observability (a thin @sentry/nextjs-only shim) or add a new shim with the same signature. Verify with grep -rn "@/server" <new-or-edited-file>. Why: PR #2860 — see knowledge-base/project/learnings/2026-04-23-render-time-scrub-sentinels-and-client-bundle-boundaries.md.PRESERVED_N, __TOKEN_N__) are a substitution oracle — assistant-controlled prose containing the literal splices in stashed content, and ?? "" fallback silently deletes the literal. Pattern: SOLEUR_PRES_${8hexchars}_${i}. Why: PR #2860 — same learning file.undefined or -Infinity, never 0. Combined with vi.useFakeTimers({ now: 0 }), a 0 default produces Date.now() - 0 >= threshold = false on the first fire, starving the very path the debounce was supposed to time. Use if (last === undefined || now - last >= THRESHOLD_MS). Why: same learning file, session error #3.package-lock.json — the single lockfile of record since ADR-191 — via npx --yes npm@11 update <pkg>, and validate with npm ci --ignore-scripts. This repo no longer carries bun.lock; do not recreate it. The banned-command rule survives the change and still applies to any bun-based repo: never bun update <pkg> (elevates the target to a direct dep) or bare bun update (bumps every direct caret-ranged dep). See work-lockfile-bumps.md. Why: PR #3488 — three failed bun invocations rediscovered the constraint at task time.*_DIRS/*_PATHS/*_GLOBS) does NOT include the new file's directory, extract the call site into the existing scope — do NOT widen the walk. The guard encodes an architectural convention ("auth verbs live in app/(auth) + components/auth/", "CSRF coverage applies to app/api/", etc.). Widening the array to absorb one new call site (e.g., adding app/(dashboard) because a single (dashboard)/layout.tsx calls signOut) inverts the convention into "any file in this whole route group that happens to call the verb must carry the guard's tags." The shortest path leaves a worse architecture. Refactor to a hook/util living in the existing scope (components/auth/use-sign-out.ts) so the guard's directional rule is preserved. Why: PR #3576 — see knowledge-base/project/learnings/2026-05-11-drift-guard-scoping-extract-call-site-not-widen-walk.md.CREATE OR REPLACE with a new parameter list) over DROP FUNCTION + CREATE. Postgres distinguishes overloads by parameter list; supabase-js sends named-arg PostgREST envelopes that route to whichever overload matches by parameter name. Overloading is rolling-deploy-safe: (a) prd-schema-without-app keeps the v1 signature alive for old pods; (b) prd-app-without-schema keeps writes succeeding because the v1 signature still exists. DROP+CREATE creates a window where one direction silently zeros the write path. Drop the v1 in a follow-up migration after the old build ages out. Why: PR #3626 — see knowledge-base/project/learnings/2026-05-12-stub-handlers-as-silent-undercount-vectors.md.apps/web-platform/supabase/verify/NNN_*.sql runtime sentinel, carry the verify sentinel forward in the SAME PR. The migration-shape regex test asserts the GRANT text exists but cannot catch a live GRANT mismatch post-apply (2026-05-06-tenant-jwt-rpc-grant-mismatch-vitest-blind.md); the verify/ sentinel (run by CI's verify-migrations job via has_function_privilege('authenticated', …) = false) is the only runtime guard for the privilege-escalation class. Cheapest gate: ls apps/web-platform/supabase/verify/<precedent-NNN>_*.sql when copying the precedent — if present, author the sibling verify/<new-NNN>_*.sql alongside the migration. Why: PR #4768 (#4765) — verify/092 was forgotten at work-time and caught by soleur:engineering:review:pattern-recognition-specialist at review; see knowledge-base/project/learnings/security-issues/2026-06-01-caller-override-rpc-needs-service-role-only-grant.md.Error("handler not yet wired: <name>") until the wiring lands, OR fan out to an instrumentation counter so a "stub still present" alert can fire. Why: same PR #3626 — cc-dispatcher.ts:1202 onResult shipped as a no-op for 3 weeks (originally added 2026-04-24 #2858), under-counting API cost by 60-90% for every cc-soleur-go conversation while the legacy path's wiring made the surface look complete.from("messages").insert(...) (or equivalent persist) and the reference has multiple, the asymmetry will land as a UI bug downstream via the resume hydration code (api-messages.ts → reducer state → isClassifying-style gates). Cheapest gate at work time: grep -n "saveMessage\|messages.*insert" <new-path> + grep -n "saveMessage" <reference-path>. Role-count parity must match or the divergence must be documented with rationale. Why: PR #3286 — cc-dispatcher persisted only the user role; agent-runner.ts:1079 persisted both; the gap surfaced as a "Continue thread" routing-chip regression that PR #3251 made visible. See knowledge-base/project/learnings/integration-issues/2026-05-05-cc-dispatcher-assistant-persistence-asymmetry.md.sendUserMessage → dispatchToLeaders) AND cc-soleur-go (dispatchSoleurGoForConversation), which breaks before sendUserMessage and NEVER calls registerSession. Any state normally populated by registerSession (e.g. a userId→conversationId binding) must be set explicitly on the cc path. Cheapest gate: grep -n "<your new hook>\|resetTurn\|registerSession" apps/web-platform/server/*.ts and confirm a call on BOTH lineages — cc-soleur-go is the dominant production path (#3270), so wiring only the legacy path silently breaks the feature for nearly all traffic with green CI. Why: PR #5290 (#5273) — streamReplayBuffer.resetTurn + the active-turn binding were wired only in sendUserMessage; cc gap-emitted frames were silently dropped (empty replay) until multi-agent review caught it. See knowledge-base/project/learnings/integration-issues/2026-06-14-ws-lifecycle-hook-must-cover-both-legacy-and-cc-soleur-go-turn-boundaries.md.Test Continuously
grep -E "(FAIL|ERROR|Test Files|Tests )" or | tail -30, never | tail -10 which discards failure names and forces a wasteful second run. Why: In PR #2430, | tail -10 discarded failing test names, requiring a full re-run just to identify which 2 of 1580 tests failed.bash -c does NOT inherit set -o pipefail, so bash <test-script> 2>&1 | tail -N reports tail's exit (always 0) and silently swallows the test runner's non-zero exit. For aggregate test scripts whose pass/fail signal is load-bearing (scripts/test-all.sh, bun test, pytest, go test ./...), prefer log="$(mktemp -d -t soleur-run.$$.XXXXXXXX)/log"; bash <script> > "$log" 2>&1; rc=$?; echo "EXIT=$rc LOG=$log" and inspect rc explicitly; only then tail or grep "$log" for context. Why: PR #4011 — a bash test-all.sh 2>&1 | tail -40 invocation reported exit 0 while the runner exited 1 (3 pre-existing failed suites); the false-pass nearly chained through to ship. See knowledge-base/project/learnings/2026-05-18-test-all-tail-masking-and-monitor-exit-condition-tightness.md §1.
echo that contains a command substitution — it reports the SUBSTITUTION's status. echo "$(basename "$t") EXIT=$?" runs basename while expanding the arguments, and that resets $?, so the line prints basename's exit code and not the suite's. Measured: a four-suite loop written that way reported EXIT=0 for all four while one was rc=1 from the author's own edit, and the only tell was a FAIL line in a log belonging to a suite just recorded as passing. Same family as the | tail masking above and as cmd | grep …; echo "rc=$?" (which reports grep's status and will happily hide a non-fast-forward git push). Capture into a variable on its own line — bash "$t" > "$log" 2>&1; rc=$? — before any expansion that can run a command, and prefer PIPESTATUS[0] when a pipeline is unavoidable.ASSERT THE VALUE THAT MUST NEVER APPEAR… above covers the suite's helpers, not the harness that parses their output). Strip ANSI first — sed -r 's/\x1B\[[0-9;]*[mGKHF]//g' — because vitest and most modern runners colour their summary line, so a grep/awk extraction anchored on plain text returns empty for EVERY row and each mutant then reads as killed-or-survived arbitrarily. Measured: #7826/#7834 — a 14-row battery came back uniformly empty, control included, and looked like a completed run; re-run ANSI-stripped it showed 14 surviving mutants.rc is the verdict, not the whole report — read the runner's PREAMBLE and EPILOGUE before calling it green. rc=0 answers "did every suite it ran pass?", never "did it run the suites that gate my diff?" nor "was this run trustworthy?". Non-zero is no longer one thing, either: test-all.sh exits 1 when >= 1 suite FAILED and 3 when zero suites failed and >= 1 suite terminated with a signal-shaped status (rendered [KILLED], plus a one-line breakdown immediately above the terminal marker) — UNRESOLVED, neither green nor red, because that suite's coverage was not obtained and the runner did not measure what terminated it. Never report rc=3 as a broken diff, and never report it as a pass; re-run that one suite in isolation instead. test-all.sh's own EXIT CONTRACT block is where that contract lives — including that 3 is top-level only, so a nested runner handing 3 back to run_suite classifies as a plain FAIL. Aggregate runners answer those two in prose the exit code cannot carry, and it sits at BOTH ends of the log: test-all.sh's preamble announces whether apps/web-platform/infra/ will be covered by this run and tc_preamble/tc_acquire fire the named LOW_TMP_HEADROOM / SIBLING_RUN_DETECTED / SIBLING_SUITE_DETECTED / LOCK_CONTENDED_PROCEEDING banners, while the tail carries the suite summary, tc_epilogue's scratch-leak NOTE, and a restatement of the coverage boundary. A tail -40 sees the second set and none of the first. So after reading rc, grep -nE 'NOTE:|NOTE \(|\[contention\] BANNER|LOCK_CONTENDED|^\[budget\]|^\[KILLED\] [^ ]+ \(exit=' "$log" (position-agnostic, catches both ends; the [contention] BANNER prefix is what makes the banner list above a description rather than a hard-coded set, so a newly added banner is caught without editing this grep; anchored on the emitter prefix so the contention suite's own [ok] … names the LOW_TMP_HEADROOM condition assertion lines are not mistaken for banners, and on LOCK_CONTENDED rather than LOCK_ so the happy-path LOCK_ACQUIRED line does not make "act on every hit" fire on every run) and READ every hit — since #7103 R5(a) the coverage NOTE has two polarities, so a hit is not automatically a warning: IS covered above means the infra runner ran as a nested suite and rc=0 accounts for it, while is NOT covered above (wrong TEST_GROUP, diff does not touch it, or SOLEUR_INCIDENT_SKIP=1) means rc=0 is evidence for less than the diff. A contention banner still means a RED may not be yours; a ^\[KILLED\] hit is the unresolved class described above, so re-run that suite alone rather than reading the summary as either colour. Why: #6969 — an infra diff was validated by the wrong runner behind a green summary that had already been qualified elsewhere in the same log.
unterminated code fence, could not parse, invalid YAML), which reads like a formatting nit and gets cleared reflexively — while the scan it was meant to perform never ran, so its silence on everything else is not a clean bill. Treat the post-fix re-run as a FIRST result, never as a confirmation of the one you already had. The tell is a gate whose failure names a property of the file's SHAPE rather than of its CONTENT. Why: #7640 — a Python splice across a fence boundary left a plan block unterminated; lint-infra-no-human-steps.py reported the fence and scanned nothing, and repairing it surfaced a real AC-level finding that had been invisible behind the "structural error" for the whole session.run: block with no shell: key runs under bash --noprofile --norc -eo pipefail {0} — -e is ON, and set -uo pipefail inside the block does NOT clear it. Two consequences that read as correct code and are not. (a) X="$(cmd)"; rc=$? is an ABORT, not a capture: the assignment's status is the command substitution's, so a non-zero cmd kills the step AT THAT LINE and every line below — the $GITHUB_OUTPUT write, the ::error::, the whole diagnosis — never runs. Use rc=0; X="$(cmd)" || rc=$?. The same applies to any unguarded X="$(… | grep …)": grep exits 1 on no match and pipefail promotes it, so a legitimately-empty result silently kills the step, typically between detecting a failure and REPORTING it. (b) Actions == is LOOSE: when operand types differ both cast to Number, so an UNSET step output is null, null == '0' is TRUE, and a step gated on outputs.exit_code == '0' fires on a producer that wrote nothing at all. Pair every numeric-literal gate with a non-numeric discriminator, and prefer !cancelled() to always() when the step mutates anything (always() is also true on cancellation). Corollary for the tests: a harness that extracts a run: block and executes it under a bare bash cannot observe ANY of this — run extracted blocks under bash --noprofile --norc -eo pipefail or the whole set -e class is structurally invisible to a green suite. Why: #7242 — a fix for "messages naming unmeasured causes" shipped three instances of it: the alarm's always() restoration was inert (the producer aborted before writing the outputs its conditions read), a new telemetry read silenced the bridge failure it existed to explain, and an auto-close fired on a crashed checker via the null == '0' coercion. All three were green through a 261/261 suite. See knowledge-base/project/learnings/2026-08-04-the-pr-that-fixed-unmeasured-claims-shipped-three-of-them.md.knowledge-base/ SKIPs in it, so prove the control non-vacuous), and every row then prints KILLED/SURVIVED against a red baseline; (b) assert each mutation LANDED against a pristine copy (md5sum before/after), because a mutation that does not land reports the BASELINE, which is indistinguishable from a pass — note sed with a | delimiter silently fails on patterns containing ||, and a hand-copied cp -r dir "$sb/" copies INTO an existing dir rather than over it, so row N re-runs row N-1's mutation (hence: allocator, never hand-copy); (c) give every search-based assertion a non-empty guard that ABORTS (assert hits, "INSTRUMENT FOUND NOTHING") — a zero-match search that prints a verdict is the worst outcome, and BRE \$ is a literal $ while an unescaped ( will not match a regex the SUT escapes. A search tool's non-zero exit is not one thing: git grep exits 1 on no matches and 128 on a BAD PATTERN, and since it defaults to BRE an escaped open-paren is a group, so an ERE-shaped literal is a fatal — a catch that returns [] for both converts a broken pattern into a clean sweep. Match literals with -F, and branch on the exit code rather than on truthiness (#7989: four SDK send sites sat outside a guard's window while it reported clean); (d) never take an exit code through a pipe. Artifacts: /var/tmp or the worktree, never /tmp (it reaps restore SOURCES and rc files too; tree copies: work-scratch-sandboxes.md). A monitor must test -s on an rc file, not -f: an empty rc is truncation, not a verdict. Why: #7795 — six instruments broke in one session and three printed confident verdicts from results that measured nothing; separately /tmp swept a battery's restore source (leaving a tracked file mutated) and later truncated a 374-suite log at exactly 114688 bytes while emptying its rc, and the second hit happened because the first fix was applied to the instance and not the class. See knowledge-base/project/learnings/2026-09-08-six-instruments-were-broken-and-three-printed-a-verdict-anyway.md.betterstack-query.sh implements --raw-only as
raw NOT LIKE '%SYSLOG_IDENTIFIER%', excluding EVERY journald row by construction; a probe
query carrying it returned 0 rows over 36h and 57 without it, and the conclusion drawn from
that zero ("this host does not deliver via its logger line") was written into a plan, a spec
and a commit message. Both positive controls run to "verify the instrument" carried the same
flag. See knowledge-base/project/learnings/2026-09-10-every-instrument-i-verified-was-verified-inside-its-own-blind-spot.md.mktemp, never a name derived from the script. A path built from the script name is a pure function of it, so every concurrent session writes the SAME file — and parallel worktrees are this repo's documented workflow. Observed 2026-07-15: a full-suite log was truncated mid-run by a sibling session and came back holding a DIFFERENT worktree's absolute paths; rc was still correct, but the log — the artifact you read to learn WHICH suite failed — was someone else's. Echo LOG=$log so the path is recoverable, and keep rc as the pass/fail signal: a clobbered log costs a re-run, but reading a SIBLING's green log and concluding your own run passed is the failure that ships. $$ is not a fix either (predictable across concurrent runs in shared shells — token-efficiency-report.sh:36-56 rejected it for the same reason). Use a workspace/git-dir-scoped path instead only when a LATER, separate Bash call must find the artifact by name..test.sh must default TMPDIR itself. A sandbox/fixture harness (mutation battery, golden-parity runner, anything that cps a pristine tree per case) that ignores its own cp/mkdir/mktemp exit code does not degrade into a missing result; it degrades into a CONFIDENT WRONG one — the next case runs against the PREVIOUS case's mutation and reports "the guard did not detect this", which is a verdict about the SUT produced by a harness that could not copy a file. Check every setup command and exit 2 on failure. The usual trigger is capacity (/tmp is a shared 4 GiB tmpfs): use the allocator in work-scratch-sandboxes.md, never hand-copy a tree, and export TMPDIR="${TMPDIR:-/var/tmp}" in any self-invoked .test.sh that builds a sandbox. Litmus for the flake: three runs of an UNCHANGED tree giving three DIFFERENT failure sets is a harness defect, never a re-run to repeat. Why: #7014 — at /tmp 94% full under 3 sibling runs the battery reported P6, then M29a/b/c, then clean; 4/4 green under identical conditions after both halves were fixed.cd <worktree-abs-path> && <cmd> in a single Bash call, or use absolute paths. CWD does persist between Bash calls, but relying on ambient CWD is fragile: any intervening call that cds elsewhere (a prior cd "$(mktemp -d)" && git clone ...) silently redirects everything after it to the wrong tree — and in this repo the bare repo root holds stale synced copies of tracked files, so the failure surfaces as wrong pass/fail counts that look like real regressions rather than a missing-file error. Why: PR #2683 bun test reported 1005/1 (baseline-state result) from bare root after a drifted CWD; worktree re-run was 1006/0. See knowledge-base/project/learnings/bug-fixes/2026-04-19-admin-ip-drift-misdiagnosed-as-fail2ban.md session errors.X | grep -q under pipefail (SIGPIPE → 141) used exactly that at 12 of its own assertion sites; on every NEGATIVE assertion (if ! calls | grep -q …) the 141 fails OPEN, so those cases and their mutation twins reported green while the property was violated — and the same shape in the undef() vacuity guard (whose sentinel is line 1, so the match is always early) let "must exit non-zero" cases pass against a script where the functions did not exist. Predicates must grep a FILE directly (grep -qE -- "$pat" "$CALLS") or use bash [[ == ]]; never a pipe. Two adjacent vacuity traps from the same session: a multi-MB fixture passed via env exceeds the argv limit (E2BIG) so the subshell dies BEFORE any precondition (pass large fixtures by file), and a stub ending in return 0 swallows the producer SIGPIPE its mutation exists to reproduce (return $?). Give every happy-path case a CASE_RC positive control — assertions that read a calls-file populated before an unrelated die pass without the function ever succeeding. Why: #6588 — the class was documented one day earlier and recurred in the file meant to pin it. See knowledge-base/project/learnings/2026-07-19-the-harness-broke-the-rule-it-enforced-and-the-canary-could-not-fail.md.set -euo pipefail accumulate-then-exit .test.sh (the pass()/fail()/fails convention), three foot-guns pass a naïve GREEN run and only bite on drift/edge inputs: (a) a deliberately-nonzero command (diff/grep/comm) inside a command substitution (x="$(diff <(…) <(…) | tr …)") makes set -e abort BEFORE fail() prints — wrap it … || true inside the $(...) and gate on [[ -z "$x" ]]; (b) a loop derived from a data source (registry/array/file via done < <(node …)) silently exit 0s with ZERO coverage on an empty/unreadable source — process-substitution failure escapes set -e, so add a minimum-cardinality guard (n=0; …; n=$((n+1)); …; [[ "$n" -lt 1 ]] && fail); (c) a verify-the-verifier negative that injects a CONSTANT guaranteed-absent tests the coreutil (diff(A+x,A)≠∅ is always true), not the gate — route real data through the production idiom and assert the injected token on the specific diff side. Mutation-test every drift class and confirm a CLEAR MESSAGE prints, not just exit 1. Why: PR #5721 (#5703) — all three surfaced authoring registry-completeness.test.sh; (a) caught by self-mutation-test (truncated log), (b)+(c) by multi-agent review. See knowledge-base/project/learnings/test-failures/2026-06-29-bash-accumulate-then-exit-gate-test-three-footguns.md.set -o pipefail gate, producer | grep -q PATTERN flakes to a FALSE NEGATIVE when the match is EARLY and the producer streams (sed from a strip_comments, or a printf of a >64 KB body): grep -q closes the pipe on first match, the producer takes SIGPIPE (141), and pipefail makes the pipeline exit non-zero even though grep matched — so && echo 1 is skipped. Invisible on the first green run and on append-mutations (match lands at EOF, no early close); only a holds pattern matching near the top flakes. Use a herestring (grep -Eq PATTERN <<<"$var" — no pipe) or grep -Ec ([ "$(… | grep -Ec PATTERN || true)" -gt 0 ] — reads all input), never grep -q on a pipe. Why: #6649 — workspaces-luks-header.test.sh H4/H11 passed then failed with no change. See knowledge-base/project/learnings/test-failures/2026-07-18-pipefail-grep-q-early-match-sigpipe-flakes-drift-guards.md.${BASH_SOURCE[0]} — and a FAIL-CLOSED source turns the omission into a whole-suite RED, not a skipped check. Sandbox harnesses cp the SUT to a temp dir, which silently breaks $(dirname "${BASH_SOURCE[0]}")/lib/…; a defensively-sourced lib degrades to stubs and hides it, a fail-closed one exits before the first assertion, so every arm then measures that guard firing rather than the thing under test. Grep BASH_SOURCE in the SUT and copy each resolved file into the sandbox. Companion: a probe of a helper that is SOURCED into a stricter shell must reproduce that shell's set options — x=$(cmd | awk …) is a PIPELINE whose status is awk's, and awk exits 0 on empty input, so the producer's failure is invisible without pipefail; without it the "degrades, never aborts" mutation is EQUIVALENT and the arm passes over it. Why: #7441 — a mid-review rebase added a third relocator and left the branch at 39/31 in an untouched suite; and a df-failure arm passed over its own fix until the probe ran under set -o pipefail.grep resolves to a ugrep shim shell function whose -q DRAINS its input — the producer never blocks, so the race cannot occur and it measures 0/N at every size. That is not evidence of absence; it is the instrument removing the phenomenon. Run race probes under env -i PATH=/usr/bin:/bin bash --noprofile --norc, assert type -t grep is file, and include something that MUST fail (yes | grep -q y → 141) — if the control does not fire, the measurement is void, not clean. The threshold is the 64 KiB pipe buffer, so a bash builtin echo races too above it (30/30 at 128 KB), and the sweep pattern must be -[A-Za-z]*q — the obvious -q form misses -Eq/-iq/-Fq. Why: #6992 — a plan-phase measurement under the shim reported 0/40 and declared the filed defect REFUTED, re-scoping the whole task around an inverted conclusion; the real hook denied 0 of 30 on a 128 KB body. See knowledge-base/project/learnings/2026-07-27-my-refutation-measured-a-shim-and-my-safe-fixture-hid-12240-deletions.md..test.sh must pin its OLD baseline to a frozen committed fixture (test/fixtures/legacy-*.sh), NEVER to git show <mainbranch>:<the-file-this-PR-replaces> — that file BECOMES the new implementation at merge, so the baseline flips and the suite reddens on main for the next contributor (green on the branch, a merge-time time-bomb). Same class as the worktree-vs-main-CWD trap. Also pin LC_ALL=C on any sort+comm set-diff (a locale sort makes comm read its input as unsorted → undefined diff → the parity guard runs blind). Why: #5987 — Test 5a/9 fetched git show main:redact-sentinel.sh as the "old engine"; caught by soleur:engineering:review:code-quality-analyst at review. See knowledge-base/project/learnings/test-failures/2026-07-05-parity-baseline-must-not-be-git-show-main-of-the-replaced-file.md.run_in_background: true Bash whose body is <cmd> > /tmp/log 2>&1; echo "EXIT=$?", the harness's task-completion notification reports the exit of the trailing echo (always 0) and the real command's output landed in /tmp/log, NOT the background task's output file — so a "completed (exit code 0)" notification is NOT proof the command passed. Either drop the redirect (let the bg output file capture stdout/stderr directly), or ALWAYS grep the redirected log for the runner's own summary (vitest "Tests N failed", playwright "N failed", Failed to compile) before trusting a background pass. Why: #5512 — next build and the full vitest run both reported a misleading bg "exit code 0" while the redirected logs held the real failures (a build route-table line and 3 Doppler-env flakes respectively).devDependencies (e.g., [email protected]), invoke ./node_modules/.bin/<tool> — never npx <tool>. npx resolves to its own cache and silently major-version-jumps (e.g., installing vitest 4.x against a vitest 3.2.4 config), producing Could not resolve 'vitest/config' and Unexpected JSX expression parse errors that look like real regressions. Why: PR #3186 — npx vitest installed 4.x and rolldown rejected the project's JSX config; switching to ./node_modules/.bin/vitest (3.2.4) restored a passing run. See knowledge-base/project/learnings/2026-05-04-plan-precedent-search-must-include-lib-helpers.md session errors.hr-when-a-command-exits-non-zero-or-prints applies hardest to your own test output. The rule is reflexively applied to other people's commands and reliably skipped for a suite you are mid-way through authoring, because a failure there feels like a work-in-progress state rather than a finding. It is not: a fixture can be failing because it is structurally incapable of passing, and once the suite goes green for unrelated reasons that fixture is invisible forever. Diagnose before the next action, even mid-edit. Why: #7109 — a run printed Tests 3 failed | 25 passed on a just-added guard and the failure was carried past; soleur:engineering:review:test-design-reviewer later found all three fixtures used one-liner hook bodies (beforeAll(async () => {}, 60_000);) that the parser drops for want of a closer line, so they asserted nothing and were rated P0. See knowledge-base/project/learnings/2026-07-31-i-reported-a-live-suite-as-finished-and-three-more-results-i-asserted-instead-of-measuring.md.soleur:atdd-developer skill for detailed TDD guidance.Infrastructure Validation
When any task modifies files in apps/*/infra/, run these checks after each change (in addition to or instead of the app test suite):
Renaming a Terraform resource's ADDRESS is a destroy + create, and RequiresReplace does not license it. Before concluding a rename is "update-only", check which of the two you actually reasoned about: a plan-modifier governs a resource at a FIXED address, while an address leaving the configuration is a delete at the old name plus a create at the new one, whatever the provider schema says. Add a moved {} block (precedent: dns.tf, placement-group.tf) and VERIFY by feeding the plan through the repo's own destroy-guard filter rather than re-asserting the claim — measured resource_deletes: 1, resource_creates: 1 without the block, 0/0 with it. The cost of getting it wrong is more than a blocked gate: on a full-root auto-applied root the delete lands before the create, so an acked plan discards the live resource's history and opens a coverage window with no rollback. Why: #7798 — the plan reasoned from name being an in-place attribute; four review agents converged and sentry-destroy-required would have blocked the PR on the monitor the change existed to repair. See knowledge-base/project/learnings/2026-09-07-my-guard-pinned-the-three-attributes-the-vendor-already-refuses.md.
cloud-init schema: For each modified cloud-init.yml:
cloud-init schema -c <file> -- validates YAML syntax AND cloud-init schema in one step. Warnings about missing datasource are expected; only non-zero exit codes are failures. If cloud-init is not installed locally, warn and continue.
cloud-init.yml is a Terraform templatefile() (interpolated in server.tf/git-data.tf/etc.), cloud-init schema on the RAW file always fails on the un-rendered ${...} — validate the RENDERED output instead. Render via terraform console (printf 'templatefile("<abs>", { <full var map> })\n' | terraform -chdir="$(mktemp -d -t soleur-run.$$.XXXXXXXX)" console), strip the <<EOT … EOT wrapper, then cloud-init schema -c <rendered>. In the source template, shell ${VAR}/${VAR:-x} must be $${...} (double-dollar escapes the TF interpolation) and %{ must NOT appear at all — including inside comments (TF's directive scanner does not skip prose). Run the render after every edit; it catches both escaping traps. See knowledge-base/project/learnings/best-practices/2026-07-14-cloud-init-templatefile-escaping-and-ci-deploy-payload-testing.md.Terraform format: For each infra directory with modified .tf files:
terraform fmt -check <dir> -- exit 0 means formatted; exit 3 means violations. Fix with terraform fmt <dir>.
Terraform validate: For each infra directory with modified .tf files:
terraform init -backend=false then terraform validate -- catches HCL syntax errors and undefined references without requiring provider credentials.
Field-type verification for version-pinned providers: when writing HCL for a provider pinned below the registry's latest major (e.g., cloudflare ~> 4.0), verify field TYPES via terraform providers schema -json from a SCRATCH dir pinned to the exact version (minimal required_providers main.tf + terraform init) -- validate silently coerces wrong primitives (v4 cloudflare_list redirect items take "enabled"/"disabled" STRING enums, not booleans; registry/context7 docs show the latest major's syntax). The scratch dir matters: providers schema inside the real infra dir demands full backend init. Why: PR #5082 -- drafted booleans validated green and would have failed only at apply, behind a BLOCKING token-widen step that would have masked the diagnosis. See knowledge-base/project/learnings/2026-06-09-cloudflare-bulk-redirects-v4-schema-and-phase-order.md.
These checks replace the "tests may be skipped" exemption for infra files. If any check fails, fix before proceeding to the next task.
Before adding a systemd sandboxing directive, enumerate what it changes about the namespace the unit's own script OBSERVES. ProtectSystem=strict makes a writable subdirectory expressible only as a separate mount, so systemd bind-mounts every ReadWritePaths= entry onto itself — and any in-script predicate reading mount state then answers about the sandbox rather than the host. Measured: ReadWritePaths=/mnt/data made mountpoint -q /mnt/data return true for a nofail volume that never mounted, disarming the gate that refuses an irreversible FLUSHALL when the durability latch cannot be recorded. Use a predicate the bind cannot forge (device-vs-parent st_dev; a bind mount preserves st_dev). Same class: PrivateTmp=true gives a fresh private /tmp per start, so any on-disk fallback cache whose config dir lives under /tmp becomes per-invocation — check the unit's own comments do not still describe that cache as buying resilience across fires. And do NOT reach for a - prefix to dodge a missing directory: it leaves the path read-only under ProtectSystem=strict, so the script's mkdir -p fails on every fire instead. Use StateDirectory= for paths systemd should create, and name the MOUNTS in ReadWritePaths=, never the subdirectories the script creates inside them. Why: #7761. See knowledge-base/project/learnings/security-issues/2026-09-03-the-hardening-i-added-disarmed-the-guard-over-the-flushall.md.
terraform validate passing says nothing about terraform test, and a comment-only infra edit can force an SSH re-provision of a LIVE host. ADDING OR REMOVING A ROOT VARIABLE IS THE SECOND TRIGGER, and it is the one the wording above does not name: terraform test must resolve EVERY root variable before it evaluates any run block, so a new sensitive/no-default var breaks every existing run block with has a required variable "<name>" with no set value — while validate stays green throughout, because it never resolves variable VALUES. Also run fmt -check -recursive: bare fmt -check <dir> does NOT recurse, so a tests/ directory is never inspected. And BEFORE adding a root variable at all, grep the root for a local/resource that already produces the value — re-importing one Terraform already owns re-creates the staleness the bake exists to avoid (a -replace=random_password.X writes the new value downstream while templatefile renders the OLD TF_VAR_ env snapshot) and puts a whole-apply failure mode in front of every merge, since root variables resolve before -target pruning. Why: #7462/PR #7516 — two TF_VAR_zot_pull_* were added for local.zot_pull_user + random_password.zot_pull declared in the SAME root; it broke every run block, and only CI caught it. Two blast radii validate cannot see. (a) When the diff adds a lifecycle.precondition/postcondition — or any assertion on a provider-computed attribute — run terraform test: mock_provider synthesizes a RANDOM STRING for computed attributes, so data.<x>.architecture == "x86" fails EVERY run block with a message naming a vendor anomaly that never happened. Fix with override_data, then prove the pin does not DISABLE the guard (flip the var to the bad value; it must still red). (b) Before editing ANY infra file — including a comment — git grep its basename against every triggers_replace / filesha256: those hash file BYTES, so a citation fix on a script feeding a terraform_data trigger destroys+creates it, and if that resource sits in the per-merge -target= list on a step with no destroy-guard, merging root-SSHes the live serving host. Why: #6570 — the precondition red-lined infra-validate-required unnoticed (Phase 6 ran only validate), and a web-git-data-probe.sh comment edit would have re-provisioned web-1. See knowledge-base/project/learnings/2026-07-27-my-battery-was-green-because-it-only-tested-the-two-endpoints-not-the-wire.md.
A fail-closed guard deciding on a LIVE API response must treat that response as adversarial input — a 200 is not proof of shape, and a 404 is trustworthy only per-URL-scheme. Two fail-open seams recur: (a) a count over .result.<field> written as bare jq '… | length' reads a degraded/error 200 body ({"result":null}, {"success":false}, or a missing key) as 0 == empty == PASS — jq's null|length is 0 and jq -e exits 0 on numeric 0, so the intended "unparseable → fail-closed" branch never fires; gate on if type=="array" then length else error first. (b) a control probe that proves "404 means empty" validates only the URL scheme it actually ran against — if the gate builds two schemes (zones/$z/… AND accounts/$a/…), a zone-only control leaves the account 404 seam wide open; add a per-scheme control (e.g. GET accounts/$a/rulesets, memoized) requiring 200 before trusting that scheme's 404. And every fail-closed branch (incl. known-after-apply null URL fields serialized as null in the plan JSON) needs an isolating fixture that goes RED when only that guard is neutered. Why: #6767/PR #6833 — a green 31-assertion suite shipped both seams + 3 vacuous fail-closed branches; caught only by the multi-agent review panel. See knowledge-base/project/learnings/2026-07-23-live-api-fail-closed-guard-counts-degraded-200-as-empty-and-control-probe-must-cover-every-scheme.md.
[^\n] in a POSIX ERE is a bracket expression excluding backslash and the LETTER n — not "any char but newline". grep is line-oriented, so .* is the correct "rest of the line". The failure is silent and asymmetric: grep -qE 'curl[^\n]*-m' cannot cross -o /dev/null (it contains an n), so the POSITIVE assert fails loudly (fixable) while every NEGATIVE assert (! grep -qE '…[^\n]…') passes VACUOUSLY — a broken regex never matches, so the guard reports clean forever. Sweep any [^\n] in a .test.sh/toMatch and replace with .*; mutation-test each negative assert to prove it can still fail. Why: #6537 — four structural asserts were silently unmatchable and two were vacuous negatives.
In a Terraform templatefile, %{ is a DIRECTIVE and must be escaped %%{ — including inside comments (the directive scanner does not skip prose; hr-when-a-plan-specifies-relative-paths-e-g's sibling for template escaping). So a curl -w '%{http_code}', a printf %{...}, or a doc comment quoting one makes the render fail outright — caught only by rendering, never by terraform validate on the .tf. Pair with the existing $${VAR} shell-escape rule and re-run the render (.github/scripts/validate-infra-templates.sh <infra-dir>) after every template edit. Why: #6537 — -w '%{http_code}' in cloud-init-registry.yml.
When a terraform_data remote-exec inline block carries assertions or probes, "set -e" MUST be the first element — terraform joins inline into ONE script with NO implicit errexit and fails only on the LAST command's exit, so any assert before a trailing echo is decorative (silent-green). !-prefixed pipelines are errexit-EXEMPT: write enforcement probes as explicit if cmd; then echo FAILED; exit 1; fi. Why: PR #5089 — the cron-egress provisioner's "merge-precondition" probes couldn't fail the apply; 5 review agents concurred; sibling sweep tracked in #5101.
When writing a token-anchored drift guard over HCL, match attributes with attr[[:space:]]*=[[:space:]]* (never single-space attr = ) — terraform fmt re-aligns equals signs when a block gains a second attribute, silently blinding the guard to new blocks. Mutation-test by APPENDING a synthetic violating block (fmt-aligned, un-gated) to a copy, not just by removing a token from an existing well-formed one; and enumerate the invariant's targets across the whole infra directory's *.tf, not only the file the issue names. Why: PR #5132 (#5101) — inline = \[ false-PASSed a fmt-aligned ungated block, and a same-defect block sat un-swept in sibling ci-ssh-key.tf; both caught only at multi-agent review.
When a test encodes a cross-file numeric inequality (budget/window drift guards), extract EVERY operand by shape from its source file — exactly-one count check + ^[0-9]+$ validation per extraction, region-scoped when the pattern recurs (awk range over the owning unit/function); a single hardcoded term re-creates the silent-drift class the guard exists to catch. For ${N:-DEFAULT} shapes take tail -1 of the digit runs (the default is the LAST run, not the first). Why: PR #5146 (#5145) — a copied +180 TimeoutStopSec literal left one of three files unguarded; 4 review agents concurred. See knowledge-base/project/learnings/2026-06-11-cross-file-drift-guards-extract-every-operand-by-shape.md.
When cloud-init has lifecycle { ignore_changes = [user_data] }, changes to cloud-init templates are never applied to existing servers. Use a terraform_data provisioner with remote-exec to bridge the gap. Verify systemd services use EnvironmentFile= directives (not /etc/environment) for token injection.
When fixing syscall-level issues in Docker containers, test with --privileged first to establish a working baseline, then remove privileges one at a time. Docker's seccomp includes.caps is compile-time (evaluated when building BPF filter), not runtime -- processes gaining capabilities inside user namespaces do NOT gain access to capability-gated seccomp rules.
When a terraform_data provisioner writes a systemd unit or config file via remote-exec heredoc, extract the content to a standalone file and use file() in both triggers_replace and a file provisioner. Inline heredoc strings desync from the trigger hash -- partial strings in triggers_replace silently skip re-provisioning when the unit content changes.
When CLONING a file provisioner block, the destination's parent-dir existence is part of the precedent's ENVIRONMENT, not its copied HCL — Terraform's file (scp) does NOT create remote parents. Before reusing a file-provisioner shape, ask "what guarantees the destination dir exists on the host?"; if the precedent relied on a package (/etc/fail2ban/jail.d/) or an earlier provisioner creating it, add a mkdir -p remote-exec BEFORE the file provisioner. /etc/<tool>.conf.d/ drop-in dirs are the recurring trap — many are NOT shipped by the base package (e.g. /etc/systemd/journald.conf.d/ is absent on Ubuntu). terraform validate/fmt + static tests pass green; the failure is apply-time scp No such file or directory. Why: PR #4800 (#4792) — cloned disk_monitor_install's shape but the journald drop-in dir didn't exist; caught at review. See knowledge-base/project/learnings/integration-issues/2026-06-02-cloned-ssh-file-provisioner-does-not-inherit-target-dir-guarantee.md.
When adding or removing files from a triggers_replace hash in server.tf, grep for TRIGGER_FILES in plugins/soleur/test/ and DEPLOY_PIPELINE_FIX_TRIGGERS in plugins/soleur/skills/ship/SKILL.md — update all three locations in the same commit. The drift guard test catches this post-merge but costs a hotfix PR. Why: #4492 added 2 files to triggers_replace without updating the test array; CI failed post-merge (#4493 hotfix).
When adding a new sudo <cmd> (or any command) to a deploy/provision script exercised by a mock-PATH shell test (ci-deploy.test.sh et al., whose mock sudo strips the prefix and execs the real binary), the harness needs a create_mock_<cmd> in create_base_mocks — and it must be a pass-through that no-ops ONLY for the host effect it cannot reproduce (e.g. /mnt/* volume paths) and delegates every other invocation to the real binary (fail loud exit 1 if none found, never silent exit 0). A blanket no-op silently breaks sibling calls to the same command whose dirs the script later writes into. Symptom: a one-line script change makes MANY unrelated assertions fail at once (a set -e abort) — confirm by running unmodified origin/main files in an isolated dir before blaming the env. Why: #4886 — sudo mkdir -p /mnt/data/workspaces/.cron had no mock → real mkdir ENOENT'd on host /mnt/data → 33/79 failures. See [[2026-06-03-new-sudo-command-in-mocked-deploy-test-needs-passthrough-mock]].
When a .test.sh drift-guard asserts "the resource DELIVERS file X" by grepping a bare path, anchor the assertion to the delivery construct (destination = "…/X" AND source = "${path.module}/X"), NOT the bare path — a path that also appears in the block's chown/chmod/test -x lifecycle lines makes a bare-path grep pass vacuously even after the provisioner "file" delivery block is deleted. Prove non-vacuity by mutating out the delivery block and watching the guard go red. Also: invoke terraform with terraform -chdir=<dir> <subcommand> (never rely on a persisted cd — the Bash tool's CWD drifts unpredictably across calls). Why: #4811 — AC4 grepped /usr/local/bin/infra-config-apply.sh (recurs 4× in-block) and stayed green with delivery deleted; three terraform calls failed on CWD confusion. See [[2026-06-02-drift-guard-bare-path-grep-vacuous-and-terraform-cwd]].
Comment-prose sibling of the above: a .test.sh drift-guard whose grep target is a bare literal/boolean (agent = true, enabled = false) can false-PASS by matching that literal inside an explanatory COMMENT in the same awk-extracted block — and stays green-blind after the real config line changes. Anchor on a token only the real config line can carry (a var.<name> reference, an HCL operator like == null), never the bare literal. When fixing one named drift-guard, run a sibling-query audit (grep -rln "<stale phrase>" apps/web-platform/infra/*.test.sh) — false-passing siblings are invisible until grepped. Why: #4864 — journald-config.test.sh asserted literal agent = true (stale post-#4845's dual-context agent = var.ci_ssh_private_key == null); the sibling infra-config-handler-bootstrap.test.sh false-passed by matching the #4829 comment prose. See [[2026-06-03-drift-guard-assertion-false-passes-on-comment-prose]].
When flipping a bash ${VAR:-default} value, the consumer sweep MUST include surfaces that depend on the default by OMISSION (a CI step / cron / test that never exports the var) — a grep VAR finds explicit readers, never the unset-fallback consumers. Pin the old default explicitly at each such surface in the same PR, AND add one test that runs with the var genuinely unset (env -i), since a suite that always pins the var cannot detect a silent default revert. Why: #4806 — flipping SOLEUR_DEFER_DRYRUN:-1 → :-0 would have false-FAILed test-pretooluse-hooks.yml Test 6, which asserted would_defer while relying on the hardcoded default. See [[2026-06-02-env-default-flip-breaks-implicit-ci-consumer]].
When referencing cloudflare_zero_trust_access_service_token.*.client_secret (or any provider-managed credential attribute) in a Terraform environment {} block, check the provider docs for write-only attributes. The Cloudflare provider's client_secret is available at creation but empty on subsequent terraform refresh. Use Doppler variables instead of state references for credentials. Why: #4492 → #4494.
When HMAC-signing a payload and sending it via curl, always use --data-binary @file (not -d @file). curl's -d strips newlines from the file content, creating a mismatch between what openssl dgst hashed (with newlines) and what the server receives (stripped). Why: #4492 → #4495.
When writing a webhook handler that runs inside a systemd service's mount namespace (ProtectSystem=strict), cross-check every destination path against the service unit's ReadOnlyPaths/ReadWritePaths at implementation time. SSH provisioners run outside the namespace; webhook handlers run inside. terraform validate and sandbox test suites do not catch namespace conflicts. Why: #4492 P1 review finding.
A new apps/web-platform/infra/**/*.test.sh needs NO registration step — since #8736 (ADR-252) presence IS registration: run-registered-suites.sh glob-derives the execute set and the deploy-script-tests matrix legs run it. Exceptions needing explicit wiring: a root suite goes in the runner's PRIVILEGED_WHY map AND gets a sudo bash step in the deploy-script-tests-fixed job; a suite under apps/web-platform/test/infra/ is not glob-reached and still needs a run: bash step (the registration gate's Arm 3b reds on an uninvoked one). Also verify the next-free ADR number from the directory (ls knowledge-base/engineering/architecture/decisions | grep -oE 'ADR-[0-9]+' | sort -t- -k2 -n | tail -1) — a plan-quoted ADR number is stale once a sibling PR lands one. Why: #5417 — resource-monitor/cat-deploy-state were orphan suites under the old step-shape contract; plan's "ADR-061" was already taken. The same applies in reverse for a new tests/scripts/test-*.sh: nothing auto-discovers that directory either (test-all.sh's *.test.sh glob excludes it AND cannot match the test-* prefix), so it needs an explicit run_suite line in scripts/test-all.sh. Whichever directory you add a gate to, grep its registration site and confirm the new file appears in the run log — "it will be picked up automatically" is false by default here, and the failure is always silent-and-green. Why: #3366/PR #6520 — the harness carrying that PR's entire "the gate cannot silently pass" claim ran in ZERO runners; deleting the fail-open rung it existed to catch shipped green, and test-all.sh already documented this trap six lines above where the registration belonged.
Registration is not environment: read the JOB BODY of any runner you register a suite into and confirm every external binary the suite needs is installed there. A registration claim can be true in every clause (the glob matches, the job runs it, the context is required) and the suite still cannot execute. Corollary: a REQUIRED, path-filter-free, merge_group job is a shared resource — never add apt-get to one to satisfy a single suite (it puts a package-mirror dependency on the merge-queue critical path for every PR in the repo); relocate the suite to a job that already carries the tooling and record the dependency contract where the auto-glob lives. Why: #6454 — .github/scripts/test/test-*.sh auto-globs into guard-script-fixture-tests (required, bare ubuntu-latest + checkout); a terraform/cloud-init-dependent suite exited 6 on all 22 fixtures and red the required check for every PR. See knowledge-base/project/learnings/2026-07-15-guard-gate-and-probe-must-pin-the-thing-they-name.md §8.
Track Progress
Three verification habits, each measured as a miss on #8323, and each costing a review round. (a) Diff per-case verdicts, never totals. An assertion-count floor tells you a count MOVED, never which member left: a scenario-17 rewrite sliced to the scenario-18 anchor and silently took scenario 19 with it, the floor caught the drop, and it was recalibrated without checking what had gone — the deleted row was the only one covering a rule operand, and its absence was found by a CTO consult, not by any gate. (b) Run the suite in the environment it SHIPS into before review, not as an intention. CI checks out a DETACHED HEAD on pull_request, where git rev-parse --abbrev-ref HEAD returns the literal HEAD; an assertion pinning the branch name was 109/1 there and green locally. Sweep CI=1, SOLEUR_SUBAGENT=1, and a detached worktree, and treat a PASS-COUNT delta as a finding. (c) When a mutant survives on an OPERAND, try deleting the operand before writing the killing test. A surviving mutant has two causes — weak tests, or an operand with no behavioural justification — and writing the test promotes an accidental behaviour to a specified one. On #8323 the killing test pinned a manual compaction REVOKING an already-earned recommendation; the operand was ruled out entirely and the scenario restored inverted. See knowledge-base/project/learnings/2026-09-18-every-defect-was-in-my-verification-not-the-feature.md.
GDPR / Compliance Gate (single pass, end of Phase 2)
[skill-enforced: gdpr-gate at work Phase 2 exit]
After the per-task RED/GREEN/REFACTOR loop completes and before Phase 2.5, run soleur:gdpr-gate once against the cumulative diff git diff origin/main...HEAD (after git fetch origin main — the local main ref lags in bare-repo worktrees and pollutes the diff with unrelated merged branches). Same advisory-only output and Critical-finding escalation as plan Phase 2.7. Never per-task — token budget is ≤4k per invocation, single pass per phase per ADR-026 TR3.
Skip silently if the cumulative diff does not match the hr-gdpr-gate-on-regulated-data-surfaces canonical regex.
Before claiming a battery proves anything — "mutation-proven", "N/N caught", "no surviving mutants" — count AXES, not rows. A battery's value is the number of DISTINCT things it perturbs; N mutations of one shape is one mutation, and the axes an author omits are the ones they were not thinking about. The axes below are the consolidated union; review/SKILL.md carries the evidence for each, distributed across its defect-class and sharp-edge bullets rather than in one catalogue section, so treat this list as the index and that file as the case law:
want(){ ok "$1 → $3"; } — drop one comparison — produced a byte-identical
95/95 pass, exit 0, with six of ten battery rows silently surviving; the floor could not see it
because it counted TOTAL, and the battery's harness row neutered bad(), the one edit leaving
ok() and TOTAL intact. The remedy is a helper self-test driving both branches and reporting
with printf + exit, never through the helpers it guards. Treat floor slack as attack budget:
that floor sat at 60 against 95 assertions, so all 24 new ones could be undispatched.references/end-of-work-resume.md (opens in a new tab)references/hook-test-main-cwd.md (opens in a new tab)references/key-principles.md (opens in a new tab)references/property-testing.md (opens in a new tab)references/sql-security-definer-rpc-scaffold.sql (opens in a new tab)references/work-agent-teams.md (opens in a new tab)references/work-lifecycle-parallel.md (opens in a new tab)references/work-lockfile-bumps.md (opens in a new tab)references/work-scratch-sandboxes.md (opens in a new tab)references/work-subagent-fanout.md (opens in a new tab)references/work-test-harness-sharp-edges.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
108 skills in this plugin
/admin-ip-refreshThis skill should be used to refresh the prod SSH allowlist (Doppler ADMIN_IPS) after operator IP rotation. Detects drift, mutates Doppler with explicit ack./agent-browserThis skill should be used when automating browser interactions via Vercel's agent-browser CLI. It handles web page navigation, form filling, screenshots, and data scraping using ref-based element selection./agent-native-architectureThis skill should be used when designing agent-native applications where agents are first-class citizens: architecting autonomous agents, creating MCP tools, building apps where features are agent-driven outcomes.npx claudepluginhub jikig-ai/soleur --plugin soleurOther plugins' skills for the same job