Repository navigation
check --since is as fast as undeclared: it reads only the files changed since REV (#85) - #87
Merged
Merged
Conversation
The CI form, check --since REV --code-only, walked every file the service owns and was 40-110x slower than undeclared on large repositories (PostHog: 155 s). With --since, code references now come only from files changed or untracked since REV, through the same per-file rules as the full walk, and a read is old only if a changed file read the same name at REV (check's own discovery). Listing the changes fails closed when git can't answer. Plain check is unchanged. PostHog now takes 3.0 s, faster than undeclared (4.2 s); same new reads as undeclared on six large repositories. D-13 updated.
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 #85
In one line:
check --since REV --code-only, the CI replacement forundeclared, took 155 s on PostHog. It now takes 3.0 s, faster thanundeclared(4.2 s), and finds the same new reads.Decision (maintainer, 2026-10-27, recorded on #85): option 1
With
--since, code references come only from the files changed or untracked since REV. An old undeclared read in an unchanged file is no longer listed in that mode. Plaincheckstill lists and fails on every one.Before / after
check --sincewalked every file the service owns, then classified each undeclared read as new or old.check, and every command without--since.What changed
since.changed_files(REV):git diffagainst the working tree, plus untracked files. A git failure raises (exit 1) instead of returning "nothing changed", which would be a false pass.git_utils.list_changed_files/list_untracked_filesgainedstrict=True, andGitError.evaluator.service_source_filter(service): the per-file rules of the full walk (ownership,additional_source_roots, default-excluded directories,exclude_files) as one predicate. The walk, the changed-file list and REV's side all use it.discover_code_references(service, files=…)reads only the files it's given.since.read_beforechecks each changed file's content at REV withcheck's own discovery, so aBaseSettingsfield that was already there is old. The same 1 MB cap applies on both sides.sinceblock gainscode_scope: "changed_files". The human output says "N file(s) changed since REV scanned".How to check it
Branch
rabbilyasar/bl-205-fast-since, commit4bffef2. In a git repository with EnvShield set up:os.getenv("OLD_FLAG").envshield check --since HEAD --code-only --json→ exit 0,files_scanned: 0,code_scope: "changed_files".envshield check --code-only→ exit 1 (plain check still sees it).--sincelistsOLD_FLAGas old (new: false), exit 0.new.pyreadingos.getenv("NEW_FLAG")→ exit 1 onNEW_FLAGonly.Measured (fresh shallow clones, median of three runs)
undeclared HEAD~10 HEADcheck --since HEAD~10 --code-onlyOver
HEAD~39, both commands report the same new reads on all six (Dify:USERNAME, from both).checkalso lists 4–18 old reads in changed files per repository; the slowest run was PostHog at 6.1 s. This mode reads no.envor manifest, so no configuration value is involved. The clones were deleted afterwards. Recorded in BACKLOG.md BL-205.Risk
Low. It narrows what
--sincelists (old reads in unchanged files) without changing the gate, and fails closed on any git error. Undo: revert the PR.Size: 344 lines added, 122 of them tests.
Checks, configuration and docs
uv run --frozen --extra dev pytest, 2278 passed, 1 skipped, also withGITHUB_ACTIONS=true.ruff check .,ruff format --check .andenvshield scan . --config .github/envshield.ci.ymlare clean--sinceis on that list.--sincenever walks the tree, plaincheckstill does; a changed file counts only for its owner;exclude_filesapplies to changed files; an old read in an unchanged file isn't listed; aBaseSettingsfield in a changed file is proven old; git failures fail closed (listing, and content at REV).🤖 Generated with Claude Code