Skip to content

[BUG-P0] check command rejects positional workspace arg - CI quality-gate broken for all PRs #78

Description

@Wolfvin

Summary

The check command does not accept a positional workspace argument, but the CI quality-gate workflow calls it with . as a positional. This causes codelens.py: error: unrecognized arguments: . and exits with code 2, failing the quality-gate CI job for ALL pull requests.

Root cause

scripts/commands/check.py add_args() only defines optional flags:

  • --severity
  • --max-findings
  • --health-min
  • --sarif
  • --commands

It does NOT define a positional workspace argument (unlike most other CodeLens commands which use parser.add_argument("workspace", nargs="?", default=None)).

But .github/workflows/codelens-quality-gate.yml calls:

python3 scripts/codelens.py check . --severity high --sarif

The . is passed as a positional arg, which argparse rejects.

Evidence

CI log (quality-gate 3.11 job, repeated on every PR):

codelens.py: error: unrecognized arguments: .
##[error]Process completed with exit code 2.

Local repro:

PYTHONPATH=scripts python3 scripts/codelens.py check . --severity high --sarif
# usage: codelens.py [-h] [--format ...] ...
# codelens.py: error: unrecognized arguments: .

Impact

  1. CI quality-gate workflow is red for ALL PRs - blocks merge of unrelated PRs.
  2. Combined with issue [BUG-01] scan: pr.store_scan_result(result) calls non-existent method — SQLite analysis_cache never populated #31 (store_scan_result missing) and the now-fixed [BUG-P0] dashboard_engine.py:655 f-string backslash breaks dashboard command on Python 3.11 (CI runtime) #74 (dashboard f-string), the quality-gate has been broken for the entire session.
  3. Contributors see red CI and either (a) ignore it, or (b) spend time debugging pre-existing failures instead of their PR changes.

Fix

Two options:

Option A (recommended): Add positional workspace to check command

In scripts/commands/check.py add_args():

def add_args(parser):
    parser.add_argument(
        "workspace",
        nargs="?",
        default=None,
        help="Path to workspace root (auto-detected if omitted)",
    )
    # ... existing flags ...

This matches the convention of all other CodeLens commands and makes the CI workflow work as-is.

Option B: Fix the CI workflow

In .github/workflows/codelens-quality-gate.yml, change:

python3 scripts/codelens.py check . --severity high --sarif

to:

python3 scripts/codelens.py check --severity high --sarif

(Remove the . - check will auto-detect workspace from cwd.)

Option A is recommended because it makes check consistent with all other commands and allows explicit workspace specification.

Acceptance criteria

Files

  • scripts/commands/check.py (Option A)
  • .github/workflows/codelens-quality-gate.yml (Option B, if chosen)

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions