Skip to content

Fix the weekly summary drift workflow so it can file its issue - #1719

Merged
neuromechanist merged 32 commits into
devfrom
fix/drift-workflow-gh-repo
Oct 12, 2026
Merged

neuromechanist merged 32 commits into
devfrom
fix/drift-workflow-gh-repo

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Root cause

The weekly check-summary-drift.yml has never filed its issue. Of its 20 scheduled runs on record (the first on 2026-06-01, the latest run 38228766872 on 2026-10-12), 19 failed in the step "Open / update drift issue" and 1 (run 32710516977, 2026-08-24) failed in "Open / update report-broken issue". Same cause in both: the report-broken step was trying to report that the coverage endpoint had answered HTTP 500, so that outage went unreported too.

The latest run fetched the coverage report fine (96 of 1303 versions report missing), built the body, and then failed with failed to run git: fatal: not a git repository. The job has no actions/checkout step and no GH_REPO or --repo. gh finds its repository by asking git for the remote, so with no checkout every gh issue and gh label call has no target and dies.

Two more defects of the same family sat behind it, and would have shown up the moment the first was fixed:

  • The label step ended each call in >/dev/null 2>&1 || true, so the repository error was swallowed there too and the drift label (absent from the repo; only P1 and P2 exist) was never created.
  • The existing-issue lookup ended in || echo "", which turns a failed lookup into "no issue exists". With the repository fixed, any API hiccup would file a duplicate every Monday.

When it takes effect

Scheduled workflows run from the default branch, which is main; this PR targets dev. The weekly check keeps failing until the change reaches main. The maintainer can dispatch it from this branch to prove it earlier.

Design decision: a label failure does not stop the alarm, a lookup failure does, after retries

Failing the whole job when the label step fails trades a duplicate for a lost alarm: one label-API hiccup would mean no drift issue that week. Reading a failed lookup as "no issue" trades the other way (a duplicate every week). The choice:

  • The ensure-labels step is continue-on-error: true. A failure there stays in the log and in the run's annotations, but the step and the job stay green (the runner reports a continue-on-error step as succeeded). It tries every label before it reports failure and prints an error for each label it could not create. If a label really is missing, gh issue create --label in the later steps still fails, and that failure is red, so a missing label is never silent.
  • Each existing-issue lookup goes through a small retry helper: 3 attempts, 5 seconds apart, and it still fails after the last. A lookup that keeps failing fails the step; it is never read as "no issue". An empty result still means no issue.

What changed

One commit per concern, so any can be dropped or reverted alone.

Workflows:

  • fix: give the drift workflow a repo for gh: GH_REPO: ${{ github.repository }} at job level. The job stays checkout-free (it needs no source tree), and a step added later inherits the target.
  • fix: stop the drift label step hiding errors: lists labels and creates only the missing ones. It deliberately does not use gh label create --force: gh label create --help says "If a color isn't provided, a random one will be chosen" and that --force updates an existing label, so the old gh label create P1 --force would likely have recoloured the existing P1 and P2 on every run once gh worked (read from the help text; not tried, since that would modify the live labels).
  • fix: fail the drift lookups instead of no issue: removes || echo "" from the three lookups and adds set -euo pipefail.
  • fix: match each drift issue by its title prefix: the probe-broken and report-broken issues carry the drift label too, and "summary.json drift" is in the title of one and the body of the other, so the drift step could have rewritten either into a drift report. Each lookup keeps only an issue whose title starts with its own prefix.
  • fix: nightly issue lookup no longer hides errors: nightly-tests.yml has a checkout and --repo, so it never had the missing-repository defect, but its lookup ended in || true and its label create discarded stderr and its exit code. The label step stays best-effort, but warns in the log instead of going silent.
  • docs: correct the drift run statistic, fix: retry the drift issue lookups, fix: retry the nightly issue lookup, fix: a label failure must not stop the alarm, refactor: declare each drift prefix once: the decision above, the retry (one helper written once to a file and sourced by the three drift steps; inline in nightly, which has one lookup), // empty on the drift jq for parity with nightly, and the prefix declared once per step (PREFIX=..., TITLE built from it, the double-quoted jq interpolating it, the search text derived from it) so the title and the lookup that finds it cannot drift apart.

Tests and CI:

  • test: every workflow gh call has a repository, test: see through retry and other wrappers, test: flag lookups in steps that cannot fail, test: pin the drift retry, labels and prefixes, test: scan .yaml workflows and the templates, test: table-driven controls for the scanner, test: name the drift call counts per command, test: pin the retry delay and its default, test: no collection-time work in the helper tests, test: pin workflow-level defaults.run.shell, test: an inline GH_REPO names a repository, test: move the gh-call scanner to its own file: see below.
  • ci: run the workflow checks on workflow edits: a pull request that edits only a file under .github/workflows or .github/dataset-workflows matched no paths filter and ran no job, so the new test would be skipped on exactly the change it polices (the same gap shared:, decisions: and agentdocs: closed before). Adds a workflows filter. It has to reach unit-pure, the job that runs the test; it is wired into lint as well only to keep the two if: conditions identical, which is convention: a job skipped by its if: reports Success and does not block a required check. Kept on the maintainer's decision. Note that editing test.yml starts the jobs whose filters name it (the scrub shards, the passwordless-auth suite, the zarr jobs), so this PR runs more CI than its size suggests.
  • test: parse the workflows filter: the routing test searched the filters block for the two globs as raw strings, so it passed with the globs under another filter or in a comment while workflows: pointed at nothing (shown on a scratch copy). It now parses the block and requires the globs under the workflows key.
  • docs: a label failure is logged, not red: the comment on the label step said it goes red; it does not, see the decision above.
  • docs: correct the skipped-job rationale, docs: correct the scanner docstring's claims, docs: list the scanner's known blind spots, docs: list wrappers the scanner cannot see through, docs: name the moved test file, docs: changelog says when the fix takes effect: comments and the changelog. Two new comments and an older one in test.yml said a job skipped by its if: blocks a required check; it does not (only a skipped workflow does). The docstring cited an ADR about a different alarm; dropped.

The test

test/workflow-gh-calls.test.ts (new, 35 tests, in the pure tier; test/workflow-yaml.test.ts keeps the template and routing tests, 15 on origin/dev, 16 now with the workflows filter test). It was first written inside workflow-yaml.test.ts and moved out by test: move the gh-call scanner to its own file, a byte-for-byte move (checked), so the earlier commits show it under the old name. It parses every workflow the repository ships (.github/workflows and .github/dataset-workflows, .yml or .yaml, and the per-dataset templates from getWorkflowTemplates()) and fails on:

  1. a gh call that needs a repository with none: no earlier checkout of this repository in the job (a checkout with repository: or path: does not count), no non-empty GH_REPO at workflow, job or step level, no --repo, and no inline GH_REPO=o/n gh ... or env GH_REPO=o/n gh ... on that call (an empty inline value does not count). gh api with an explicit path is exempt; one with {owner} or {repo} is not. It sees through wrappers such as retry, timeout and env.
  2. an issue lookup (gh issue list|view|status, gh search issues) whose failure is swallowed (|| echo "", || true, || :, || printf "", || VAR="", and the bare and single-quoted forms).
  3. a step holding such a lookup that does not stop on error (set +e, or a shell: template such as bash {0} without -e and without a set -e).
  4. a gh label create that discards its stderr or its exit code.

Structural tests pin what the scanner cannot see: each lookup step declares one PREFIX, builds TITLE from it and matches on it with no second literal; no prefix is a prefix of another; every lookup goes through the retry helper and fails the step; the label step is continue-on-error and reports a failed create; the nightly helper is identical to the drift one. The retry helper is also run for real: the step writes it, bash runs it against a command that fails a set number of times, and the calling step must succeed after two failures and fail after the third without reading it as "no issue". The 5-second default is pinned too: with RETRY_DELAY unset and sleep replaced, the helper must ask to wait 5 seconds twice (and say retrying in 5s), none after the last attempt. The helper's temp directory is made in beforeAll and its step looked up when a test runs, not at collection.

The retry helper exists in two places on purpose: the drift job has no checkout, so it cannot source a script from the repository and writes the helper to a file once for its three steps, while the nightly workflow has one lookup and carries it inline. The test that compares the two function bodies line by line is what keeps them equal.

The analysis is static text over parsed YAML, so it is wrong at its edges in both directions. The docstring lists the known blind spots (a pipe without pipefail, || exit 0 and || echo 0 not recognized; a phantom heredoc from $((1 << N)) hiding the rest of a script; a gh behind a wrapper with its own options such as timeout -s KILL 30, env -i or nice -n 5, or behind xargs or bash -c '...'; false positives on a ; inside a quoted string and on an exported GH_REPO; composite actions and reusable workflows not followed), each checked against the scanner before it was written down.

Other workflows found with the missing-repository pattern: none. auto-tag.yml and npm-publish.yml have a checkout; nightly-tests.yml has a checkout and --repo; the dataset workflows and the three shim templates only call gh api repos/nemarDatasets/... with an explicit path. npm-publish.yml has gh pr list ... 2>/dev/null || true (does this branch have a pull request); it is not an issue lookup, the failure mode is a skipped preview publish with a notice, and it sits in the release pipeline, so I left it and list it here.

Evidence

Reproduction, in a scratch directory that is not a git repository (read-only calls only):

$ gh issue list --label drift --state open --json number
failed to run git: fatal: not a git repository (or any of the parent directories): .git
exit=1
$ GH_REPO=nemarOrg/nemar-cli gh issue list --label drift --state open --json number
[]
exit=0

Each changed step was also run as written, extracted from the YAML, against the real label and issue lists with every write replaced by a print, and shellcheck is clean on all of them. With GH_REPO the lookups succeed and the step reaches its create or edit; without it each step stops at the lookup. With a gh stand-in that fails the first 0, 2 and 3 lookups, the drift and nightly steps reach their write after 0 and 2 failures and fail the step after 3. For the label step, creation working creates drift and leaves P1 and P2; creation failing prints the error, still checks P1 and P2, and exits 1.

Test results (latest local run):

  • bun test test/workflow-yaml.test.ts test/workflow-gh-calls.test.ts test/changelog-format.unit.test.ts: 57 pass, 0 fail (16 + 35 + 6; the workflow-yaml test was 15 on origin/dev). bun run typecheck, bun run lint and biome check on both test files are clean, both files type-check under a scratch tsconfig, and shellcheck is clean on the changed step scripts. Both files are in the pure tier under the test workflow's own selection (test/*.test.ts, neither names a live-tier token) and match the tests paths filter. actionlint is not installed, so it was not run.
  • Mutation checks, all on a scratch copy of the files, never the worktree. On the final file layout 78 mutations were each caught: every scanner line one at a time (GH_REPO accepted when empty or of any type; step and job GH_REPO leaking; checkout leaking across jobs; --repo=, -R and prefix matching; each of the 11 command groups dropped; each lookup action dropped; each stderr form; each swallow spelling; each command position; .yaml and templates dropped), the structural rules (a diverging jq literal, startswith removed, colliding prefixes, a hardcoded title, the lookup not retried, the helper returning 0 after the last failure or making one or five attempts, continue-on-error removed from the label step or added to a lookup step, the nightly helper differing), and the errexit rule. Separately, the same way: 7 for the retry delay (sleep removed from one or both copies; default 0 in the sleep, the message or both; default 30; an extra wait after the last attempt), 7 for the inline GH_REPO rule (check removed; empty, quoted-empty or any variable accepted; whole call text searched; no word boundary; prefix spanning the line), 5 for workflow-level defaults.run.shell (workflow or job defaults ignored; the wrong one winning), the helper step renamed (the file still collects; the tests that need it fail by name), and 2 real-workflow edits (set +e, shell: bash {0}). The 9 wrapper words, 4 more swallow spellings and 5 test.yml wiring mutations were each caught on the previous layout. One deliberate non-failure: changing a prefix consistently in both places is valid. Reverting the whole drift workflow to origin/dev and dropping a new workflow with a bare gh call into either directory also fail.
  • Writing the controls found two scanner holes, both fixed: elif gh ... was invisible (it appeared the moment the label step used it), and GH_REPO=o/n gh ... was reported as naming no repository. A redundant VAR=value prefix alternative was removed.
  • Kept on purpose: the wrapper words nothing in the repo uses (command, exec, time, nohup, sudo). Each has a control row, and removing one only blinds the scanner to it.

CI

The latest push (e0ecf062, run 38296229934) is green: lint, unit-pure (the whole pure tier, which includes both workflow test files), integration-dev, the scrub shards, the zarr, api, sandbox and patch-duration jobs all passed; e2e-upload and passwordless-auth-test were skipped by their filters.

On the first push, integration-dev (live backend, not required) had failed on one test, validateMeshTerms > confirms valid MeSH term via NLM API, with ECONNRESET on all 3 attempts against the NLM API (1332 other tests passed). That is an external network call; this PR changes no src/ or backend/ file, and the same test passed in a recent green dev run (run 38123176747) and passes on this push. It was unrelated to this PR. No workflow was re-run by hand.

Not verified

  • The workflow cannot be proven end to end until it is dispatched from this branch. I did not dispatch it and did not create, edit or close any issue or label on GitHub. The first real run will create the drift label and file the first drift issue (on 2026-10-12 the report listed 96 of 1303 versions with no summary.json).
  • Whether the job's GITHUB_TOKEN permissions (issues: write only) are enough for gh label list and gh label create is not exercised here; label reads and writes should be covered by that permission, and the dispatch will show.
  • That a failed continue-on-error step reports as succeeded, so a label failure shows only in the log and annotations, follows from the runner's documented behaviour and is not exercised here.
  • Not changed: an issue body larger than GitHub's 65536-character limit (the table has one row per drifted version, so a catalogue-wide drift would exceed it) would fail loudly at gh issue create; it is not a regression and is out of scope.
  • The label colours and descriptions used when P1 or P2 are missing are the repository's current ones; they are only used on a fresh repository.

The job has no checkout step, so gh could not infer a repository and every issue and label call failed with 'not a git repository'. All 20 scheduled runs on record failed in the open-issue step; no drift issue was ever filed. GH_REPO at job level gives every step, present and future, an explicit target. Not exercised end to end: needs a dispatch from the branch.
The step ended every gh call in '>/dev/null 2>&1 || true', so the missing drift label was never created and nothing said why. It now lists the labels, creates only the missing ones, and fails the job when it cannot: the issue step would fail on the missing label anyway and the weekly lookup keys on it. Not --force: gh picks a random colour when none is given, which would recolour the existing P1 and P2. Dry-run against the real label list with writes disabled: creates drift, leaves P1 and P2.
Each issue step looked for an existing issue with '|| echo ""', so a failed lookup read as 'none exists'. Once gh had a repository that would have filed a duplicate every Monday on any API hiccup. The lookups now fail the step (set -euo pipefail); an empty result still means no issue. Dry-run against the real issue list with writes disabled: with GH_REPO the lookup succeeds and reaches create, without it each step stops at the lookup and never reaches create.
The three issue steps looked up an open issue by label and search text. The probe-broken and report-broken issues carry the drift label too, and 'summary.json drift' is in the title of one and the body of the other, so a bare lookup could find the wrong issue and rewrite it into a drift report. Each lookup now keeps only an issue whose title starts with that step's own prefix. Checked the expression read-only against the real issue list: a matching prefix returns the issue, another prefix over the same search returns nothing.
Same family as the drift workflow. The existing-issue lookup ended in '|| true', so a failed lookup read as no open issue and filed a second one; it now fails the step. The label step discarded stderr and ignored the exit code, which hid a real failure behind the harmless 'already exists'; it now lists first, creates only a missing label, and warns in the log when it cannot. The nightly job already has a checkout and passes --repo, so it never had the missing-repository defect. Dry-run against the real issue and label lists with writes disabled: finds the open nightly issue and leaves the existing label; against a nonexistent repo it warns, then fails at the lookup.
Parses every workflow the repo ships (.github/workflows, .github/dataset-workflows and the per-dataset templates) and fails on a gh call with no checkout of this repository, GH_REPO or --repo; on an issue lookup whose failure is turned into 'no issue'; and on a label create that discards its stderr or exit code. Static text over parsed YAML, so it carries controls for each way the analysis can be wrong. Proved against the real files: reverting each fix, singly, fails with the expected message (GH_REPO dropped, set empty, or moved to a step with no gh call; each lookup swallowed as '|| echo ""' or '|| true'; both label swallows; the whole drift workflow back to origin/dev), and a new workflow with a bare gh call in either directory fails. Mutating the scanner itself, 16 ways, fails at least one control each time.
A pull request that edits only a file under .github/workflows or .github/dataset-workflows matched no paths filter and ran no job, so the gh repository guard would be skipped on the change it polices. New workflows filter, wired into lint and unit-pure together because both are required checks. Droppable on its own: editing test.yml also starts the jobs whose filters name it, so this PR runs more CI than its size suggests. Proved: removing the output, the filter, either path or either if fails the new test.
Unreleased section, as the changelog format test allows. Format test passes.
The comment said all 20 scheduled runs failed in the open-issue step. It was 19 of 20 there, and 1 (2026-08-24) in the report-broken step, which hit the same missing-repository error while reporting a coverage endpoint HTTP 500, so that outage went unreported. Comment only.
The scanner only saw gh at the start of a command, so wrapping a call in retry or timeout hid it from every rule. It now looks past retry, timeout, env, command, exec, time, nohup, sudo and VAR=value prefixes. Controls: a bare wrapped create is reported, and a wrapped lookup with '|| echo ""' is reported. Needed before the drift lookups go through a retry helper.
A lookup that fails must fail its step, but one transient API failure should not cost a week's alarm. The three existing-issue lookups now go through a retry helper (3 attempts, 5 seconds apart, still failing after the last, so an error is never read as no issue). The helper is written once to a file and sourced by each step. The jq expressions also gain '// empty', matching the nightly lookup. Exercised with a gh stand-in that fails the first 0, 2 and 3 lookups: 0 and 2 reach the create, 3 fails the step without reaching it. Reads hit the real issue list; writes are printed.
Same trade as the drift workflow: the lookup fails the step on error, so one transient API failure would cost the night's issue. It now goes through the same bounded retry (3 attempts, 5 seconds apart, still failing after the last). Defined inline because the workflow has one lookup. Exercised with a gh stand-in that fails the first 0, 2 and 3 lookups: 0 and 2 refresh the open nightly issue, 3 fails the step.
Failing the job on a label error traded a duplicate for a lost alarm: one label-API hiccup would mean no drift issue that week. The step is now continue-on-error with its stderr still in the log, tries every label before it reports failure, and prints an error for each one it could not create. A label that really is missing still fails 'gh issue create --label' in the later steps, so a missing label is never silent. Exercised against the real label list with writes disabled: creates drift and leaves P1 and P2 when creation works; when creation fails it prints the error, still checks P1 and P2, and exits 1. The scanner gains elif as a command-position keyword: the new 'elif gh label create' was invisible to it.
Each issue step wrote its title prefix twice, once in TITLE and once in the jq startswith, so an edit to one would silently stop the lookup finding the issue it had just filed. The prefix is now declared once per step, TITLE is built from it and the double-quoted jq interpolates it. The search text is the prefix without its colon, so that is not a third copy. The old-swallow control now mutates the lookup in all three steps and checks each is reported. Exercised with writes disabled: all three steps reach their create, and the double-quoted jq selects by prefix against the real issue list.
Structure the scanner cannot see. Each lookup declares one prefix, builds its title from it and matches on it, with no second literal; no prefix is a prefix of another; every lookup is sourced from the retry helper and fails the step (set -e, no continue-on-error); the label step is continue-on-error and reports a failed create in its own status; the nightly helper is identical to the drift one. The helper is also run for real: the step writes it, bash runs it against a command that fails a set number of times, and the calling step must succeed after two failures and fail after the third without reading it as no issue. Scratch-copy mutations (18) each fail at least one test, with one deliberate exception: changing a prefix consistently in both places is valid and does not fail.
A lookup in a step that does not stop on error is the swallow again with no '||' to spot: 'set +e', 'set +eu' or 'set +o errexit' in the script, or a shell template such as 'bash {0}' (at step, job or workflow level) without -e and without a 'set -e' in the script. Table-driven controls cover each, plus the cases that must stay clean (default shell, 'bash -e {0}', a template rescued by set -e, set +e around a create). Scratch-copy mutations: 9 scanner lines and 2 real-workflow edits each fail a test.
The scan read only files ending in .yml, but GitHub runs .yaml as well, so a .yaml workflow with a bare gh call would pass. The listing is now one function matching .yml and .yaml, with a control on a directory holding a.yaml, b.yml, c.txt, d.yml.bak and e.json. A second control asserts that the shipped set includes at least one per-dataset template, so dropping the template half of the scan cannot go unnoticed. Scratch-copy mutations (listing back to .yml only; templates dropped) each fail a test.
Each scanner line now has a row that fails when the line is mutated: GH_REPO counts only as a non-empty string at step, job and workflow level and does not leak between steps or jobs; a checkout covers its own job only; --repo, --repo= and -R each name a repository for their own call only; a literal list of the 11 command groups that read the git remote is reported when bare; each issue lookup (list, view, status, search issues) is reported under ten swallow spellings; each way of discarding label stderr; and 18 command positions (then, do, else, elif, if, while, until, !, {, backtick, subshell, separators, pipes, VAR=value). Also drops the '=\S*\s' prefix alternative, which the wrapper pattern already covers. Scratch-copy mutations: 52 scanner lines mutated one at a time, every one fails a test after the table rows for printf, bare echo and wrapper words were added.
Two new comments, and an older one in test.yml, said a job skipped by its if: blocks a required check. It does not: a job skipped by a conditional reports Success; only a skipped workflow (paths-ignore, branch filter, a skip-ci commit) leaves its checks pending. The workflows output has to reach unit-pure, the job that runs the test; wiring it into lint as well only keeps the two conditions identical. Comments only.
The routing test searched the whole filters block for the two globs as raw strings, so it passed with the globs under another filter or in a comment while 'workflows:' pointed at nothing. It now parses the block and requires both globs under the workflows key. Scratch-copy check: the old test survives the mutation (workflows: -> nothing/**, globs moved under shared:); the new one fails it, and fails for a glob left only in a comment, a missing glob, a renamed key and lint losing the output.
It said all 20 scheduled runs of the drift workflow failed in the open-issue step (19 did; one failed in the report-broken step, for the same reason, while reporting a coverage endpoint HTTP 500), and cited ADR 0053, which is about the import-coverage alarm, not this. The statistic is corrected, the citation dropped, and the rule list now includes the errexit rule added since. Comment only.
States what a clean result does not prove: lookups hidden by a pipe without pipefail, '|| exit 0' or '|| echo 0'; a phantom heredoc from '$((1 << N))' or a '<<EOF' string that hides the rest of a script; false positives on a ';' inside a quoted string and on an exported GH_REPO; composite actions and reusable workflows are not followed. Each was checked against the scanner on a scratch copy before it was written down. Comment only.
The scan-reaches test asserted at least 9 'issue' calls and at least 2 'label' calls with no word on why those numbers, and a doc-typed variable called issueCalls. It now counts per command (issue list, edit and create, three each; label list and create, one each) with a comment saying what each count is, and the variable is called driftDoc. A scanner that goes blind to one command, such as a label create after elif, now fails here by name. Scratch-copy check: dropping elif or the retry wrapper from the scanner fails it.
Scheduled workflows run from the default branch and this change targets dev, so the weekly check keeps failing until the change reaches main. The entry also now states the corrected run statistic (19 of 20 in the open-issue step, 1 in the report-broken step) and the retry, the non-fatal label step and the errexit rule added after the first review. Format test passes.
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR1719

Version: 0.10.17-PR1719.e0ecf06
Commit: e0ecf06


🤖 Updated on each push.

The comment said the label step goes red on failure. With continue-on-error the runner reports the step as succeeded, so the step and the job stay green; the failure stays in the log and the run's annotations, and a label that is really missing fails 'gh issue create --label' below, which is red. Comment and test wording only. The changelog and PR body never claimed red.
The retry-helper describe made its temp directory and looked up the helper step while the file was being collected, so a filtered run (-t) leaked a directory and a renamed helper step threw before any test ran. The directory is now made in beforeAll and the step is looked up inside the function that runs it. Checked on a scratch copy with a private TMPDIR: a run whose filter matches nothing leaked 1 directory before and 0 after; with the helper step renamed the file still collects and the tests that need the step fail by name.
The 5-second default was not pinned: removing the sleep, or setting the default to 0 in both copies of the helper, left every test green because the tests set RETRY_DELAY=0. A new test runs the real helper with RETRY_DELAY unset and replaces sleep after sourcing, so nothing waits: after two failures it must have been asked to wait 5 twice (and say 'retrying in 5s' twice), and after three failures still twice, none after the last attempt. Scratch-copy mutations, each caught: sleep removed from one copy and from both; default 0 in the sleep, in the message, or in both copies; default 30; an extra wait after the last attempt.
Only the job-level form of defaults.run.shell had a control, so ignoring the workflow-level default survived. Adds the workflow-level form (a lookup under 'bash {0}' is reported), and the two precedence rows: a step's own 'bash -e {0}' and a job's own 'bash -e {0}' each override the workflow default. Scratch-copy mutations, each caught: workflow defaults ignored, job defaults ignored, workflow default winning over the job's, workflow default winning over the step's, both ignored.
'GH_REPO=a/b gh ...' and 'env GH_REPO=a/b gh ...' set the repository for that one call, but the scanner reported them as naming none, a false positive that would push a fix toward a worse workaround. Each call now records what sits between its command position and gh, and an inline GH_REPO with a non-empty value in that prefix counts. Empty values (GH_REPO= gh, GH_REPO="" gh) still report, as does a different variable, one on a different command, and an argument that merely mentions GH_REPO. Scratch-copy mutations, each caught: check removed, empty accepted, quoted-empty accepted, any variable accepted, whole call text searched, no word boundary, prefix spanning the whole line.
Adds to the blind-spot list the wrappers a bare gh behind them escapes: ones with their own options (timeout -s KILL 30, env -i X=1, nice -n 5), xargs, and a quoted script (bash -c 'gh ...'). Each was run through the scanner and reported nothing, while 'timeout 30 gh' and 'env X=1 gh' are reported. The speculative wrapper words (command, exec, time, nohup, sudo) are kept: each has a control row and removing one only blinds the scanner to it. Comment only.
A pure move: the describe block that holds the scanner, its controls, the drift and nightly structure tests and the real-bash retry-helper tests goes to test/workflow-gh-calls.test.ts, byte for byte (checked against the previous commit: 44721 characters, identical). Only the imports and the two header comments change. workflow-yaml.test.ts keeps the template validity and test-workflow routing tests. Nothing was shared between the two halves, so no helper is copied. Both files are in the pure tier under the test workflow's own selection (test/*.test.ts, no tier tokens in either file), and both match the tests paths filter. 51 tests across the two files before and after.
The test.yml filter comment, two comments in the drift workflow, the changelog entry and the routing test's comment named test/workflow-yaml.test.ts as the file that checks every workflow's gh calls; it is now test/workflow-gh-calls.test.ts. Comments and the changelog line only; the changelog format test passes.
@neuromechanist
neuromechanist merged commit f9b136f into dev Oct 12, 2026
18 checks passed
@neuromechanist
neuromechanist deleted the fix/drift-workflow-gh-repo branch October 12, 2026 22:36
neuromechanist added a commit that referenced this pull request Oct 13, 2026
Keeps dev's #1711, #1719, #1720 and #1724 changelog entries and this branch's two, and dev's ADR index lines with this branch's ADR 0098 line.
This was referenced Oct 13, 2026

This branch was previously deployed

1 inactive deployment
npm — e0ecf062 Deployed Oct 12, 2026 by neuromechanist via publish #3365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant