feat(cli): always-warm registry, staleness signal + small auto-rescan (closes #237) - #245
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #237.
Summary
scanitself now checks registry staleness vs git HEAD (reuses existinggit_aware.pyinfra — no new detection logic)._stalenesshint field instead of forcing a rescan every call.Extracted into a standalone
_check_staleness(workspace, args)function (was inline inmain()) for testability.Test plan
pytest tests/test_staleness_check.py— 7/7 new testspytest tests/test_staleness_check.py tests/test_codelens.py tests/test_cli.py -k "not FormatConflictRegression"— 120/120 passcontext .— got{"was_stale": true, "auto_rescanned": true, "changed_files_count": 1}, verified subsequent query reflected the edit