Skip to content

fix(review): Limit lockfile bucket to CONST_LOCKFILE_NAMES #3536

Closed

Description

@dan-petty

Friction

_classify_scanner_files in src/devops_cli/ai/review/pipeline.py puts every file that ends in .lock or .lockb in the lockfile bucket, and the bucket goes to osv-scanner as --lockfile arguments. A file such as src/devops_cli/review/rules/rules.lock or src/devops_cli/tools_lock/tools.lock is no lockfile that osv-scanner reads.

Evidence

On 2026-11-04 with osv-scanner 2.6.0: osv-scanner scan source --format json --offline --offline-vulnerabilities --all-packages --all-vulns --lockfile uv.lock --lockfile src/devops_cli/review/rules/rules.lock printed could not determine extractor suitable to this file: ".../rules.lock" on stderr, exited with 127 and printed no report. So the scan of a review that covers such a file reports a failure and gives no advisory for the real lockfiles.

What should happen

The bucket takes a file as a lockfile only when its name is in CONST_LOCKFILE_NAMES, as OsvScanner does since #2131. A test pins that a rules.lock is no lockfile.

Proposed design

Problem statement

The review pipeline sends every file that ends in .lock or .lockb to osv-scanner as a lockfile. osv-scanner rejects files such as rules.lock and exits with 127. The scan then reports a failure and gives no advisory for real lockfiles. The fix limits the osv-scanner lockfile bucket to CONST_LOCKFILE_NAMES.

Acceptance criteria

Requirement: Known lockfile names only

The scanner file classification SHALL place a file in the lockfile bucket only when its name is in CONST_LOCKFILE_NAMES.

Scenario: rules.lock and tools.lock are excluded

  • WHEN the classifier receives src/devops_cli/review/rules/rules.lock, src/devops_cli/tools_lock/tools.lock, and uv.lock
  • THEN the lockfile bucket contains uv.lock and does not contain src/devops_cli/review/rules/rules.lock or src/devops_cli/tools_lock/tools.lock.

Requirement: osv-scanner gets only real lockfiles

The review pipeline MUST pass only files in the lockfile bucket to osv-scanner as --lockfile arguments.

Scenario: Scan arguments omit rules.lock

  • WHEN the pipeline scans a review that covers src/devops_cli/review/rules/rules.lock and uv.lock
  • THEN the osv-scanner invocation receives uv.lock as a --lockfile argument and receives no --lockfile argument for src/devops_cli/review/rules/rules.lock.

Requirement: Regression test pins rules.lock exclusion

The test suite SHALL pin that a file named rules.lock is not classified as a lockfile.

Scenario: Regression test for rules.lock

  • WHEN the test classifies src/devops_cli/review/rules/rules.lock
  • THEN the test asserts that the lockfile bucket does not contain the file.

Existing Tool Considered

No alternatives check has run. osv-scanner 2.6.0 is already pinned in src/devops_cli/tools_lock/tools.lock. It covers dependency scans for supported lockfiles. It lacks support for arbitrary .lock files such as rules.lock and tools.lock, so the pipeline must filter by CONST_LOCKFILE_NAMES. The change modifies one filter and adds one test. It builds no replacement tool.

Key questions

  • Which files should the review pipeline put in the osv-scanner lockfile bucket?: Only files whose name is in CONST_LOCKFILE_NAMES. A .lock or .lockb suffix alone does not qualify. (best practice) [sources: src/devops_cli/ai/review/pipeline.py, src/devops_cli/config/constants.py, src/devops_cli/security/osv_scanner.py]
  • Should the allowlist filter apply to files that _lockfiles_beside adds?: Yes. The bucket SHALL add a file from _lockfiles_beside only when its name is in CONST_LOCKFILE_NAMES. (best practice) [sources: src/devops_cli/ai/review/pipeline.py, src/devops_cli/config/constants.py]
    • Chosen: Filter the whole bucket by CONST_LOCKFILE_NAMES. One rule controls every lockfile entry and prevents a second path for unsupported files.
    • Rejected: Filter only suffix matches from all_resolved. A file from _lockfiles_beside could still reach osv-scanner.
    • Rejected: Leave _lockfiles_beside unchanged. The bucket could still contain a file that osv-scanner cannot read.
  • Which test should pin the fix?: Extend tests/security/test_review_pipeline_go.py with a case that classifies rules.lock and asserts that the lockfile bucket does not contain it. (best practice) [sources: tests/security/test_review_pipeline_go.py, src/devops_cli/ai/review/pipeline.py]
    • Chosen: Extend the existing pipeline test. The file already tests _classify_scanner_files and keeps the regression near related cases.
    • Rejected: Add a separate test module. The existing test file already covers the classifier, so a separate module adds no coverage.
    • Rejected: Use an integration test with osv-scanner. An offline unit test pins the classification without the scanner binary.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/review
    status/new
    value/high
    effort/low
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/review. The (review) scope of the title gives the scope.
    • Priority: P1-High. The bug causes osv-scanner to exit 127 and produce no advisory output, blocking the entire review scan when any non-standard .lock file is present.
    • Value: High. Users receive no advisory data at all when a non-standard .lock file appears in the review, making the security scan useless.
    • Effort: Low. The fix changes a suffix match to a name lookup against CONST_LOCKFILE_NAMES and adds one test, a small targeted change.
    • Related: feat(review): one devops command fetches the osv-scanner and trivy databases that a sandboxed review binds read-only #2131, which asks for a different change. Both items work on the osv-scanner integration in the review pipeline, but #2131 fetches databases while the candidate fixes file classification to use CONST_LOCKFILE_NAMES.
  3. added
    priority/p1-high
    on Nov 4, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 1ad0e59 (see proposed design in issue body).

  6. changed the title [-]fix(review): the review pipeline hands osv-scanner every .lock file as a lockfile[/-] [+]fix(review): Limit lockfile bucket to CONST_LOCKFILE_NAMES[/+] on Nov 6, 2026
  7. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 68 characters, and the limit is 60. The type and the scope stay.

    • Before: fix(review): the review pipeline hands osv-scanner every .lock file as a lockfile
    • After: fix(review): Limit lockfile bucket to CONST_LOCKFILE_NAMES
    • Source of the summary: the background model
  8. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/3536-limit-lockfile-bucket-to-const-lockfile, draft pull request #3808. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:

    1. Pin the lockfile bucket to CONST_LOCKFILE_NAMES: 16909 tokens

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • other at group 1 / decisions: Changing _lockfiles_beside to filter by CONST_LOCKFILE_NAMES also changes the shared helper that _collect_scanner_commit_files uses to build the allowed commit-file set, and the plan touches neither that caller nor its test, which calls the helper directly. Evidence: "_lockfiles_beside in src/devops_cli/ai/review/pipeline.py adds only files whose name is in CONST_LOCKFILE_NAMES, so no other path reaches the lockfile bucket."

    The runs of the planner and the review made 14 model request(s), and used 461318 input tokens and 11726 output tokens. The tool calls, in order:

    1. search_code({"text":"_classify_scanner_files"})
    2. search_code({"text":"CONST_LOCKFILE_NAMES"})
    3. read_spec({"capability":"review-tool-databases","requirement":"osv-scanner is named only files that it reads as lockfiles"})
    4. read_file({"path":"src/devops_cli/ai/review/pipeline.py","start_line":1600,"end_line":1720})
    5. read_file({"path":"tests/security/test_review_pipeline_go.py"})
    6. read_file({"path":"src/devops_cli/config/constants.py","start_line":4910,"end_line":4950})
    7. search_code({"text":"CONST_REVIEW_GENERATED_FILES"})
    8. search_code({"text":"lockfiles="})
    9. read_file({"path":"src/devops_cli/security/osv_scanner.py","start_line":200,"end_line":250})
    10. search_code({"text":"classify_scanner_files"})
    11. search_code({"text":"CONST_LOCKFILE_NAMES"})
    12. read_file({"path":"src/devops_cli/ai/review/pipeline.py","start_line":1595,"end_line":1675})
    13. read_file({"path":"tests/security/test_review_pipeline_go.py"})
    14. search_code({"text":"CONST_REVIEW_GENERATED_FILES"})
    15. search_code({"text":"classify_scanner_files"})
    16. search_code({"text":"CONST_LOCKFILE_NAMES"})
    17. read_file({"path":"src/devops_cli/ai/review/pipeline.py","start_line":1590,"end_line":1700})
    18. search_code({"text":"_lockfiles_beside"})
    19. read_file({"path":"src/devops_cli/ai/review/pipeline.py","start_line":340,"end_line":420})
    20. read_file({"path":"src/devops_cli/config/constants.py","start_line":4900,"end_line":4970})
    21. search_code({"text":"CONST_REVIEW_GENERATED_FILES"})
    22. read_file({"path":"tests/commands/test_review_scope.py","start_line":380,"end_line":420})

    Tool calls: read_file=10 (empty=0), read_spec=1 (empty=0), search_code=11 (empty=0)

    The stage job read the open pull requests and their files in 1 GraphQL request(s).

  9. 6 remaining items

  10. added
    status/in-review
    and removed
    status/in-progress
    on Nov 6, 2026
  11. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Pull request #3808 is ready for review. The checks passed.

    Spend: 128 model requests, 7818001 input tokens, 59833 output tokens.

  12. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-runner-20261106-170711-fd99 ended: succeeded.
    Image digest: sha256:a9dc6858faa3d5935996a1419736ced97d308ec525ba1ca5667def0b7f4add5f

    The last lines of its log:

    Tool call: shell, started: grep -c ai/review/pipeline.py .data/coverage.xml
    Tool call: shell, started: git diff --unified=0 origin/main...HEAD -- src/devops_cli/ai/review/pipeline.py
    Tool call: shell, program grep, ok.
    Tool call: shell, program git, ok.
    Tool call: shell, started: uv run ruff check tests/roadmap/test_roadmap_plan_check.py
    Tool call: shell, started: uv run devops openspec check
    Tool call: shell, program uv, ok.
    Tool call: shell, program uv, ok.
    Tool call: edit_file, ok.
    Tool call: shell, started: uv run pytest -n 0 -q ...
    Tool call: shell, program uv, ok.
    Tool call: shell, started: git checkout -- src/devops_cli/roadmap/plan_check.py
    Tool call: shell, program git, ok.
    Tool call: shell, started: git status --short
    Tool call: shell, started: git diff --stat
    Tool call: shell, program git, ok.
    Tool call: shell, program git, ok.
    Tool call: shell, started: uv run devops ci test tests/roadmap/test_roadmap_plan_check.py
    Tool call: shell, program uv, ok.
    Tool call: shell, started: ls .ast-grep 2>/dev/null; ls sgconfig.yml 2>/dev/null
    Tool call: shell, program ls, refused.
    Tool call: shell, started: uv run devops ci test tests/security/test_review_pipeline_go.py
    Tool call: shell, program uv, ok.
    Tool call: shell, started: ls -a
    Tool call: shell, program ls, ok.
    Tool call: list_files, ok.
    Tool call: shell, started: ls -a .data
    Tool call: shell, program ls, ok.
    Tool call: shell, started: uv run python -c <masked>
    Tool call: shell, program uv, refused.
    Tool call: shell, started: uv run python -c __import__("pathlib").Path(".data/coverage.xml").unlink(missing_ok=<masked>
    Tool call: shell, program uv, ok.
    Tool call: shell, started: uv run python -c __import__("pathlib").Path(".data/.coverage").unlink(missing_ok=<masked>
    Tool call: shell, program uv, ok.
    Tool call: shell, started: git diff
    Tool call: shell, started: git status --short
    Tool call: shell, program git, ok.
    Tool call: shell, program git, ok.
    ✓ Took 1 item(s) to a ready pull request, stopped 0.
    Elapsed: 45m 47s
    
  13. removed
    owner/service
    on Nov 6, 2026
  14. removed
    status/in-review
    on Nov 6, 2026
  15. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 19:47 UTC

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

    effort/lowpriority/p1-highscope/reviewsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions