Skip to content

prism-cli 1.19.2: say when a branch review has nothing to review, and offer the whole repo - #120

Merged
Enclavet merged 1 commit into
mainfrom
fix/code-review-nothing-to-review
Nov 16, 2026
Merged

Enclavet merged 1 commit into
mainfrom
fix/code-review-nothing-to-review

Conversation

@Enclavet

Copy link
Copy Markdown
Contributor

prism-cli 1.19.2. Fixes a user-reported dead end on the Security Agent page.

What the user saw

The user started Code review of this branch and clicked Start another anyway. The drawer showed exit 0 and No changes against origin/feat/receiver-tool-usage; nothing to review. No job ran, and the page gave no warning or next step, so it read as Security Agent refusing to run. The CLI was right: the branch had nothing new since its upstream.

What changes

Where Now
Branch card Says what the branch review diffs against: the upstream, else the remote's default branch. This is the CLI's own rule (diffBase, shared now) and is read from local git only. With nothing new since that base, or no base at all, the card says so (Nothing new on <branch> since <upstream>; a branch review would have nothing to check), disables Start code review and offers Review the whole repo instead. It also counts uncommitted changes, which no review includes: "commit them first".
Whole-repo offer It is the existing --full action. The running and already-reviewed guards still apply.
Drawer A branch review that exits 0 and saved no run shows a neutral nothing to review with the same offer, not red or green. The exit code stays 0, so scripts are unaffected.
CLI No changes against <base>; nothing to review. To review the whole repo at HEAD, run with --full.
  • New endpoint: GET /api/security-agent/scope?repo=<id> serves only repo ids the last full answer listed. It runs read-only git in that repo, makes no AWS call, and returns no paths.
  • Unchanged: the listener, token, CSP and action allowlist.
  • Known limit (commented in the code): a started job whose pending record could not be written (a warning, exit 0) would also read as "nothing".

Tests

  • npm test (aws guard): 880/880.
    • New security-branch-scope.test.ts uses real git and covers: up to date with the upstream, a dirty tree, a new commit, no upstream with a default branch, neither, and a detached HEAD.
    • It also checks the runner's neutral outcome.
    • New page tests cover the disabled Start, the full offer going through its guard, and the no-base and fallback-base wording.
  • npm run docs:check: 0 problems.
  • Full e2e: 66/66. The new branch suite, run with the fake aws, has three checks:
    • BR1: disabled branch Start, the offer, and no sideways scroll at 390 px.
    • BR2: the offer opens the full review's guard.
    • BR3: neutral drawer, the CLI's --full hint, and no upload.
    • The gate suite's guard checks now use Start full review, because the seeded demo-shop has no upstream and its branch Start is disabled.

Docs: USER_GUIDE (branch card, drawer, CLI message); CLI-REFERENCE version.

… offer the whole repo

- The branch card reads the branch review's scope from local git (the CLI's
  own diffBase/branchScope): upstream, else the remote default branch.
  Nothing new since it, or no base: say so, disable the branch Start, offer
  Review the whole repo instead (the --full action, with its guards).
  Counts uncommitted changes, which no review includes.
- The drawer shows a branch review that exited 0 and saved no run as a
  neutral 'nothing to review', with the same offer.
- CLI: 'No changes against <base>; nothing to review. To review the whole
  repo at HEAD, run with --full.'
- GET /api/security-agent/scope?repo=<id>: one known repo, read-only git.
@github-actions

Copy link
Copy Markdown

✅ PRISM Eval Gate -- PASS

Score: 0.86 | Findings: 7 (0 high, 1 medium)

Summary: No blocking issues. The main concern is the heuristic nothing outcome, which can mislabel a failed pending-record write. The rest are minor race, staleness and duplication points in the scope check.

File Line Severity Category Issue
cli/src/dashboard/actions.ts 423 medium correctness The 'nothing' outcome is inferred from exit 0, a saved pending record ( wrote ) and no result. The code comment admits that a pending record that failed to write also exits 0 with a warning, and the d
cli/src/dashboard/security-page.ts 283 low reliability saScopeLoad has a race. renderSecurity calls SA_SCOPE.clear() while a scope request is still in flight, and the stale response is then written into SA_SCOPE. The cached scope is also never refreshed a
cli/src/dashboard/security-page.ts 283 low maintainability SA_SCOPE_LOADING allows only one lookup at a time. If the user switches repos while one is in flight, the second repo is not fetched until the first one's redraw happens. Failures are cached as null p
cli/src/security/review.ts 653 low correctness When the repo has no commit (tip is null), base is null and the UI reports 'No upstream ... nothing to diff against'. That is misleading, because the real cause is no HEAD commit. Also, a failed git
cli/src/security/review.ts 624 low maintainability The g helper (run git with -C root, return trimmed stdout or null) is duplicated in diffBase and branchScope, and it also duplicates the existing git(ctx, repo, ...) helper. Extract one shared funct
cli/src/dashboard/security-agent.ts 424 low reliability securityAgentScope runs several synchronous-style git commands (status, diff) through run('git') on every first view of a repo. There is no timeout or output bound, so a large repo or a large untracke
cli/src/security/review.ts 19 low maintainability The new import type { RunResult } is placed between node: imports and the local imports. Group it with the other local imports.

Powered by kiro-cli headless - Model: auto - Threshold: 0.82


✅ Secret scan -- no credentials found in this PR's commits.

@Enclavet
Enclavet merged commit 4126168 into main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants