Repository navigation
bug(hooks): get_staged_files ignored its file-type filter in CI, and a parse crash was reported as a Redis violation #14034
Description
Activity
- added 5 commits that reference this issue
on Aug 23, 2026 Delivered and merged.
- PR: refactor(ci): consolidate duplicated, drifted and never-run CI guards (#14371, #13984, #12986, #14034) #14883 — squash-merged as
ac754f5e0 - CI: 47 success / 9 skipped / 0 failures, deduped to the latest run per check name on head
a9d3c9805, including all 12python-suiteshards. Up to date with base at merge. - Review: independent
code-reviewerpass. It reconstructed all three pre-merge detectors from the rebase target and diffed them byte-for-byte rather than trusting the PR's union table.
Verified in base after merge:
scripts/lib/hardcoded-value-rules.sh PRESENT pipeline-scripts/check_baseline_no_growth.sh PRESENT pipeline-scripts/hardcoded_values_baseline.txt PRESENT scripts/lib/git-scope.sh PRESENTUnion preserved — rules a survivor-pick would have deleted:
Rule Existed only in Now VM IP, any fourth octet CI scanner kept wide; the hook's narrow (19|2[0-5])did not winPorts 8443 / 5432 / 9090 CI scanner's PORT_PATTERN— declared and never grep'dwired in for the first time Per-value SSOT key suggestions, generic model regex, hardcoded-URL rule dormant fork carried Account identity ( User=,chown, sudoers)CI scanner carried offset=0as WARNING not VIOLATIONhook severity preserved scripts/lib/hardcoded_value_rules_test.pyfails by name per former detector, so a substitution cannot pass as a merge.One HIGH finding was raised in review and fixed before merge, not deferred. The baseline suppressing 1977 findings had no anti-growth check: a PR could hardcode a value and append a matching baseline line in the same commit, and
ssot-coveragewould reportssot_violations=0.check_baseline_no_growth.shnow diffs the baseline against the base ref and fails on any new key or increased count, failing closed on an unresolvable base, an unreadable baseline, or a parse error. Mutation-proved in a scratch repo both directions — growth red, shrinkage green.A real credential exposure was found and fixed while doing it. Two
postgresql://user:pass@host/dbvalues were already sitting in the generated baseline, a tracked file that also reaches public CI output. One shared_hv_redact_userinfonow serves both the DSN and URL rules; scheme and host survive so findings stay actionable. Verified in base: zerouser:pass@patterns remain, and the baseline totals are unchanged at 1434 lines / 1977 — the redaction dropped no finding.Also fixed:
api-wiring— a required check — omittedautobot_shared/**/*.pyfrom its path filter whileaudit_api_wiring.pyimports two modules from that tree, so it reported green over an audit that never ran (#12986).#14181 was deliberately not closed by this PR — measured at 8/10 on one criterion with the remainder blocked by epic #7442. Follow-ups filed: #14884, #14885, #14891.
- PR: refactor(ci): consolidate duplicated, drifted and never-run CI guards (#14371, #13984, #12986, #14034) #14883 — squash-merged as
Root-caused while diagnosing a red
code-qualitycheck on PR #13945. Fixed there; filing so thescope of what was broken is on record, because it affected every hook using the shared helper.
The bug
autobot-infrastructure/shared/scripts/hooks/lib/_common.sh:42-52:The argv branch returned the file list verbatim, without applying
$pattern. Both invocationpaths are documented right above it (pre-commit passes no args; CI wrappers pass argv), so the
filter worked locally and was silently bypassed in CI — the one place nobody watches it.
What it produced
pre-commit-no-direct-redisdeclaresget_staged_files '\.py$' "$@". In CI it therefore received.vuefiles and handed them to a Python tokenizer.WorkflowCanvas.vueraised:A Vue file with no Redis in it, reported as a direct Redis connection. The hook caught
tokenize.TokenErrorbutIndentationErroris aSyntaxError, so the exception escaped, theinterpreter exited non-zero, and the shell wrapper counted the crash as a violation.
Two independent defects, either of which alone is enough to mis-report:
Fixed in PR #13945
_common.shapplies$patternon both branches, so the two invocation paths agree.(TokenError, SyntaxError, ValueError)and printsSKIP <path>: not parseable as Python (<ExcType>)to stderr — visible, so a genuinely broken Python file is notsilently unscanned.
Verified both directions: a real
redis.Redis(still blocks (exit 1), an unparseable file skipswithout a violation, and the previously-red file set now exits 0.
Why this is worth its own issue
This is the fifth defect of the same shape found today: a check that reports something other
than what it measured. The others are the org chart's
is_humanbranch (#13936), the Kanban board(#13993), the canvas pan gesture (#13996), and the contact no-login test (#13969 review). Related:
#13200 already records that 3 of 4 pre-commit checkers are untested — this is what that costs.
Ask
get_staged_filesfor the same latent mis-scan (the filter bypasswas repo-wide; only the redis hook happened to crash loudly enough to notice).
line and will regress silently without one.