Skip to content

feat(repo scan): a gate any repository can adopt (#851) - #898

Merged
napetrov merged 8 commits into
intel:mainfrom
vchamarthi:feat/scan-gate
Nov 22, 2026
Merged

napetrov merged 8 commits into
intel:mainfrom
vchamarthi:feat/scan-gate

Conversation

@vchamarthi

@vchamarthi vchamarthi commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #851.

repo scan --fail-on-fail could not gate a product repository: on 12 Intel repositories, 18 of the 19 scan failures in product repos were dokimi misreading the docs, not wrong docs. Fixing each misread in dokimi does not scale to the next 100 repositories, so this moves the noise decision to the repository and gates on drift instead of on the starting state.

What this changes

Part Change
identifiers A bare name the tree lacks (mkl_random, PyArray_Resize) is unresolved_identifier, not fail: it may be an external API, a sibling package or a builtin. A name that is a tracked file's stem (bench_fftnd for bench_fftnd.py) is ok_stem. Paths, links and scripts still fail.
.dokimi/scan.toml Repo-owned [[ignore]] entries (pattern, optional kind, required reason), and identifiers = "fail" to opt back in. The report's scan_config block lists each entry with its hit count; a file with any error keeps every default, adds a warning and makes the scan incomplete.
--baseline FILE An earlier report (repo scan --out, or the --json envelope). --fail-on-fail then counts only fail claims the baseline does not hold; claims match on file, kind and text, not line. The baseline block gives known, new, fixed.
SARIF report summary --format sarif: SARIF 2.1.0 with file and line, for GitHub code scanning, Azure DevOps, GitLab and Jenkins. A check that failed or did not run is an error result.

Smaller fixes found in the same assessment:

  • Doxygen /// is not read as a Bazel label.
  • pipe-to-shell skips curl … | python -c, python -m json.tool and node -e when the inline program does not exec, eval or substitute a command (the downloaded bytes are data), but not sh -e or ruby -E.
  • "Use to …" and "Use this skill to …" count as a when-clause.
  • catalog formats counts skills a plugin's skills key or a sibling marketplace.json declares.
  • memory lint refuses a repository root instead of linting README and AGENTS.md as memory entries.

Behaviour change

A missing bare identifier no longer fails by default. Two expectations in test_repo_l0.py (GhostWidget, OnlyInDocs) move to unresolved_identifier. A repository that wants the old behaviour sets identifiers = "fail". Listed under "Changed" in the changelog.

Evidence

Rescan of the same 12 clones (shallow, no .git):

Before After
False fails in product repos 18 1 (mkl-service actions/cache, named in prose and used by no workflow: an ignore entry)
Real drift, gpu-ai-skills scripts/publish.sh fail fail
gpu-ai-skills catalog check warnings 8 (4 false) 4
gpu-ai-skills Claude plugin skills counted 0 22
Scan against its own baseline n/a exit 0 on every repo with guidance

Tests

Not exercised: --changed-from and git-history checks, since the clones had no history.

- A bare identifier the tree lacks is unresolved_identifier, not fail; a
  file stem (bench_fftnd for bench_fftnd.py) is ok_stem.
- .dokimi/scan.toml: repo-owned [[ignore]] entries with reasons, and
  identifiers = "fail" to opt back in; scan_config in the report.
- --baseline FILE: --fail-on-fail counts only fail claims the earlier
  report does not also fail; baseline block gives known/new/fixed.
- report summary --format sarif (SARIF 2.1.0 with file and line).
- Fixes: Doxygen /// is not a Bazel label; pipe-to-shell skips python -c,
  -m and node -e; "Use to" is a when cue; catalog formats counts skills a
  marketplace.json declares; memory lint refuses a repository root.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi
vchamarthi requested a review from a team as a code owner November 18, 2026 04:53
Copilot AI balanced review requested due to automatic review settings November 18, 2026 04:53
@exai-bot

exai-bot commented Nov 18, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit 31d2953 was not reviewed. This PR has reached its review limit (6 reviews).

CI at `31d2953`: 11 still running, 2 passing, 1 skipped
Check Status
Build docs (strict) still running
CLI interface diff still running
CodeQL (actions) still running
CodeQL (python) still running
External catalog smoke test (uxlfoundation/skills) still running
Platforms and Python versions still running
Static checks (ruff, schema, zizmor, licenses, pre-commit, bandit, secrets, changelog, schema com... still running
Windows smoke test (py3.13) still running
benchmark still running
mypy still running

1 more not listed.

To review this commit: re-request review from exai-bot in the Reviewers list.

<details><summary>Last review (7f838e1): 7 medium, 1 low</summary>

Open threads from the bot: 0

</details>

Comment thread dokimi/docs/repo-evaluation-contract.md Resolved
Comment thread dokimi/docs/repo-evaluation-contract.md Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/commands/repo.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/skills/formats.py Resolved
Comment thread dokimi/dokimi/skills/formats.py Resolved
Comment thread dokimi/dokimi/skills/formats.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical regressions allow piped shell execution to evade detection and same-path report output to overwrite the baseline before comparison, hiding new failures and incorrectly returning success.

7 open issues
What changed in this PR

7 new findings. This PR makes dokimi’s model-free repository scan easier to adopt as a CI gate, using repository-owned settings and baselines to distinguish new drift from existing noise.

Changes:

  • Adds baseline-aware gating, ignore rules, and configurable handling of missing identifiers.
  • Adds SARIF output and updates report schemas, CLI documentation, and regression tests.
  • Refines command and guidance checks, plugin skill counting, and memory-directory validation.
File Description
dokimi/​tests/​test_scan_gate.py Tests gating, SARIF, and related fixes.
dokimi/​tests/​test_repo_l0.py Updates missing-identifier expectations.
dokimi/​dokimi/​skills/​formats.py Counts plugin- and marketplace-declared skills.
dokimi/​dokimi/​schemas/​repo_readiness.v1.json Allows configuration and baseline metadata.
dokimi/​dokimi/​repos/​l0/​config.py Implements scan settings and baseline matching.
dokimi/​dokimi/​repos/​l0/​adapters.py Excludes Doxygen markers from Bazel labels.
dokimi/​dokimi/​repos/​l0/​__init__.py Applies repository settings during scans.
dokimi/​dokimi/​report/​summary.py Adds SARIF rendering.
dokimi/​dokimi/​memory/​store.py Rejects repository roots as memory directories.
dokimi/​dokimi/​external/​when_cues.py Recognizes “Use to” descriptions.
dokimi/​dokimi/​external/​command_checks.py Refines pipe-to-interpreter detection.
dokimi/​dokimi/​commands/​report.py Exposes the SARIF format option.
dokimi/​dokimi/​commands/​repo.py Adds baseline-aware scan gating.
dokimi/​dokimi/​commands/​repo_scan.py Loads baselines and reports known failures.
dokimi/​docs/​repo-evaluation-contract.md Documents scan settings and baseline behavior.
dokimi/​docs/​reference/​cli-interface.json Records the new CLI options.
dokimi/​changelog.d/​20261116_220000_vchamarthi_scan-gate.md Records features, fixes, and changed defaults.

Review effort: Balanced

Comment thread dokimi/dokimi/commands/repo.py Outdated
except OSError as exc:
print(f"✗ cannot write {args.out}: {exc}", file=sys.stderr)
sys.exit(EXIT_USAGE)
baseline_from(args, payload)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: baseline_from runs before --out is written (commands/repo.py:168), so the saved report holds the baseline block and --out may be the baseline file. Pinned by tests/test_scan_gate.py::test_the_baseline_is_applied_before_out_overwrites_it.

Comment on lines +50 to +53
r"(?:(?:ba|z|da|k)?sh|fish|python(?:3(?:\.\d+)?)?|node|perl|ruby)\b"
# `python -c PROGRAM`, `python -m json.tool`, `node -e`, `perl -e`: the program is on the command line and the
# download is only its input (JSON to parse), so nothing downloaded is run.
r"(?![ \t]+-[cme](?![\w-]))"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: the -e/-m exemption is per interpreter and a shell is not exempt; curl … | sh -e and | bash -e fire. Pinned by tests/test_scan_gate.py::test_pipe_to_shell_skips_an_interpreter_that_runs_its_own_program.

Comment on lines +168 to +179
from dokimi.repos.l0.config import apply_baseline

if not getattr(args, "baseline", None):
return
try:
doc = json.loads(Path(args.baseline).read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise InputError(f"--baseline {args.baseline}: {exc}") from None
doc = doc.get("data", doc) if isinstance(doc, dict) and doc.get("schema_version") == "cli_output.v1" else doc
if not isinstance(doc, dict) or not isinstance(doc.get("claims"), list):
raise InputError(f"--baseline {args.baseline}: not a repo_readiness.v1 report (no claims list)")
apply_baseline(payload, doc, args.baseline)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: baseline_from refuses a claims entry that is not an object with an input error (commands/repo_scan.py), so {"claims": [null]} exits 2 instead of crashing. Pinned by tests/test_scan_gate.py::test_a_baseline_claim_that_is_not_an_object_is_an_input_error.

Comment thread dokimi/dokimi/report/summary.py Outdated
Comment on lines +275 to +282
for c in summary["checks"]:
if c["state"] in ("failed", "invalid", "not_run", "infra_error"):
result(f"dokimi/{c['kind'] or 'input'}/{c['state']}", "error",
f"{c['kind'] or c['source']}: {c['state']}: {c['reason'] or ''}".rstrip(": "), None, None)
for s in summary["subjects"]:
for f in s["findings"]:
result(f"dokimi/{f['check']}/{f.get('code')}", _SARIF_LEVEL.get(str(f.get("level")), "note"),
f"{s['subject']}: {f.get('message')}", f.get("file"), f.get("line"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: a check in fail or a stopped state and a subject with a bad verdict and no findings are SARIF results, as in render_annotations(). Pinned by tests/test_scan_gate.py::test_sarif_keeps_a_failed_verdict_with_no_findings.

Comment thread dokimi/dokimi/repos/l0/config.py Outdated
errors.append(f"{source}: identifiers must be one of {', '.join(IDENTIFIER_POLICIES)}, not {identifiers!r}")
identifiers = "unresolved"
ignores: list[Ignore] = []
for i, entry in enumerate(data.get("ignore") or [], 1):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: a non-list ignore is a config error and keeps the defaults (config.py parse_config). Pinned by tests/test_scan_gate.py::test_a_scalar_ignore_is_a_config_error_not_a_crash.

Comment thread dokimi/dokimi/repos/l0/config.py Outdated
unknown = sorted(set(data) - {"identifiers", "ignore"})
if unknown:
errors.append(f"{source}: unknown key(s) {', '.join(unknown)}")
return ScanConfig(identifiers, tuple(ignores), source, tuple(errors))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: any config error returns the defaults with no ignores (parse_config: if errors: return ScanConfig(source=source, errors=...)). Pinned by tests/test_scan_gate.py::test_a_config_with_any_error_keeps_every_default.

Comment thread dokimi/dokimi/skills/formats.py Outdated
bundle = path.parent if fmt == FORMAT_GEMINI_EXTENSION else path.parent.parent
pkg.details["skills"] = len(list((bundle / "skills").glob("*/SKILL.md")))
if fmt == FORMAT_CLAUDE_PLUGIN and not pkg.details["skills"]:
pkg.details["skills"] = _declared_skills(bundle, data, path.parent / "marketplace.json")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already holds on the head: a34ffca: a plugins that is not a list is recorded as a problem, not raised. Pinned by tests/test_scan_gate.py::test_a_marketplace_whose_plugins_is_not_a_list_is_a_problem.

Fixes review findings on the scan gate:
- scan.toml: any error discards every setting; a non-list `ignore` is an
  error, not a TypeError; an unreadable or dangling link is a warning.
- [[ignore]] now applies to merged `--static` claims; a `baselined` mark
  from a static checker is dropped, so only --baseline marks a claim known.
- --baseline is applied before --out is written; a non-object claim entry
  is an input error (exit 2).
- pipe-to-shell exempts only the inline-program flag of its own
  interpreter: `sh -e` fires, `python3.11 -m` does not.
- SARIF: file URIs are percent-encoded with `/` separators; failed,
  stopped and bad-verdict checks and findingless subjects are results.
- catalog formats: Claude plugin skills are the union of `skills/` and
  declared directories; a marketplace source counts its `skills/`; a
  non-list `plugins` is a problem, not a crash.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@github-actions github-actions Bot added the cli-interface-change Changes dokimi's user-facing CLI surface label Nov 18, 2026
@github-actions

Copy link
Copy Markdown

CLI interface change detected

This PR changes dokimi's user-facing CLI surface (commands and/or options):

~ `dokimi repo scan` parameters changed:
    + added option `--baseline`
~ `dokimi report summary` parameters changed:
    ~ changed option `--format`: choices: ["'annotations'", "'json'", "'markdown'"] -> ["'annotations'", "'json'", "'markdown'", "'sarif'"]

Updated on every push; the cli-interface-change label is on while the diff is non-empty.

@codecov-commenter

codecov-commenter commented Nov 18, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 96.16858% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.91%. Comparing base (36075a0) to head (31d2953).

Files with missing lines Patch % Lines
dokimi/dokimi/report/summary.py 92.85% 2 Missing and 2 partials ⚠️
dokimi/dokimi/skills/formats.py 89.18% 1 Missing and 3 partials ⚠️
dokimi/dokimi/commands/repo_scan.py 93.10% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #898      +/-   ##
==========================================
- Coverage   95.92%   95.91%   -0.01%     
==========================================
  Files         450      451       +1     
  Lines       59527    59770     +243     
  Branches    10265    10316      +51     
==========================================
+ Hits        57101    57330     +229     
- Misses       1507     1512       +5     
- Partials      919      928       +9     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/repo.py 99.04% <100.00%> (+<0.01%) ⬆️
dokimi/dokimi/commands/report.py 82.14% <100.00%> (ø)
dokimi/dokimi/external/command_checks.py 96.75% <100.00%> (+0.03%) ⬆️
dokimi/dokimi/external/when_cues.py 100.00% <ø> (ø)
dokimi/dokimi/memory/store.py 95.48% <100.00%> (+0.06%) ⬆️
dokimi/dokimi/repos/l0/__init__.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/l0/adapters.py 94.30% <100.00%> (ø)
dokimi/dokimi/repos/l0/config.py 100.00% <100.00%> (ø)
dokimi/dokimi/commands/repo_scan.py 92.48% <93.10%> (-0.18%) ⬇️
dokimi/dokimi/report/summary.py 94.97% <92.85%> (-0.38%) ⬇️
... and 1 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on feat/scan-gate (913da71..a34ffca)

Next: a re-review of the new head.

PR description updated

  • pipe-to-shell skips curl … | python -c, python -m and node -e (the downloaded bytes are data), but not sh -e.
  • a file with any error keeps every default and adds a warning.

Threads and comments

  • 14 fixed; each answered in its thread.

Verified on the new head: ✅ 16/16 tests fail before the fix, pass after · ✅ full suite with main merged in: 23123 passed · ✅ second reader: nothing raised

What each test shows
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • each thread's test: fails before, passes after.
  • pipe-to-shell with python3.11 -m and bash -e: fails before, passes after.
  • scalar ignore: fails before, passes after.
  • non-object baseline claims: fails before, passes after.
  • plugins not a list: fails before, passes after.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Comment thread dokimi/dokimi/report/summary.py Resolved
Comment thread dokimi/dokimi/report/summary.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/skills/formats.py Resolved
Comment thread dokimi/dokimi/skills/formats.py Resolved
- pipe-to-shell: an inline python -c, node -e, perl -e or ruby -e
  program that execs or evals still fires; ruby -E is not an
  inline program.
- sarif: a drive-qualified Windows path is a file:/// URI; a
  pathless finding, failed check or bare verdict is located at
  its input file.
- scan.toml: a non-string ignore kind is a config error, not a
  match-any rule; a symlink loop is a warning, not exit 5.
- catalog formats: a skill reached by a symlink and a declared
  path counts once; an unreadable or non-object marketplace.json
  is a problem.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on feat/scan-gate (a34ffca..79c0f05)

Next: a re-review of the new head.

Changes

  • pipe-to-shell fires on an inline program that execs stdin and on ruby -E.
  • SARIF locations for Windows paths and pathless results.
  • A non-string ignore kind is a config error.
  • A symlink loop at .dokimi/scan.toml is a warning.
  • catalog formats counts a symlinked skill once and reports a bad marketplace.

PR description updated

  • pipe-to-shell skips curl … | python -c, python -m and node -e when the inline program does not exec or eval (the downloaded bytes are data), but not sh -e or ruby -E.

Threads and comments

  • 8 fixed; each answered in its thread.
  • 7 threads already settled on the head; answered with what settles it.

Verified on the new head: ✅ 7/7 tests fail before the fix, pass after · ✅ full suite with main merged in: 23352 passed · ✅ second reader: nothing raised · ⚠️ 1 test removed or renamed

What each test shows
  • pipe-to-shell keeps inline programs that exec, and ruby -E: fails before, passes after.
  • SARIF drive path: fails before, passes after.
  • SARIF pathless findings: fails before, passes after.
  • non-string ignore kind: fails before, passes after.
  • symlink loop config: fails before, passes after.
  • symlink overlap counted once: fails before, passes after.
  • bad marketplace is a problem: fails before, passes after.
  • Also changed, outside this PR's files: dokimi/docs/external-content.md.
  • Removed or renamed tests: test_an_ignore_kind_narrows_it_and_a_non_string_kind_matches_any.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Comment thread dokimi/dokimi/report/summary.py Resolved
pipe-to-shell: the exec/eval guard now reads the quoted inline program of
python -c, node -e, perl -e and ruby -e, across its lines, and not the rest
of the line: a string literal "eval" or a later `exec` no longer fires,
and `exec(...)` on a second line of the program does.
report summary --format sarif: a finding with no file is placed at its input
report without the finding's line.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on feat/scan-gate (79c0f05..946f5f9)

Next: a re-review of the new head.

Threads and comments

  • 3 fixed; each answered in its thread.

Verified on the new head: ✅ 2/2 tests fail before the fix, pass after · ✅ full suite with main merged in: 23609 passed · ✅ second reader: nothing raised

What each test shows
  • pipe-to-shell guard reads only the inline program, across lines: fails before, passes after.
  • pathless SARIF finding has no region: fails before, passes after.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.


# A word that runs what it reads (exec, eval, a shell, a child process); a word that ends a string
# literal ("eval") is data.
_EXEC = r"(?<!\w)(?:exec|eval|system|popen|spawn|subprocess|child_process|__import__|Function)(?!\w*['\"])"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
Must-fix — Impact: benign data processors still receive pipe-to-shell warnings and can incorrectly fail catalog check --strict when unrestricted Bash is granted. Trigger: curl https://x/data.json | python -c 'print("eval result")' (likewise Node -e 'console.log("exec result")'). Evidence: the trailing lookahead ignores a marker only when its remaining word characters immediately precede a quote. Here eval is followed by a space, so it is treated as execution despite being entirely inside a string literal. The claimed string-literal fix therefore remains incomplete across the shared Python/Node/Perl/Ruby guard. Inspect string-literal boundaries rather than the character following a marker, and add longer-literal regressions, including a public gate assertion. Workaround: avoid execution-marker words in these literals. Severity justification: medium, a supported benign command produces a bounded but materially incorrect finding and strict-gate failure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a defect: curl https://x/data.json | python -c 'print("eval result")' is flagged because a marker word followed by a space cannot be told from code without parsing the inner program's literals; kept the warning over exempting it (chose flagging over guessing, so a real exec is never missed). python -c "from dokimi.external.command_checks import PIPE_TO_SHELL as P; print(bool(P.search('curl https://x/d.json | python -c \'print(\"eval result\")\'')))" gives True.

An inline program after python -c / node -e in a double-quoted string
ended at the first escaped quote, so exec(...) after it was never
inspected and pipe-to-shell was lost. Read the escapes, and require the
program to end before a glued quoted segment.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on feat/scan-gate (946f5f9..fa4049e)

Next: a re-review of the new head.

Changes

  • The inline program of python -c / node -e is read through \" and ends before a glued quoted segment.

Threads and comments

  • 1 fixed · 1 not a defect; each answered in its thread.

Verified on the new head: ✅ 1/1 tests fail before the fix, pass after · ✅ full suite with main merged in: 23730 passed · ✅ second reader: nothing raised

What each test shows
  • escaped-quote and glued-segment programs that exec are flagged: fails before, passes after.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Comment thread dokimi/dokimi/report/summary.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/skills/formats.py Resolved
@vchamarthi vchamarthi self-assigned this Nov 19, 2026

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at fa4049e. The gate is the right shape: the baseline is applied before --out is written, a config with any error keeps the defaults, and ignores cover --static claims. Two things still let it pass when it should not: the pipe-to-shell exemption misses several commands that run the download, and a broken scan.toml silently drops identifiers = "fail". Smaller gaps are in the line comments.

Agreed with @exai-bot: the escaped unquoted program at command_checks.py:50; the unchecked [[ignore]] keys at config.py:81; the stem of a multi-dot name at config.py:146 (doc files are a second case, in that thread); the RuntimeError from a symlink loop at formats.py:201; the input path in the SARIF ruleId at summary.py:309. On flagging print("eval result") I agree with the author: a warning there is safer than a guess.

What I ran, at fa4049e:

  • make ci-local --offline: 23,110 tests passed, 72 skipped; the one FAIL row, schema_compat, is about docling_sources, suite_manifest and questions schemas that this PR does not touch (drift between the PR base and main).
  • PIPE_TO_SHELL on 9 commands, against this branch and the base regex: the 6 commands in the line comment are flagged on the base and not here; exec(sys.stdin.read()) and os.execvp still fire, -m json.tool does not.
  • repo scan --json on scratch trees: a repeated known path with --baseline, a misspelled kind, identifiers = "fail" with a typo key, doc and multi-dot stems; and report summary --format annotations on a baselined scan.

Checked, no issues

  • Baseline input: an envelope or a bare report is read, a claims entry that is not an object is exit 2, and a baselined key from --static is dropped.
  • Earlier threads: the Copilot threads that are still open are fixed on this head, as the author replied; each has a test.
  • Schema and docs: repo_readiness.v1 is only widened (scan_config, baseline); the contract and the changelog say the identifier default changed, so fail counts of new scans are lower than those of old ones.

Comment thread dokimi/dokimi/repos/l0/__init__.py Resolved
Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Comment thread dokimi/dokimi/commands/repo_scan.py Resolved
Comment thread dokimi/dokimi/external/when_cues.py Resolved
- pipe-to-shell: read every character of an unquoted inline program for
  exec markers; treat $(, backticks, runpy, *_eval and qx as running the
  input; exempt only `python -m json.tool`
- scan.toml: an unknown key inside [[ignore]] is a config error; any
  config error makes the scan incomplete so --fail-on-fail exits 1
- identifiers: stems come from non-doc files, minus the last extension only
- baseline: a key counts once per claim the baseline holds
- report summary: SARIF ruleId names the check, not the input file;
  annotations print a baselined claim as ::notice
- catalog formats: an unresolvable skills path is a package problem
- "use it to" / "use this to" are not a when-cue
- changelog fragment gets its SPDX header

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

🟢 Ready for re-review · 1 commit on feat/scan-gate (fa4049e..7f838e1)

Next: @vlad-perevezentsev: re-review the new head.

Changes

  • Unquoted inline program is scanned for exec markers throughout.
  • A repeat of a baselined failure is new.

PR description updated

  • pipe-to-shell skips curl … | python -c, python -m json.tool and node -e when the inline program does not exec, eval or substitute a command (the downloaded bytes are data), but not sh -e or ruby -E.
  • "Use to …" and "Use this skill to …" count as a when-clause.
  • a file with any error keeps every default, adds a warning and makes the scan incomplete.

Threads and comments

  • 11 fixed; each answered in its thread.

Verified on the new head: ✅ 9/9 tests fail before the fix, pass after · ✅ full suite with main merged in: 24015 passed · ✅ second reader: nothing raised

What each test shows
  • pipe-to-shell cases: fails before, passes after.
  • when cue: fails before, passes after.
  • sarif: fails before, passes after.
  • cfgkey: fails before, passes after.
  • stem: fails before, passes after.
  • loop: fails before, passes after.
  • incomplete: fails before, passes after.
  • base: fails before, passes after.
  • ann: fails before, passes after.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: CONTRACT (head 7f838e1)

  • Contract: changed. errors dokimi/dokimi/commands/repo_scan.py:174; errors dokimi/dokimi/commands/repo_scan.py:175
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

One blocking finding. I checked identifier handling, repository configuration, baseline multiplicity and SARIF rendering. The author’s 12-repository rescan figures were not independently repeated.

Focused tests on 7f838e186: 19 passed, 63 deselected in 1.50s. CI on head 7f838e1: 0 failing Actions jobs; merge base 1846bb5 is behind base tip 36075a0.

Comment thread dokimi/dokimi/repos/l0/config.py Resolved
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
… file stem

A claim such as WrongNamespace::DemoWidget was marked ok_stem when a
DemoWidget.py existed, so identifiers = "fail" no longer failed it.
The stem lookup now uses the whole claim text. Test added.

Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

Ready for re-review, @napetrov: 2 commits on feat/scan-gate (7f838e1..31d2953) answers your thread and your comment.

Changes:

  • apply_config looks up ok_stem by the full claim text, not the part after the last ::.

Threads and comments:

  • 1 fixed; each answered in its thread.
  • Fixed (comment by napetrov): blocking: qualified symbol accepted by file suffix; Same defect as the open thread on config.py: the stem lookup compares the full claim, test test_a_qualified_name_is_not_found_by_the_stem_of_its_last_component.

Not the PR's:

  • Outside the PR: dokimi/dokimi/novelty/symbols.py:201; A libmkl_rt.so exporting only mkl_set_num_threads, checked with prefix mkl_, adds mkl_rt to the known names, so the answer 'Call mkl_rt(1).' passes the veto.
  • Outside the PR: dokimi/dokimi/commands/repo_run.py:615; RUN_EXIT says a crashed cell exits 1, while repo_run.py:486-489 exits 5 (EXIT_INFRA) for a cell that crashed of the machinery.
  • Outside the PR: dokimi/dokimi/eval/reference_checks.py:459; With an mkl_ check from a header declaring only mkl_set_num_threads, 'Call the library function mkl_bogus_fn(1).' passes the identifier veto: the closing backtick stops the call check matching and 'library' triggers the exemption.

Checked on the new head:

  • Not passed: 11 tests removed or renamed
  • 1 of 1 tests fail before the fix and pass after
  • Full suite with main merged in: 24601 passed, 1 failure that main has too
What each test shows
  • A qualified name with an unrelated same-suffix file stays a failure: fails before, passes after.
  • Removed or renamed tests: test_a_line_that_breaks_the_version_1_shape_is_refused, test_cli_json_with_no_trace_read_is_failed_with_no_data, test_cli_missing_trace_exits_1, test_cross_judge_judge_dependent_exits_1_only_with_strict, test_cross_judge_strict_exits_1_when_one_of_several_arms_is_judge_dependent, test_cross_judge_strict_exits_1_when_only_one_of_several_arms_was_measured, test_cross_judge_strict_exits_1_when_require_validated_leaves_no_voter, test_cross_judge_strict_fails_when_no_arm_was_measured.

@napetrov
napetrov merged commit ddf427e into intel:main Nov 22, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli-interface-change Changes dokimi's user-facing CLI surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo scan: a gate that works on any repository: fail on new drift, fail only on certain claims, repo-owned ignores, SARIF

6 participants