Skip to content

Fix fm-dod-lib lint on carry and flag partial changed-file lint - #43

Merged
guybeju merged 2 commits into
carryfrom
fm/carry-lint-dod-lib
Nov 17, 2026
Merged

guybeju merged 2 commits into
carryfrom
fm/carry-lint-dod-lib

Conversation

@guybeju

@guybeju guybeju commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Closes #39

GitHub only acts on closing keywords when a PR merges into the repository's default branch (main here). This PR targets carry, so merging it will not close issue 39 on its own; close the issue by hand after the merge.

What changes

  • bin/fm-dod-lib.sh: fm_brief_switch_delivery keeps the three old and three new contract fragments in two indexed arrays, old and new, read by index. There is no ${!name} indirection left, so ShellCheck sees every read. Behaviour is unchanged.
  • bin/fm-dod-lib.sh: FM_BRIEF_SWITCH_FROM keeps a reasoned # shellcheck disable=SC2034 comment naming its reader, bin/fm-control.sh, which checks it after the call returns. Removing the global would change fm-control.sh's interface, so it stays.
  • bin/fm-lint.sh: a no-argument run in local changed-file mode now ends with two lines. The first says NOT A FULL LINT and names the codes it did not check (SC1091, SC2034, SC2153, SC2329). The second gives the exact explicit-path command that checks them for the same files. Exit status, file selection and analysis flags are unchanged. Explicit-path, CI, partition and main runs print nothing new.
  • firstmate-coding-guidelines and CONTRIBUTING.md: before calling a script change done, run bin/fm-lint.sh with every changed shell file as an explicit path, and never report a no-argument branch run alone as lint passing.

Lint at the PR head (ShellCheck 0.11.0, the pinned version)

$ bash bin/fm-lint.sh bin/fm-dod-lib.sh
fm-lint.sh: ShellCheck 0.11.0 (pinned 0.11.0)
fm-lint.sh: full ShellCheck extended analysis enabled
exit=0

Before this change, at origin/carry 28336ef, the same command exits 1 with the seven SC2034 warnings the issue lists (lines 409, 426 and 428).

bin/fm-lint.sh bin/fm-promote.sh bin/fm-brief.sh bin/fm-control.sh bin/fm-lint.sh tests/fm-lint.test.sh also exits 0.

Full canonical lint at the PR head, run the way CI runs it (bin/fm-lint.sh --partition 1of2 and --partition 2of2): partition 1 exits 0. Partition 2 exits 1, and its only findings are in tests/fm-daemon.test.sh (see the last section). No topic-board file has a finding.

Why PR 26's lint passed

  • Observed: at cb9ef48, a bare bin/fm-lint.sh (pinned ShellCheck 0.11.0 and actionlint 1.7.12) prints local changed-file mode; ShellCheck source following disabled, lints 30 changed files including bin/fm-dod-lib.sh, and exits 0. bin/fm-lint.sh bin/fm-dod-lib.sh at the same commit exits 1 with the seven warnings.
  • Observed: changed-file mode leaves out SC1091, SC2034, SC2153 and SC2329 on purpose (upstream fix: reduce local ShellCheck source-analysis cost kunchenguid/firstmate#3778: following sources locally peaked above 8 GB for a single file) and leaves them to CI on PRs to main.
  • Observed: the PR 26 worker had the pinned ShellCheck 0.11.0 and actionlint installed through the repository installers, and its PR body lists a bare bin/fm-lint.sh as passing.
  • Inferred from that PR body: the worker ran the bare, no-argument form, which reported exit 0 without checking SC2034.
  • Observed: nothing on carry runs lint automatically. .github/workflows/ci.yml triggers only for main, and the fork has no active GitHub workflows (the Actions workflows API lists none).

What this does and does not fix

This narrows the gap and does not close it. A worker that follows the guideline, or reads the new closing lines, runs the source-aware check, but nothing enforces it on PRs to carry until a lint check runs on them. That needs a repository setting and is outside this PR. The no-mistakes lint step uses the same changed-file mode, so it gets the same notice and has the same limit.

The generated worker instructions (bin/fm-brief.sh, bin/fm-dod-lib.sh) name no lint command, so they needed no correction.

On this fork the changed-file base is fixed to origin/main, so the command the notice prints covers the whole carry delta (37 to 38 shell files), not just the branch's own diff. Measured on this machine, that source-aware run took 2m59s with a peak process RSS of about 12.7 GB. This PR does not change the base.

Tests

  • bash tests/fm-lint.test.sh: 50 ok, exit 0. The new test_changed_mode_ends_by_naming_the_unchecked_codes_and_full_command checks the notice text, checks that the last line is the exact explicit-path command for the changed files, and checks that an explicit-path run does not print it. Two existing assertions that a changed-mode run reports no SC2034 or SC2329 finding now match ShellCheck's finding form (SC2034 () instead of the bare code, which the notice itself names.
  • bash tests/fm-dod-lib.test.sh: all pass. Changing the replacement to always use the first new fragment makes it fail.
  • bin/fm-doc-audience-check.sh: ok.

Reported, not changed

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