Skip to content

feat(cli): always-warm registry, staleness signal + small auto-rescan (closes #237) - #245

Merged
Wolfvin merged 1 commit into
mainfrom
feat/issue-237-always-warm-registry
Jul 12, 2026
Merged

feat(cli): always-warm registry, staleness signal + small auto-rescan (closes #237)#245
Wolfvin merged 1 commit into
mainfrom
feat/issue-237-always-warm-registry

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Closes #237.

Summary

  • Every command except scan itself now checks registry staleness vs git HEAD (reuses existing git_aware.py infra — no new detection logic).
  • Diffs <= 20 files: transparent incremental rescan before answering.
  • Larger diffs / branch switch: _staleness hint field instead of forcing a rescan every call.
  • Never blocks the actual command — any failure in staleness detection degrades silently to no staleness info.

Extracted into a standalone _check_staleness(workspace, args) function (was inline in main()) for testability.

Test plan

  • pytest tests/test_staleness_check.py — 7/7 new tests
  • pytest tests/test_staleness_check.py tests/test_codelens.py tests/test_cli.py -k "not FormatConflictRegression" — 120/120 pass
  • Manual end-to-end: scanned a real workspace, edited 1 tracked file (no commit), ran context . — got {"was_stale": true, "auto_rescanned": true, "changed_files_count": 1}, verified subsequent query reflected the edit

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Wolfvin
Wolfvin merged commit 0cf6a56 into main Jul 12, 2026
0 of 6 checks passed
@Wolfvin
Wolfvin deleted the feat/issue-237-always-warm-registry branch July 12, 2026 12:50
closes #237)

Registry staleness vs git HEAD was previously only surfaced passively via
`history --check git-status`'s "re-scan recommendation" field — nothing
else read it. Every other analysis command could silently answer from a
stale graph without any warning at the point of the actual query.

Every command except scan itself now checks staleness via the existing
git_aware.py infra (rescan_recommended / get_changed_files, already
built for scan --incremental and history --check git-status — no new
staleness-detection logic, just wiring it into more call sites):

- Small diffs (<= 20 files changed, configurable via
  _AUTO_RESCAN_FILE_THRESHOLD) trigger a transparent incremental
  rescan before answering — verified end-to-end on a real workspace.
- Larger diffs or branch switches attach a `_staleness` hint instead of
  forcing a rescan on every call (could be slow on a big diff).
- Never blocks the actual command: any failure in staleness detection
  (not a git repo, git binary missing) degrades to None silently.

Deliberately NOT gated on the same _REGISTRY_COMMANDS set the auto-setup
block uses — that set still lists pre-#195 leaf command names and is
missing several current umbrella commands (audit/security/deps/doctor —
filed separately as issue #244, out of scope here). "Every command
except scan" is simpler and correct without depending on that list
being fixed first.
@sonarqubecloud

Copy link
Copy Markdown

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.

feat(context): always-warm registry — auto re-scan when stale vs git HEAD

1 participant