Repository navigation
Description
Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)
This section supersedes any text below that conflicts with it.
Decisions
- Keep
--disable-nosem: yes. An inlinenosemgrepmust not silence a finding without review. Admission already honours the marker only where it exists at the base revision (review/suppression.py:129-160,config/constants.py:671), so Semgrep has to report every result. - Metrics and the version check: every
semgrep scancommand carries--metrics offand--disable-version-check. Semgrep 1.179.0's--disable-version-checkdoes whatSEMGREP_ENABLE_VERSION_CHECK=0does and shows in the argv, so no environment is passed (checked withsemgrep scan --helpat 1.179.0). There is no--dataflow-traces. - Output: findings come from
--sarif-output <workdir>/semgrep.sarif, read withsecurity/sarif.py'sread_sarif, so severity comes from the rule'ssecurity-severityand level (sarif.py:323-348). The JSON on stdout is read only forpaths.scanned,paths.skippedanderrors. Checked at 1.179.0: one offline run writes both, withpaths.scannedin the JSON. - One command builder:
build_semgrep_cmd(config/commands.py:214-225) builds everysemgrep scan. That covers the review (security/semgrep.py:124-133),devops scan sast(commands/scan.py:364-394), the canary (review/canary.py:415-424) and the agent tool (ai/tools/builtin_tools.py:350-357). The pack'ssemgrep --test(review/rules_pack.py:231-238) keeps its own command. - The MCP tool's default config:
auto(ai/mcp/server.py:2053) becomesDEFAULT_SEMGREP_CONFIG. Semgrep refuses--config autowith metrics off (checked at 1.179.0: "Cannot create auto config when metrics are off"). - The pack always runs: its
--configis added to every review scan and everydevops scan sastrun, whatever--confignames. Today it is added only with the default config (semgrep.py:130-132). - Registry rules on by default: yes. The review runs the cached
p/defaultplus the pack. S11's Semgrep pair, which the person-run check expects back, came fromp/default, and the pack holds only the recall set's rules. - The fetch step:
devops review rules fetch [--ruleset p/default], besidereview rules test(commands/review.py:2569-2573).- It downloads
CONST_SEMGREP_REGISTRY_URL_TEMPLATE = "https://semgrep.dev/c/{ruleset}"through the HTTP client factory (http/client.py:142). - It writes
<user data root>/semgrep/<ruleset slug>.yaml(core/repo.py:294-297), and beside it a.jsonwith the URL, sha256,retrieved_at, every rule id, the skipped interfile ids and each rule'smetadata.license. Both files are written atomically. --dry-runmakes no request and prints the URL and the two paths.- The cache code lives in a new
src/devops_cli/security/semgrep_registry.py.
- It downloads
- Digest pinning: before use, the review and
devops scan sastcheck the cached file's sha256 against its metadata, and a mismatch counts as a missing cache. The digest is recorded in profile.json assemgrep_registry_digest, besidetools_lock_digest(ai/review/profile.py:125), andreview scorecompares it like its other input digests (commands/review.py:1655-1661). - A missing cache: the review runs the pack alone. Semgrep's outcome is
coverage_gapwith the reasonregistry rules p/default not cached: run devops review rules fetch, which review.md and profile.json show.devops scan sastwith a registry ruleset and no cache exits 1 with the same message. Nothing fetches during a scan: tools run offline, and the fetch is its own step, outside feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772's network-less sandbox. - The TTL:
DEFAULT_SEMGREP_REGISTRY_TTL_SECONDS = 86_400inconfig/defaults.py. An older cache is still used, since its digest keeps the run reproducible, and the review prints a warning naming its age and the fetch command. Failing on age would block every review until someone refetched. - Interfile rules: a rule whose
options.interfileis true is skipped with--exclude-rule <id>, so the cached file stays byte-identical to the download and keeps its digest.--exclude-ruleis the only tuning mechanism, and fix(review): the review's scanner config drops the rules that never produced a valid finding on this repository #1024's exclusions use it too. - Rule ids: Semgrep prefixes a local config's rule ids with its directory path. Checked at 1.179.0: a rule
demoin/tmp/x/rules/r.yamlcame back astmp.x.rules.demo. Returned ids are mapped back to the ruleset's own ids by suffix against the id list in the metadata, asnormalize_pack_check_iddoes for the pack (review/rules_pack.py:74-77), so.devops/review.tomlsuppressions keep matching. - Licences: recorded per rule id in the metadata. AGPL rules are not skipped, because the cache is for the user's own internal use, and none of it is committed. Tests build synthetic rules in
tmp_path, and recorded tool output keeps rule ids only. - Batching: files are sorted by (suffix, path), and a batch holds files of one suffix, so files of one language share a batch without a list of languages. A batch closes when the suffix changes, at
DEFAULT_SEMGREP_REVIEW_BATCH_FILES(100) files orDEFAULT_SEMGREP_REVIEW_BATCH_BYTES = 1_500_000bytes, whichever comes first. 100 files at this repository's mean Python file size (13.9 KB over the 569 files undersrc/) is about 1.4 MB, so a batch of large files takes no longer than the measured 100-file batch. - The total budget:
DEFAULT_SEMGREP_REVIEW_BUDGET_SECONDS = 300.0inconfig/defaults.py, the old single-run timeout.- Each batch's timeout is the smaller of
DEFAULT_SECURITY_SCANNER_TIMEOUT_SECONDSand the time left. - Batches not started when the budget runs out are not run, and their files are listed as not scanned.
- At the measured 0.87 s a file (
defaults.py:242-245), 300 s covers the loop input's 328 files and keeps Semgrep inside P1a's 600 s review target.
- Each batch's timeout is the smaller of
paths.scanned: a target missing from it is listed as not scanned, with the reason frompaths.skippedwhen Semgrep gives one, and the outcome becomescoverage_gap.ScanOutcomegainsunscanned: dict[str, str](path to reason), whichmerge_outcomesmerges and the coverage matrix shows per file. fix(review): a branch review leaves the files it deletes out of persona pages and scanners, and a file a scanner cannot read does not mark the scanner failed #1140 reuses it for failed manifests.- Scope: the flags, the pack and the cache apply to
devops scan sast, the agent tool and the MCP tool as well, because the telemetry opt-out covers every Semgrep run. Batching and the budget apply to the review only. - Does feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772 gate this item? No. Offline comes from the flags and the local ruleset, and feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772 later wraps the same command in its sandbox.
- Opengrep: not now. That waits until opengrep#846 (PEP 758) merges and its taint recall is measured.
Delivery
-
PR 1 (S): one builder, the flags, SARIF output, the pack always on, and the MCP default. Tests first:
- each of the review,
scan sast, the canary and the agent tool builds an argv with--metrics off,--disable-version-checkand no--dataflow-traces; - review argv also has
--disable-nosemand--sarif-output; devops scan sast --config ./local-rulesstill adds the pack's--config;- the MCP default is not
auto; - a fake subprocess that returns recorded JSON and writes a recorded SARIF gives findings whose ids and severities come from the SARIF.
Files:
src/devops_cli/config/commands.py,src/devops_cli/security/semgrep.py,src/devops_cli/review/canary.py,src/devops_cli/ai/tools/builtin_tools.py,src/devops_cli/ai/mcp/server.py,tests/test_security_semgrep.py. Refs fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144. - each of the review,
-
PR 2 (M): the registry cache. Tests first:
devops review rules fetch, with a fake transport serving a synthetic two-rule YAML (oneoptions.interfile: true), writes the YAML and metadata with sha256,retrieved_at, both ids, the interfile id and the licences;--dry-runmakes no request;- the review argv for
p/defaultnames the cached file and--exclude-rulefor the interfile id; - with no cache, the argv names the pack alone and the outcome is
coverage_gapwith a reason namingdevops review rules fetch; - an edited cache file is treated the same way;
- a 25-hour-old cache is used and warns;
devops scan sastwith no cache exits 1;- a prefixed check id maps back to the registry id;
- profile.json carries
semgrep_registry_digest, andreview scorelists it.
Files:
src/devops_cli/security/semgrep_registry.py(new),src/devops_cli/security/semgrep.py,src/devops_cli/commands/review.py,src/devops_cli/commands/scan.py,src/devops_cli/ai/review/profile.py,src/devops_cli/config/defaults.py,src/devops_cli/config/constants.py,src/devops_cli/lang/en/help.py,tests/test_semgrep_registry.py(new), generated CLI docs. Refs fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144. -
PR 3 (M): batches, the budget and
paths.scanned. Tests first:- files
b.yaml,a.pyandc.pygive the batches[a.py, c.py]and[b.yaml], and with a byte cap below one file's size each file is its own batch; - with a fake clock where the first batch spends the budget, the second batch never runs, its files are listed with a budget reason, and the outcome is
coverage_gap; - a recorded JSON whose
paths.scannedlacks one target marks that file not scanned in the coverage matrix; merge_outcomeskeeps every batch'sunscanned.
Files:
src/devops_cli/security/semgrep.py,src/devops_cli/security/base.py,src/devops_cli/ai/review/pipeline.py,src/devops_cli/config/defaults.py,tests/test_security_semgrep.py. Closes fix(review): Semgrep runs pinned and offline with metrics off, from a cached registry ruleset plus devops-cli's tested rule pack #1144. - files
Acceptance criteria
- Every
semgrep scancommand devops-cli builds carries--metrics offand--disable-version-check, and none carries--dataflow-traces. Review scans keep--disable-nosem. - Review findings come from Semgrep's SARIF, with severity from the rule's metadata;
paths.scannedcomes from its JSON. - devops-cli's pack runs on every review and every
devops scan sastrun. -
devops review rules fetchcaches the ruleset with its URL, sha256, retrieval time, rule ids, interfile ids and licences. Reviews andscan sastuse the cache offline, check its digest, and record the digest in profile.json. - A missing or altered cache leaves the review on the pack alone, with a
coverage_gapreason namingdevops review rules fetch. A cache older than 24 h is used, with a warning. - Interfile rules are skipped with
--exclude-ruleand listed in the metadata. No registry rule text is committed, and tests use synthetic rules and recorded ids. - Review batches hold files of one suffix and close at 100 files or 1.5 MB. The stage stops starting batches after 300 s in total and lists the files it did not scan.
- A target missing from
paths.scannedshows as not scanned in the coverage matrix, with Semgrep's reason when it gives one. - (person-run) On the loop input, Semgrep completes in 5/5 runs, and S11's Semgrep pair and
config.py:514reappear. - Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each test under 1 s.
-
changelog.d/1144.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited. -
uv run devops cipasses.
Current references
- Review command:
src/devops_cli/security/semgrep.py:124-133; other targets:136-158; result parser:60-105; batches:259-275; entry:278-298; pack added only with the default config:130-132. - Shared builder:
src/devops_cli/config/commands.py:214-225. - Defaults:
DEFAULT_SEMGREP_CONFIGsrc/devops_cli/config/defaults.py:127; timeouts and batch size:240-246. - Scanner subprocess:
src/devops_cli/security/base.py:480-486,:521-522;ScanOutcome:80-112;merge_outcomes:115-130; statusessrc/devops_cli/config/constants.py:387-396. - Inline markers:
src/devops_cli/config/constants.py:669-674;src/devops_cli/review/suppression.py:129-160. - SARIF reader:
src/devops_cli/security/sarif.py:323-348,:484,:518. - Pack:
normalize_pack_check_idsrc/devops_cli/review/rules_pack.py:74-77; pack tests:231-238. - Other Semgrep callers:
src/devops_cli/review/canary.py:415-424;src/devops_cli/commands/scan.py:364-394;src/devops_cli/ai/tools/builtin_tools.py:350-357;src/devops_cli/ai/mcp/server.py:2052-2060. - Fetch command home:
src/devops_cli/commands/review.py:2569-2573; HTTP client factorysrc/devops_cli/http/client.py:142; user data rootsrc/devops_cli/core/repo.py:294-297. - Review inputs:
src/devops_cli/ai/review/profile.py:125,:347;review scoreinputssrc/devops_cli/commands/review.py:1655-1661. - Pipeline:
_scan_semgrepsrc/devops_cli/ai/review/pipeline.py:1551-1565; analyzer state:1334-1351; coverage matrix:1432-1472.
Dependencies and order
- fix(security): a review's isolated Semgrep scan hands Semgrep only targets under its working directory, so it finishes instead of rediscovering each file across the checkout #1079, feat(review): review tools install from a tools lock with exact versions, binary checksums and hashed Python requirements, and every review records them #1142, feat(review): review tools run at the project's declared language and platform versions, and count only after their output on a canary matches the recorded expected output #1143 and feat(review): devops-cli's rule pack turns the recall set's network-exposure entries into tested Semgrep rules, and CI runs the pack's tests when a rule changes #1145: closed.
- feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772: does not gate this item. When it lands, its executor wraps the command PR 1 builds.
- fix(review): the review's scanner config drops the rules that never produced a valid finding on this repository #1024: after PR 2. It adds its rule ids to the
--exclude-rulelist. - fix(review): a branch review leaves the files it deletes out of persona pages and scanners, and a file a scanner cannot read does not mark the scanner failed #1140: after PR 3. It reuses
ScanOutcome.unscannedfor a manifest a scanner failed on. - refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 (v0.2.37): independent. Both touch
ai/review/pipeline.py, this item only at_scan_semgrepand the coverage matrix, so either may land first. - refactor(review): review session store that owns layout, fingerprints and verdicts #771, feat(review): feedback export counts each review subject once and keeps every human verdict #877 and feat(review): verified findings about merged code enter the roadmap through intake #883 (v0.2.37): no overlap.
Problem
- The review pulls rules on every run. It runs
semgrep scan --json --config p/default --quiet <every file>[code: security/semgrep.py:93-114], which sends metrics by default [sourced: https://docs.semgrep.dev/metrics]. - Semgrep returned nothing in 12/12 reviews at the current code (D17). That loses runAsNonRoot, allowPrivilegeEscalation and config.py:514 [measured: loop §7].
- Registry rules are for internal use only: no redistribution and no service [sourced: https://semgrep.dev/legal/rules-license]. This repository is public.
- The registry ruleset:
https://semgrep.dev/c/p/defaultreturns 200 without login, with 1,074 rules. 56 of them need the paid cross-file engine (interfile: true), and 18 are AGPL-3.0 [measured: c-feasibility GET]. - CE output has no dataflow: under CE,
--dataflow-tracesyields null traces and no codeFlows [measured: c-feasibility].
Acceptance criteria
- Semgrep 1.179.0 (feat(review): review tools install from a tools lock with exact versions, binary checksums and hashed Python requirements, and every review records them #1142) runs with
--metrics off,SEMGREP_ENABLE_VERSION_CHECK=0and--sarif. No--dataflow-traces. - Rules:
- devops-cli's pack always runs.
p/defaultis fetched by a separate step into the user data root, with digest, retrieval time and a 24 h TTL. Its digest is recorded as a review input.- Rules with
interfile: trueare skipped and listed, and each rule's licence is recorded. - Tuning is done only by rule-id exclusion and suppressions. Registry rule text never enters the repo, the package or fixtures; fixtures keep rule ids only.
- Targets are explicit files under the scan's working directory (fix(security): a review's isolated Semgrep scan hands Semgrep only targets under its working directory, so it finishes instead of rediscovering each file across the checkout #1079), in fix(security): a review's isolated Semgrep scan hands Semgrep only targets under its working directory, so it finishes instead of rediscovering each file across the checkout #1079's bounded batches, which split by language and size rather than by file count alone, within one total budget for the stage (four 300 s batches can otherwise take 1,200 s).
paths.scannedis compared with the targets (fix(review): a review scans a worktree of the reviewed commit, never hands a deleted file to a tool, and reports which files each tool scanned #1047). - (person-run) On the loop input, Semgrep completes in 5/5 runs, and S11's Semgrep pair and config.py:514 reappear.
- Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each test under 1 s.
-
changelog.d/<n>.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited. -
uv run devops cipasses.
Key questions
- Registry rules on by default? (proposed) Yes: cached, offline and for the user's own use (feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 Q3).
- Opengrep? (proposed) Not until opengrep#846 (PEP 758) merges and its taint recall is measured.
Strategic alignment
- Milestone: none; the roadmap tooling places it. Depends on: fix(security): a review's isolated Semgrep scan hands Semgrep only targets under its working directory, so it finishes instead of rediscovering each file across the checkout #1079, feat(review): review tools run at the project's declared language and platform versions, and count only after their output on a canary matches the recorded expected output #1143, feat(review): devops-cli's rule pack turns the recall set's network-exposure entries into tested Semgrep rules, and CI runs the pack's tests when a rule changes #1145. Related: fix(k8s): the ollama tier DaemonSets drop privilege escalation and capabilities, use RuntimeDefault seccomp and a read-only root filesystem, and run as non-root where the model directory allows #1060, fix(review): the review's scanner config drops the rules that never produced a valid finding on this repository #1024.
- Parent: feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 (phase P1a).
- Evidence tags ([measured: …], [code: path:line], [sourced: …], [estimate], [inference]; "S11" is the single review run of 2026-10-03 and "the loop" the ten runs S12–S21; c-feasibility and c-fidelity are the two design critiques) are explained in feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137.
Proposed design
Problem statement
The review process currently runs Semgrep on every run with default settings that send metrics and use registry rules, which are not redistributable. This leads to no findings in 12/12 reviews and loss of important checks like runAsNonRoot and allowPrivilegeEscalation. The solution requires pinning Semgrep to a specific version, running it offline with cached rulesets, and using only devops-cli's tested rule pack.
Acceptance criteria
- Criterion 1: Semgrep 1.179.0 runs with --metrics off, SEMGREP_ENABLE_VERSION_CHECK=0, and --sarif without --dataflow-traces
Verification: Run 'semgrep scan --json --config p/default --quiet ' with the specified flags and verify no metrics are sent - Criterion 2: devops-cli's pack always runs alongside cached registry rules
Verification: Execute a review and confirm devops-cli's tested rules are applied in addition to cached rules - Criterion 3: Registry rules are fetched into user data root with digest, retrieval time, and 24 h TTL
Verification: Check that the registry ruleset is downloaded to user data root with metadata including digest, timestamp, and TTL - Criterion 4: Rules with interfile: true are skipped and listed with their license recorded
Verification: Run a review and verify that rules with interfile: true are excluded from scanning and their licenses are documented in the output - Criterion 5: Tuning is done only by rule-id exclusion and suppressions, never by modifying registry rule text
Verification: Confirm that fixture files contain only rule IDs and no actual rule text modifications - Criterion 6: Targets are explicit files under the scan's working directory in bounded batches
Verification: Run a review with specified targets and verify paths.scanned matches the explicit file list - Criterion 7: Semgrep completes in 5/5 runs on loop input with S11's Semgrep pair and config.py:514 reappearing
Verification: Execute multiple review runs and confirm consistent completion with expected findings - Criterion 8: Tests run offline with fakes and recorded tool output without network access
Verification: Run tests in an environment with no network connectivity and verify they complete within 1 second
Key questions
None.
Open questions
- Registry rules on by default? (missing verified source)
- Opengrep? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 14, 2026
Moved to the backlog: it was New, not Ready, when v0.2.36 started. (devops roadmap reprioritize)
dan-petty commentedon Oct 17, 2026
Readiness check for v0.2.37, against
release/v0.2.36at 22d8748. Line numbers are at that commit.Status: needs a split. Its dependencies have landed. It is a tool-layer fix, so the #1137 freeze doesn't apply.
Today
src/devops_cli/security/semgrep.py:124-133runsscan --json --config p/default … --disable-nosem --quiet, without--metrics offor--sarif.build_semgrep_cmd(src/devops_cli/config/commands.py:214-225) builds the same command.src/devops_cli/security/base.py:521-522).p/defaultis pulled live (defaults.py:127).defaults.py:246,semgrep.py:259-275), at 300 s each, with no total budget.paths.scannedis read nowhere.Done
tools_lock/semgrep.in,tools.lock:381-387).semgrep.py:128-132).:202-213).SEMGREP_ENABLE_VERSION_CHECK=0is set, but only for the pack tests (src/devops_cli/review/rules_pack.py:231).References that moved
semgrep.py:93-114→:124-158and:259-298.config.py:514is a loop-input site.Dependencies
Gaps in the body
paths.scannedis only in the JSON output, so the run needs both--sarifand JSON, plus the SARIF parser (src/devops_cli/security/sarif.py:484).run_store.review_setup,src/devops_cli/ai/run_store.py:150).devops scan semgrep(scan.py:394) andbuiltin_tools.py:350in scope?--disable-nosem?Slices (M–L overall)
Tests use a fake subprocess with recorded JSON and SARIF, and check rule ids only.
user_data_root()(src/devops_cli/core/repo.py:294): digest, TTL, skipped interfile rules and licences.paths.scannedcheck.dan-petty commentedon Oct 17, 2026
Moved to the backlog: it was New, not Ready, when v0.2.37 started. (devops roadmap reprioritize)
fix(review): every Semgrep scan comes from one builder, with metrics …
feat(review): devops review rules fetch caches a Semgrep registry rul…
fix(review): Semgrep reads the cached registry ruleset offline (#1911)
fix(review): list the files that Semgrep did not scan in the coverage…
dan-petty commentedon Oct 22, 2026
What changed
#1930, merged into
release/v0.2.39as 9d6d204.13 file(s) changed.
How it was verified
Check runs at a1ba552:
Acceptance Criteria of
docs/agent/tasks/task-1144-semgrep-pinned-offline.md:semgrep scancommand devops-cli builds carries--metrics offand--disable-version-check, and none carries--dataflow-traces. Every scan keeps--disable-nosem. Red first: the builder, the review with a local config,devops scan sast --config ./local-rules, the agent tool and the canary each failed on the argv they built, which named neither flag and, for all but the canary, left out the pack. Nowtest_command_builders,test_a_review_runs_the_rule_pack_whatever_config_it_names,test_scan_sast_runs_the_rule_pack_next_to_the_config_it_names,test_the_agent_semgrep_tool_sends_no_metrics_and_runs_the_rule_packandtest_the_semgrep_canary_sends_no_metrics_and_checks_no_versionpass, andtests/test_scanner_contract.pyholds the review's command to the recording.devops scan sastrun, whatever--confignames.devops review rules fetchcaches the ruleset with its ETag. It writes both files atomically, the ruleset first. It asks the registry whether the cached ruleset changed before it downloads it again. Red first: the module and the command did not exist. Nowtests/test_semgrep_registry.pyserves two synthetic rulesets in the shape of the registry's own through the shared web stub. No registry rule text is committed. The tests check the cached bytes and ETag, the read timeout and the files left in the directory. They check the ETag sent on a refetch, a 304 that rewrites neither file, and a changed ruleset that replaces both. They check that no ETag is sent without a ruleset to keep. They check that an answer without an ETag removes the old one. They check that the ruleset is written before its ETag. Each refusal writes nothing and leaves the earlier cache as it was. The refusals are a bad status, a 304 to a fetch that held nothing, a redirect and a transport failure. The others are an oversize answer and a body that is not a ruleset.--dry-runmakes no request and prints the URL and the two paths. The test checks the whole output and that the stub received nothing and no directory was created.p/..,p/a/b,p/default?x=1, a name needing percent-encoding, no kind) is refused before any request and writes nothing.devops scan sast,devops scan reportand the agent tool read the cached registry ruleset offline. Red first: no consumer read the cache, so each scan passed--config p/defaultand Semgrep downloaded it. Nowtests/test_security_semgrep.pyandtests/test_builtin_tools.pycheck the argv of each scan over a synthetic cached ruleset. They also check the working directory of each scan when Semgrep starts. A scan outside a review runs from the cache directory and names./p-default.yaml. A review holds the bytes of the ruleset under the digest name.test_a_reviewed_file_named_like_the_written_ruleset_does_not_replace_itintests/test_security_semgrep.py). The planted.semgrep.yml,.semgrep/rule and.semgrepignoreof a hostile tree stay out (tests/test_review_untrusted_tree.py).test_every_batch_of_a_review_scans_with_the_bytes_that_were_read_when_the_cache_is_replaced).--config ./<file>and absolute targets, for a directory and for a file (tests/test_security_semgrep.py,tests/test_builtin_tools.py). The scanner fake cannot run Semgrep. The plain ids come from the real runs in the feasibility notes.profile.jsonassemgrep_registry_digest, and it is empty without a cache.devops review scorelists it (tests/test_review_profile.py,tests/test_review_static_analyzers.py,tests/test_review_score.py).coverage_gapand its reason namesdevops review rules fetch. Review.md andprofile.jsonshow it.devops scan sastwith a registry id and no cache prints the reason and exits 1, with no report and no Semgrep run. The agent tool returns the reason. A dry run, a local config and a scan that did not run keep their own outcomes.DEFAULT_SEMGREP_REGISTRY_TTL_SECONDSis used with a warning. This holds for the review,devops scan sast,devops scan reportand the agent tool. The warning names the age, taken from the modification time of the file, and the fetch command. A current cache gives no warning. A fetch that finds the ruleset current makes the cache new again (tests/test_semgrep_registry.py, with the clock frozen).paths.scannedis inScanOutcome.unscanned, and the status iscoverage_gap. Before the change,ScanOutcomehad nounscanned, andmerge_outcomeskept no such files.tests/test_security_semgrep.pyruns the adapter of the review over the scanner fake. The recorded run listsapp.pyonly, so astyle.cssnamed with it is inunscanned. A review whose files are all listed isran.paths.scannedleaves no file out.tests/test_security_semgrep.py, Semgrep leaves out two of four files. The test checks the matrix, the two sections of review.md andstatic_analyzer_reasonsinprofile.json.tests/test_review_worktree_regression.pyhas unit tests of the matrix and the tool state, andtests/test_scan_outcomes_and_gating.pytests the outcome and the merge.Coverage gap: Semgrep(tests/test_review_report_summary.py,tests/test_review_static_analyzers.py). Before, a Semgrep scan that left files out was missing from both.DEFAULT_SEMGREP_REVIEW_BATCH_FILEScarries the new figures.--exclude-rule(28 rules; the OSS engine ran them without error). The skip needs an exclude-rules parameter inbuild_semgrep_cmdand the interfile ids from the cached file.devops review rules fetchalso stores the digest of the file it wrote. Then a cache edited into another valid ruleset counts as edited. Today only a file that is no longer a ruleset does, and the digest inprofile.jsonshows the change.devops review rules fetchran against the live registry into the real user data root on 2026-10-22. It cached the 1,074 rules ofp/defaultand their ETag.config.py:514reappear.dan-petty commentedon Oct 22, 2026
What changed
#1930, merged into
release/v0.2.39as 9d6d204.13 file(s) changed.
How it was verified
Check runs at a1ba552:
Acceptance Criteria of
docs/agent/tasks/task-1144-semgrep-pinned-offline.md:semgrep scancommand devops-cli builds carries--metrics offand--disable-version-check, and none carries--dataflow-traces. Every scan keeps--disable-nosem. Red first: the builder, the review with a local config,devops scan sast --config ./local-rules, the agent tool and the canary each failed on the argv they built, which named neither flag and, for all but the canary, left out the pack. Nowtest_command_builders,test_a_review_runs_the_rule_pack_whatever_config_it_names,test_scan_sast_runs_the_rule_pack_next_to_the_config_it_names,test_the_agent_semgrep_tool_sends_no_metrics_and_runs_the_rule_packandtest_the_semgrep_canary_sends_no_metrics_and_checks_no_versionpass, andtests/test_scanner_contract.pyholds the review's command to the recording.devops scan sastrun, whatever--confignames.devops review rules fetchcaches the ruleset with its ETag. It writes both files atomically, the ruleset first. It asks the registry whether the cached ruleset changed before it downloads it again. Red first: the module and the command did not exist. Nowtests/test_semgrep_registry.pyserves two synthetic rulesets in the shape of the registry's own through the shared web stub. No registry rule text is committed. The tests check the cached bytes and ETag, the read timeout and the files left in the directory. They check the ETag sent on a refetch, a 304 that rewrites neither file, and a changed ruleset that replaces both. They check that no ETag is sent without a ruleset to keep. They check that an answer without an ETag removes the old one. They check that the ruleset is written before its ETag. Each refusal writes nothing and leaves the earlier cache as it was. The refusals are a bad status, a 304 to a fetch that held nothing, a redirect and a transport failure. The others are an oversize answer and a body that is not a ruleset.--dry-runmakes no request and prints the URL and the two paths. The test checks the whole output and that the stub received nothing and no directory was created.p/..,p/a/b,p/default?x=1, a name needing percent-encoding, no kind) is refused before any request and writes nothing.devops scan sast,devops scan reportand the agent tool read the cached registry ruleset offline. Red first: no consumer read the cache, so each scan passed--config p/defaultand Semgrep downloaded it. Nowtests/test_security_semgrep.pyandtests/test_builtin_tools.pycheck the argv of each scan over a synthetic cached ruleset. They also check the working directory of each scan when Semgrep starts. A scan outside a review runs from the cache directory and names./p-default.yaml. A review holds the bytes of the ruleset under the digest name.test_a_reviewed_file_named_like_the_written_ruleset_does_not_replace_itintests/test_security_semgrep.py). The planted.semgrep.yml,.semgrep/rule and.semgrepignoreof a hostile tree stay out (tests/test_review_untrusted_tree.py).test_every_batch_of_a_review_scans_with_the_bytes_that_were_read_when_the_cache_is_replaced).--config ./<file>and absolute targets, for a directory and for a file (tests/test_security_semgrep.py,tests/test_builtin_tools.py). The scanner fake cannot run Semgrep. The plain ids come from the real runs in the feasibility notes.profile.jsonassemgrep_registry_digest, and it is empty without a cache.devops review scorelists it (tests/test_review_profile.py,tests/test_review_static_analyzers.py,tests/test_review_score.py).coverage_gapand its reason namesdevops review rules fetch. Review.md andprofile.jsonshow it.devops scan sastwith a registry id and no cache prints the reason and exits 1, with no report and no Semgrep run. The agent tool returns the reason. A dry run, a local config and a scan that did not run keep their own outcomes.DEFAULT_SEMGREP_REGISTRY_TTL_SECONDSis used with a warning. This holds for the review,devops scan sast,devops scan reportand the agent tool. The warning names the age, taken from the modification time of the file, and the fetch command. A current cache gives no warning. A fetch that finds the ruleset current makes the cache new again (tests/test_semgrep_registry.py, with the clock frozen).paths.scannedis inScanOutcome.unscanned, and the status iscoverage_gap. Before the change,ScanOutcomehad nounscanned, andmerge_outcomeskept no such files.tests/test_security_semgrep.pyruns the adapter of the review over the scanner fake. The recorded run listsapp.pyonly, so astyle.cssnamed with it is inunscanned. A review whose files are all listed isran.paths.scannedleaves no file out.tests/test_security_semgrep.py, Semgrep leaves out two of four files. The test checks the matrix, the two sections of review.md andstatic_analyzer_reasonsinprofile.json.tests/test_review_worktree_regression.pyhas unit tests of the matrix and the tool state, andtests/test_scan_outcomes_and_gating.pytests the outcome and the merge.Coverage gap: Semgrep(tests/test_review_report_summary.py,tests/test_review_static_analyzers.py). Before, a Semgrep scan that left files out was missing from both.DEFAULT_SEMGREP_REVIEW_BATCH_FILEScarries the new figures.--exclude-rule(28 rules; the OSS engine ran them without error). The skip needs an exclude-rules parameter inbuild_semgrep_cmdand the interfile ids from the cached file.devops review rules fetchalso stores the digest of the file it wrote. Then a cache edited into another valid ruleset counts as edited. Today only a file that is no longer a ruleset does, and the digest inprofile.jsonshows the change.devops review rules fetchran against the live registry into the real user data root on 2026-10-22. It cached the 1,074 rules ofp/defaultand their ETag.config.py:514reappear.feat(release): v0.2.39 (#1947)