Repository navigation
core: fold the launcher argv config-path scan into Rust - #1106
Merged
Merged
Conversation
Adds dirsql::launcher::config_paths_from_argv with the 20 cases the three launcher copies of this scan collectively cover, against a stub that always returns the default config path. 15 of the 20 fail. Refs #1078
…s through it `dirsql::launcher::config_paths_from_argv` now walks argv for every `--config` / `-c` value (all five spellings) and falls back to `./.dirsql.toml`, turning the 20 red inline tests green. Both bindings export it: `dirsql._dirsql.config_paths_from_argv` (PyO3) and the napi addon's `configPathsFromArgv`. The pip and npm launchers call through the binding, and the per-language copies of the scan are deleted along with their unit tests. Launcher unit tests keep mocking the scan at the same seam, now the binding. PARITY.md records that the scan is shared by construction; changelog fragments for python and ts describe the no-observable-change move. Refs #1078, #1072
The launcher sources changed their collaborator from a sibling module to the core binding, so the colocated tests now assert that seam: the Python launcher's `config_paths_from_argv` is the `dirsql._dirsql` builtin, and `CoreModule` carries `configPathsFromArgv` as a typed member. Also biome-formats the two TS files the rewiring touched.
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 #1078
Part of the reduction epic #1072. Slice A of the issue: the argv config-path scan only. The rest of the extension-resolution cluster is #1111.
What this does
-c/--configwas parsed three times: once by clap in the core (for real), and once each in the pip and npm launchers, which walk raw argv before the core runs because a config's[[dirsql.extension]]entry may name an extension by bare package name and only the interpreter can resolve that. Locating the config files is language-neutral, so the scan moves into the core asdirsql::launcher::config_paths_from_argvand both launchers reach it through their existing binding:packages/rust/src/launcher.rs(#[doc(hidden)] pub mod launcher, 20 inline tests).dirsql._dirsql.config_paths_from_argv(packages/python/src/lib.rs, stub in_dirsql.pyi).configPathsFromArgv(packages/ts/napi/src/lib.rs, typed onCoreModuleincore.ts).packages/python/dirsql/cli/config_paths_from_argv.py,packages/ts/src/cli/config-paths-from-argv.ts, and their unit tests.The TS launcher still defers
smol-tomlbehind the sameexistsSyncguard (#720); the binding call replaces a pure function and reads no files.Public API
Unchanged. The new function exists only on private surfaces: the underscore module
dirsql._dirsql, the napi addon (not re-exported byindex.ts), and a#[doc(hidden)]Rust module.dirsql/__init__.pyandpackages/ts/src/index.tsare untouched.Tests
No assertion deleted or weakened. Both launcher unit suites already mocked the argv scan as a collaborator, so only the mock target moved (
rce.config_paths_from_argvis now the builtin; TS mocksgetCore()). Every case in the two deleted scanner test files has a counterpart inlauncher.rs(the Python-c -c x→["-c"]case isconsumes_a_config_value_that_is_itself_a_config_flag), plus five cases neither had:--configuration, other long flags,--config=/-c=with an empty value, and--not ending options. Colocated tests on the changed launcher sources pin the new seam (resolve_config_extensions_test.py,core.test.ts). Each binding crate has an inline forwarding test.Red/green
64178a2pushed alone:launcher.rswith a stub returning the default. CI red for the right reason: rustUnit testsran 15 of the 20launcher::tests::*red at the assertion lines (https://github.com/thekevinscott/dirsql/actions/runs/34359934537/job/102494017762); the 5 that passed only assert the default.Integration tests, the coverage floor, rust mutation and bothe2e-verifygates were red as consequences (stub, no receipts).ae4f94c: implementation, both bindings, launcher rewiring, deletions, fragments, PARITY.8db47b0/04f5cca: e2e receipts.1e17c94: colocated co-change tests the gate asked for, plus biome formatting.Measured (epic
srcline.py, source lines excluding tests,origin/main→ head)packages/rust/srcpackages/python/srcpackages/ts/napi/srcpackages/python/dirsqlpackages/ts/srcClose to line-neutral, as the issue predicted for this slice; the case rests on the one-implementation principle, not the count.
Manual run
Built the
testextfixture (dirsql_testext_answer() -> 42) and installed it by bare package name (dirsql_testext_pkgonPYTHONPATH;dirsql-testext-pkgunderpackages/ts/node_modules), with a configext.tomlnaming it plus afilestable. The compiled binary cannot resolve a package name, so a42proves the launcher found the config through the core scan.Identical output from
packages/python/.venv/bin/dirsql(maturin develop) andnode packages/ts/dist/cli/dirsql.js(pnpm build) for all three spellings and the no-flag case.E2E Verification
packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)just e2e-attest-python(runsjust test-e2e),just e2e-attest-ts(runspnpm test:e2e),cargo test --workspace --features cli,cargo bench -p dirsql,just preflightcargo test --workspace --features cliall green (843 lib tests + integration/e2e binaries, 0 failed);just preflight0 failing pairs, 3packagingSKIPs (need a built artifact); rust mutation gate 6 mutants tested, 0 survived;cargo bench -p dirsqlexit 0, 33 benchmarks (no stored baseline to compare against;launcher.rsis on no benchmarked path)Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/(or: not required -- additive/bugfix only)Fragments:
packages/rust/changelog.d/2026-09-09-launcher-config-path-scan.md(Added),packages/python/changelog.d/2026-09-09-launcher-config-path-scan.md(Changed),packages/ts/changelog.d/2026-09-09-launcher-config-path-scan.md(Changed). No migration fragment: runtime behavior is identical (same flags, same paths, same./.dirsql.tomldefault) and no public API changes.Parity
PARITY.md"Config-flag scanning breadth" updated. No drift introduced: both launchers now share one scan by construction.Left alone
packages/python/dirsql/cli/discover_plugins/user_passed_config.pyalso inspects argv for-c/--config, but answers a different question (did the user pass any config flag, yes/no) on the Python-only plugin-discovery path (Plugin discovery in the Python launcher #529); it stays.vtab.rs/parsed_vtab.rs, Watch: a directory moved into the root is never indexed #1096 watch path). This PR'slib.rshunk is one line betweeninferandmatcher.