Repository navigation
Conversation
|
The Windows CLI E2E failure on the first commit was not the dry run — a debug build of Reproduced on macOS by capping the stack, so it is frame usage and not Windows-specific code: Filed as #191 with two ways to fix it (a |
Part of lightonai#164. `colgrep init` loads the model and starts encoding before anyone can see which files it picked, and `colgrep status` only describes an index that already exists. `--dry-run` (alias `--list-files`) prints the resolved file set — built-in default exclusions, this project's `.gitignore`, the persistent `settings --ignore` patterns and the covered-directory registrations — one root-relative path per line on stdout, with the count on stderr, and returns before `ensure_model` and before the `IndexBuilder` exists. The walk is not duplicated: `scan_project_files` is the function the indexer itself calls (`IndexBuilder::scan_files`), so the dry run cannot drift from what a real init walks. The force-include branch that registers a covered subdirectory for an adopting parent computes the same list in memory on the dry-run path and persists nothing, mirroring `add_force_include_dir`'s no-op when an ancestor registration already covers the subdir. What it is not: the parse-time filtering that happens after the walk (a file whose content turns out to be binary or not UTF-8 is listed and dropped later), and the issue's "would be ideal" per-file reason and code-unit/embedding estimates. Those read as a follow-up, and the summary line says "would be parsed" rather than "would be indexed" for the same reason. Verification, in colgrep/: $ cargo test test result: ok. 691 passed; 0 failed; 1 ignored (lib) test result: ok. 72 passed; 0 failed (bin) test result: ok. 2 passed; 0 failed (tests/init_dry_run.rs) $ cargo clippy --all-targets -- -D warnings # clean $ cargo fmt --all -- --check # clean $ colgrep init . --dry-run | wc -l 235 file(s) would be parsed under ... (4 skipped: too large or outside the root) 235 # 0.15 s, no model, this repository `tests/init_dry_run.rs` pins the command surface and the promise against an isolated `COLGREP_DATA_DIR`: the default exclusions are respected, `--list-files` is the same command, no index and no config are written, and a child of an indexed project reports the parent's set (the force-include case) without persisting the registration. It is load-bearing in both directions: leaking a `config.save()` into the dry-run branch fails it ("must not persist a force-include registration"), dropping the in-memory push fails it ("the uncovered child must be reported"), and renaming the alias fails it too. The second test also runs `--model /nonexistent/model`, which a real init cannot survive. I used an AI assistant to draft this change; I read lightonai#164, reviewed the diff and ran every command quoted above myself.
The CLI E2E Windows job failed on the previous commit, and it was not the dry run: a debug
build of the binary cannot start on Windows at all. A PE main thread gets a 1 MB stack, the
startup path (`setup_signal_handler`, `init_global_rayon_pool`, `Cli::parse`) needs more than
that in an unoptimized build, and every invocation aborts — `colgrep --version`, `--help`, a
bare `colgrep`, all of them. Reproduced on macOS by capping the stack, 3 MB is enough:
$ (ulimit -s 1024; ./target/debug/colgrep --version)
thread 'main' (24633304) has overflowed its stack
So the two tests are `#[ignore]`d on Windows with that reason, and issue lightonai#191
carries the reproduction and two ways to fix it (a `/STACK` link argument, or `main` on a
thread with an explicit stack size). The release build the E2E workflow uses is unaffected,
and the tests run on Linux and macOS, where CI also runs them.
Co-authored-by: Claude <noreply@anthropic.com>
f6302a1 to
7f4cf3c
Compare
|
Rebased onto current One conflict, in Re-ran the gate in
The two |
|
A quick check on this proposal — is it something you'd like to take? If there's no interest I'll go ahead and close it in ten days or so, no worries at all; I'd just rather keep the queue here tidy than leave it sitting. For context, the branch is rebased on current |
|
No answer since the ping on 23 October, so I'll close this one to keep the queue tidy rather than leave it sitting. The branch stays in my fork and I can reopen it on request. |
Part of #164.
colgrep initloads the model and starts encoding before anyone can see which files it picked, andcolgrep statusonly describes an existing index.--dry-run(alias--list-files) prints the resolved file set and exits.What it does
Paths on stdout (so it pipes into a SAST tool or a file list), the summary on stderr. The set is the one a real
initwould walk: built-in default exclusions, this project's.gitignore, the persistentsettings --ignorepatterns and the covered-directory registrations. It returns beforeensure_modeland before theIndexBuilderis constructed — no model, no encoding, no index write, no config write.The walk is not duplicated:
scan_project_filesis the function the indexer itself calls (IndexBuilder::scan_files), now public and re-exported, so the dry run cannot drift from what a real init walks. On the force-include path — a child of an indexed project that the parent's rules exclude — the dry run computes the same list in memory and persists nothing, mirroringadd_force_include_dir's no-op when an ancestor registration already covers the subdir.What it is not
Two of the issue's "would be ideal" items: the per-file reason for inclusion/exclusion, and the summary stats (code units, estimated embeddings). The summary says "would be parsed" rather than "would be indexed" on purpose: a file whose content turns out to be binary or not UTF-8 is listed here and dropped later, at parse time. Happy to do the reason/stats slice next if you want it.
Verification
tests/init_dry_run.rsruns the binary against an isolatedCOLGREP_DATA_DIRand pins the command surface and the promise: built-in exclusions respected,--list-filesthe same command, no index and no config written, and a child of an indexed project reported at the parent's set without persisting the registration. It bites in both directions — leaking aconfig.save()into the dry-run branch fails it ("must not persist a force-include registration"), dropping the in-memory push fails it ("the uncovered child must be reported"), and renaming the alias fails it. The second test also runs--model /nonexistent/model, which a realinitcannot survive, so a regression that reachesensure_modelis a failure and not a warm-cache pass.On this repository the dry run lists 235 files in 0.15 s.
I used an AI assistant to draft this change; I read #164, reviewed the diff and ran every command quoted above myself.