Repository navigation
refactor(core): fail the build on an on-file command failure; drop the parsed-row cache and exit 23 - #1245
Merged
Conversation
This was referenced Oct 2, 2026
thekevinscott
enabled auto-merge
October 5, 2026 00:13
…e parsed-row cache and exit 23 An on-file command runs once per table, so a run that fails is the table's error and the build's. The partial-scan exit code, the capped `dirsql: skipping` stderr report, and the per-table entry in `scan_failures` go with it; `OnFileFailure` is a file again. The persisted row cache for a parsed path-table (`_dirsql_parsed_rows`, the vtab's cache argument, and the db/persist plumbing that threaded it) is removed: there is no per-file result to cache.
… points from the mutation gate
… on the scan-failure bindings
…after the rebase The index-root argument main added stays; the empty cache slot before it goes, so the schema_inference fixture and the persist doc comments stop describing the removed row cache.
thekevinbot
force-pushed
the
claude/1216-on-file-cleanup
branch
from
October 5, 2026 00:34
eef6926 to
7f73ada
Compare
This was referenced Oct 5, 2026
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.
Fixes #1216
Fixes #1187
Status
Removes the per-file machinery the batched
on-filecontract left dead:parsed_cache.rs,collect_rows_cachedand its fakes, the vtab's cache argument (FIXED_ARGS5 -> 4),Db::set_path_table_cache, and the_dirsql_parsed_rowscreate/clear calls inpersist.rs. The parser runs on every start.on-filecommand that fails now fails the build withDirSqlError::TableCommand { name, message };OnFileFailure.pathis a file path again.scan_failures()stays for the programmatic per-file hook (Rust/Python/TS parity surface, untouched).PARTIAL_SCAN_EXIT = 23,report_scan_failures, and thedirsql: skipping ...lines. A failed command exits1with the table named on stderr.{path}from every fixture, doc and generic-runner test.Kept, with the reason:
{root}substitution and the{path}startup rejection. The issue allowed removing substitution only "if nothing else uses substitution";{root}is the documented contract used by the embeddings plugin,docs/howto/write-a-plugin.md, and every config-driven test fixture. Sorg '\{path\}' packages/rust/src docsstill returns the rejection constant and its tests (on_file.rs, twolib.rstests) and the one doc line that documents the rejection (hooks.md), beyond the changelog entries.Tests rewritten to the batched contract:
tests/on_file.rs(four command-failure tests assert the build error),tests/scan_failures.rs(clean scan only),tests/scan_failures_e2e.rs->tests/on_file_failure_e2e.rs(exit1, table named on stderr, nothing on stdout),tests/multi_config.rs,tests/on_file_e2e.rs(server stays up and answers 503 naming the table). Deleted:tests/persist_parsed_path_table.rsand the Python SDK'stests/e2e/persist_query_test.py(both asserted the row cache). The scan-failure binding test headers in Python and TS no longer describe exit23. Fixtures intests/extensions.rsandtests/no_implicit_files_table.rsfedcatnon-JSON and relied on the silent empty table; they now emit rows.Docs touched only where the old text became false:
hooks.md,cli.md,path-tables.md,config.md,define-tables.md,persist.md,PARITY.md.Source size (
git diff --numstat origin/main..HEAD): 2143 lines removed, 426 added across 33 files;packages/rust/srcalone 1235 removed, 108 added.Rebase onto main (2026-10-04)
Rebased over #1248 (per-table hook rows as one rowid range), #1239 (parallel walk), #1236 (glob prefix walk), #1250 and #1247. Conflicts in
db.rs,parsed_vtab.rsandpersist.rs; resolution keeps main's new ingest and walk code and this PR's removals:dirsql_parsedmodule arity: main had added the index root as a sixth argument after the cache path; the cache slot is gone, soFIXED_ARGSis now5(root, glob, parser, gitignore switch, index root) andpath_table_ddlemits exactly that.tests/schema_inference.rswas still passing the empty cache slot and is corrected.drop_user_tableskeeps main'sDELETE FROM _dirsql_internal_rangesand drops theparsed_cache::clearcall.persist.rsdoc comments that still described a second cache tier (_dirsql_parsed_rows) and the PARITY rows pointing at the deletedpersist_parsed_path_table.rsare trimmed.Hand check on the rebased release binary (
cargo build --release --features cli), temp dir witha.md,b.md,c.mdand aparse.shthat emits one row per file but exits 3 when handedb.md:dirsql query "SELECT name FROM './*.md'" --on-file 'sh parse.sh'-> exit1, nothing on stdout, stderrdirsql query: SQLite error: on-file command failed: commandsh parse.shfailed (exit 3): cannot parse /tmp/.../b.md.b.mdaway ->[{"name":"a.md"},{"name":"c.md"}], exit0.strings target/release/dirsql | grep -c 'skipping'->0`.Hand verification (pre-rebase)
Release build (
cargo build --release --features cli) over a temp dir with three*.md, two*.tag, and a counting wrapper hook:--on-file 'sh count.sh {path}'->dirsql query: failed to build the index: on-file command ... uses {path} ..., exit 1.--on-file 'sh count.sh'over./*.md-> one spawn with 3 paths, rows[a,b,c], exit 0.notesandtagstables -> two spawns (3 paths, 2 paths), one per table, exit 0.dirsql query: failed to load config: tablenotes: on-file command failed: ... (exit 3): nope, exit 1.strings target/release/dirsql | grep -c 'skipping'` -> 0.Speed of light
Five speed-of-light tests run sequentially on a quiet machine after the change (commands from #1205):
uv run python -m pytest tests/e2e/use_case_dossier_test.py -q -rxX -k speed_of_light... use_case_join_test.py ...... use_case_notebook_test.py ...... use_case_transcripts_test.py ...uv run --with-editable ../../packages/python python -m pytest tests/e2e/speed_of_light_test.py -q -rxX(inplugins/dirsql-plugin-embeddings)The five verdicts are the ones
origin/main's markers expect (join and transcripts are strict xfail there). An earlier run under a load average of 34 had dossier and notebook miss their bars (1.098s vs 0.751s; 1.701s vs 1.569s); both pass unloaded.E2E Verification
Re-run on the rebased head (2026-10-04):
just e2e-attest-python: 39 passed, 1 xfailed in 144.88s)just e2e-attest-ts: 6 files, 18 tests passed)cargo test --workspace --features cli, exit 0;cargo clippy --workspace --features cli --all-targets -- -D warningsclean;cargo fmt --all -- --checkclean)packages/python/e2e-attestations/claude-1216-on-file-cleanup.jsonreceipt written (just e2e-attest-python)packages/ts/e2e-attestations/claude-1216-on-file-cleanup.jsonreceipt written (just e2e-attest-ts)cargo test --workspace --features cli,cargo clippy --workspace --features cli --all-targets -- -D warnings,cargo fmt --all -- --check,uv run maturin develop --release(packages/python),pnpm build(packages/ts),just e2e-attest-python,just e2e-attest-ts,just preflightjust preflightreports0 failing pair(s), 3 skipped(the three skips are the packaging gates, which need CI-built artifacts)Changelog / Migrations
packages/rust/changelog.d/2026-10-02-on-file-no-partial-scan.mdpackages/rust/migrations.d/2026-10-02-on-file-no-partial-scan.mdAlso closes #1187
With the per-file loop gone, a parser that fails to spawn fails the statement with that error instead of per-file skip lines followed by
parser produced no rows ...; cannot infer a schema. Hand check on this branch's release binary,dirsql query "SELECT * FROM './*.md'" --on-file 'definitely-not-a-program':exit 1. Main prints two
skippinglines and ends on the schema-inference error.