Skip to content

feat(bin): add fast local lint mode - #2891

Merged
kunchenguid merged 5 commits into
mainfrom
fm/firstmate-lint-fast-mode-r1
Aug 23, 2026
Merged

kunchenguid merged 5 commits into
mainfrom
fm/firstmate-lint-fast-mode-r1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Implement the FAST LOCAL lint mode identified by the lint-resource investigation. Add an explicit flag or environment mode on bin/fm-lint.sh that passes ShellCheck --extended-analysis=false for routine local checks, while CI and the no-mistakes gate remain unchanged and default to full analysis. Do not weaken CI or alter unrelated lint behavior. Add executable-interface regressions proving the fast path disables extended analysis, the CI/full path keeps it enabled and is the CI default, and fast mode still catches ordinary shell lint problems. This changes firstmate shared tracked material; note that homes pick it up after merge and a coordinated self-update. Deliver through no-mistakes to one green PR; captain merges it, and do not merge it autonomously.

What Changed

  • Add a local-only fm-lint.sh --fast mode that disables ShellCheck extended analysis while preserving full analysis as the default and rejecting fast mode in CI.
  • Record the selected analysis mode in telemetry and document the complete lint interface.
  • Add executable-interface regressions covering fast mode, CI defaults, help output, telemetry, and ordinary ShellCheck findings.

Risk Assessment

✅ Low: The change is narrowly scoped, preserves full analysis for default CI and no-mistakes invocations, and includes behavior-level regression coverage for the new mode and prior fixes.

Testing

The targeted fm-lint executable suite passed, and end-to-end checks with real ShellCheck 0.11.0 demonstrated complete help output, fast-mode telemetry, full CI-default telemetry despite ambient FM_LINT_FAST=1, rejection of --fast in CI, and detection of an ordinary SC1007 defect in fast mode.

Evidence: End-to-end fast/full lint mode transcript

Source: End-to-end fast/full lint mode transcript

=== Public help interface ===
Usage:
  fm-lint.sh                         lint the context-selected file set (see above)
  fm-lint.sh --fast [path]...       local lint with extended analysis disabled
  fm-lint.sh <path>...               lint explicit roots with the same config
  fm-lint.sh --jobs <1|2> [path]...  override bounded worker count
  fm-lint.sh --telemetry <path> ...  write a quiet metrics snapshot
  fm-lint.sh --required-version      print the ShellCheck pin
  fm-lint.sh --list-files            print the file set that would be linted
  fm-lint.sh --help                  print this usage

=== Fast local mode with real ShellCheck ===
fm-lint.sh: ShellCheck 0.11.0 (pinned 0.11.0)
fm-lint.sh: fast local mode; ShellCheck extended analysis disabled
format	fm-lint-telemetry-v1
shellcheck_version	0.11.0
analysis_mode	fast
root_count	1

=== CI/default full mode ignores ambient FM_LINT_FAST=1 ===
fm-lint.sh: ShellCheck 0.11.0 (pinned 0.11.0)
fm-lint.sh: full ShellCheck extended analysis enabled
format	fm-lint-telemetry-v1
shellcheck_version	0.11.0
analysis_mode	full
root_count	1

=== Fast mode catches an ordinary ShellCheck defect ===
fm-lint.sh: ShellCheck 0.11.0 (pinned 0.11.0)
fm-lint.sh: fast local mode; ShellCheck extended analysis disabled

In /Users/kunchen/.no-mistakes/evidence/01M0R1NFG9QRR47554HCYND47B/ordinary-defect.sh line 3:
  local a= b=
          ^-- SC1007 (warning): Remove space after = if trying to assign a value (for empty string, use var='' ... ).

For more information:
  https://www.shellcheck.net/wiki/SC1007 -- Remove space after = if trying to...
exit_status=1

=== CI refuses the local-only --fast flag ===
fm-lint.sh: --fast is local-only; CI uses full ShellCheck analysis.
exit_status=2
Evidence: Fast-mode telemetry protocol output

Source: Fast-mode telemetry protocol output

format	fm-lint-telemetry-v1
git_head	d24e8c073ec727090c148797d2462502fa17edce
content_cksum	1990791522-86
shellcheck_version	0.11.0
analysis_mode	fast
jobs	2
root_count	1
direct_lines	2
direct_bytes	45
source_directives	0
source_boundary_directives	0
source_followed_directives	0
source_target_count	0
shard_1_weight_bytes	45
shard_2_weight_bytes	0
wall_seconds	0
worker_wall_sum_seconds	0.04
max_worker_wall_seconds	0.03
user_seconds	0.00
system_seconds	0.00
max_worker_rss_kib	24096
worker_rss_sum_kib	31376
shellcheck_processes_start	0
shellcheck_processes_end	0
load_average_start	5.13/3.99/3.34
load_average_end	5.13/3.99/3.34
aggregate_cpu_percent_start	70.90
aggregate_cpu_percent_end	70.90
result_exit	0
Evidence: CI/default full-mode telemetry protocol output

Source: CI/default full-mode telemetry protocol output

format	fm-lint-telemetry-v1
git_head	d24e8c073ec727090c148797d2462502fa17edce
content_cksum	1990791522-86
shellcheck_version	0.11.0
analysis_mode	full
jobs	2
root_count	1
direct_lines	2
direct_bytes	45
source_directives	0
source_boundary_directives	0
source_followed_directives	0
source_target_count	0
shard_1_weight_bytes	45
shard_2_weight_bytes	0
wall_seconds	0
worker_wall_sum_seconds	0.05
max_worker_wall_seconds	0.05
user_seconds	0.00
system_seconds	0.00
max_worker_rss_kib	24896
worker_rss_sum_kib	32176
shellcheck_processes_start	0
shellcheck_processes_end	0
load_average_start	5.13/3.99/3.34
load_average_end	5.13/3.99/3.34
aggregate_cpu_percent_start	55.10
aggregate_cpu_percent_end	50.20
result_exit	0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • 🚨 bin/fm-lint.sh:40 - The added header/usage lines shift the usage block through line 46, but fm_lint_usage still prints only lines 2–42. Consequently fm-lint.sh --help now omits --telemetry, --required-version, --list-files, and --help, contradicting “Do not ... alter unrelated lint behavior.” Replace the fixed line range with a boundary-based extraction or update it to cover the complete usage block.

🔧 Fix: Preserve complete fm-lint help output
2 issues (1 error, 1 warning) still open:

  • 🚨 bin/fm-lint.sh:127 - The requirement says “the no-mistakes gate [must] remain unchanged and default to full analysis,” but FAST=${FM_LINT_FAST:-0} lets an inherited FM_LINT_FAST=1 weaken .no-mistakes.yaml's unchanged bin/fm-lint.sh invocation because the CI-only guard does not recognize the local gate. Keep fast mode CLI-only or otherwise ensure the gate cannot inherit fast mode.
  • ⚠️ bin/fm-lint.sh:552 - A --fast --telemetry snapshot records ShellCheck version and resource measurements but not whether extended analysis was disabled. Fast and full snapshots can therefore appear configuration-equivalent while measuring different workloads; add the effective analysis mode to the telemetry protocol.

🔧 Fix: Isolate fast lint mode and report telemetry
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-lint.test.sh
  • ./bin/fm-lint.sh --help
  • CI='' GITHUB_ACTIONS='' ./bin/fm-lint.sh --fast --telemetry <fast-telemetry> <clean-fixture>
  • CI=true GITHUB_ACTIONS=true FM_LINT_FAST=1 ./bin/fm-lint.sh --telemetry <full-telemetry> <clean-fixture>
  • CI='' GITHUB_ACTIONS='' ./bin/fm-lint.sh --fast <ordinary-defect-fixture>
  • CI=true GITHUB_ACTIONS=true ./bin/fm-lint.sh --fast <clean-fixture>
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.