Skip to content

FP: cicd_rules/typescript_detected flags cartridges/**/adapter/*.ts despite the documented path_allow_prefixes exemption #602

Closed

Description

@hyperpolymath

Symptom

The Hypatia security-scan comment posted on boj-server-cartridges PRs (e.g. hyperpolymath/boj-server-cartridges#81, a 2-file docs/gateway change) reports 44 critical findings, all of the form:

"reason": "TypeScript file detected -- banned language",
"type": "banned_language_file",
"file": ".../cartridges/cross-cutting/orchestration/stack-orchestrator-mcp/adapter/planner.ts",
"rule_module": "cicd_rules", "severity": "critical"

— every one under cartridges/**/adapter/**.

Why these are false positives

boj-server-cartridges/.claude/CLAUDE.md §"TypeScript / ReScript Exemptions (adapters)" documents cartridges/**/adapter/** (*.ts, 34 files) as an approved exemption class (MCP/LSP adapter glue against TS-native SDKs — the same carve-out boj-server documents for its 6 adapters), and states:

The canonical source of truth is the path_allow_prefixes field on the hypatia rules cicd_rules/typescript_detected and cicd_rules/rescript_detected in hyperpolymath/hypatia; this table mirrors that for human readability.

So either (a) the deployed rule's path_allow_prefixes does not actually contain the cartridges/*/adapter/ prefixes the CLAUDE.md says it mirrors, (b) the scan workflow runs a rule/config snapshot that predates the exemption, or (c) the prefix matching fails against the runner's absolute paths (/home/runner/work/boj-server-cartridges/boj-server-cartridges/cartridges/... vs a repo-relative prefix — worth checking the matcher normalises to repo-relative before comparing).

Impact

Every PR to the cartridge registry gets a "🔴 Critical ×44 — Action Required" banner for pre-existing, explicitly-exempted files. That's the FP-recurrence/credit-burn pattern hypatia's own Scanner Hygiene doctrine exists to prevent (cf. the PR #237 post-mortem, #260): reviewers learn to ignore the banner, which is how real criticals get missed.

Suggested fix (at source, per doctrine #14)

  1. Diff the deployed cicd_rules/typescript_detected path_allow_prefixes against the exemption table in boj-server-cartridges/.claude/CLAUDE.md (and the boj-server mirror); add the missing adapter/ (and panels/ for rescript_detected) prefixes if absent.
  2. If the prefixes are present, check the matcher's path normalisation against the GitHub-runner absolute-path form above.
  3. Re-run the scan on boj-server-cartridges main and confirm the 44 criticals drop to 0 without any baseline entry (fix > baseline, per Scanner Hygiene).

Surfaced from a session where the scan banner fired on boj-server-cartridges#81, a two-file README/mod.js change touching no TypeScript. Not filed against the PR — none of the findings are in its diff.

Activity

  1. added
    bug
    cx/L2
    status:ready
    on Aug 3, 2026
  2. hyperpolymath commented on Aug 7, 2026

    @hyperpolymath
    OwnerAuthor

    Fixed — cause (a) of the three you listed: the prefixes genuinely were absent from the rule, not stale-deployment or path-normalisation.

    lib/rules/cicd_rules.ex typescript_detected.path_allow_prefixes had no adapter/ or cartridges/ entry at all, so the boj-server-cartridges CLAUDE.md table that names this list as its canonical source of truth was mirroring something that didn't exist. Cause (c) is ruled out: matching is String.contains?/2 (comment at the head of the list), so a bare /adapter/ substring matches the runner's absolute path form fine.

    Landed:

    • typescript_detected: added /adapter/ (documented MCP/LSP adapter-glue class).
    • rescript_detected + rescript_interface_detected: added the /panels/ counterpart you flagged.
    • Regression test in test/rules/cicd_rules_typescript_test.exs covering all three path shapes — repo-relative, nested, and the full /home/runner/work/... absolute form.
    • Bonus, same defect family found while in there: four vlang_detected entries (linguist/samples, HOL/examples/PSL, echidna/examples, echidna/tests/live_goals) carried a leading slash, which String.contains?/2 can never match against repo-root-relative paths — the Coq/Verilog exemptions their tests asserted were dead. Fixed; that also closes test: 7 DETERMINISTIC Elixir failures (fail in isolation) — separate from the #643 order-dependent cluster #645 items 1–2.
    • Also removed the drifted @banned_lang_ts_carveouts duplicate table in lib/hypatia/scanner_suppression.ex (3 of ~12 carve-outs, the standards#382 re-drift trap) after verifying every entry is covered by the canonical path_allow_prefixes delegation. One list now, per doctrine.

    Verified locally: typescript/rescript/vlang/suppression suites 75/75 green.

    Step 3 of your suggested fix (re-run the scan on boj-server-cartridges and confirm 44 → 0) is NOT done and is blocked on #484 — the deployed scanner lags main, so this fix will not reach live scans until that's resolved. Closing on the source fix; please reopen or track under #484 if the banner persists after the next scanner refresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcx/L2status:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions