Skip to content

fix: resolve '..' physically in config [[table]] globs - #1670

Open
thekevinbot wants to merge 4 commits into
mainfrom
bot/1627-config-dotdot-1105
Open

thekevinbot wants to merge 4 commits into
mainfrom
bot/1627-config-dotdot-1105

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1627

A config [[table]] glob with an absolute, ~/, or ../ prefix folded .. lexically before the filesystem saw it, so glob = '/r/y/link/../*.md' matched y/*.md, while ls /r/y/link/../*.md (bash, globstar on) lists real/*.md when y/link -> real/sub. #1606 already fixed this for path-tables.

Red

The red-test commit a96524e failed CI for the asserted reason: https://github.com/thekevinscott/dirsql/actions/runs/42132996705 (Rust Unit tests job: https://github.com/thekevinscott/dirsql/actions/runs/42132996705/job/127614014092)

test path_table::tests::an_absolute_config_glob_keeps_a_parent_component_for_the_filesystem_to_resolve ... FAILED
  left: Some(("/a", "*.md"))
 right: Some(("/a/link/..", "*.md"))

Locally, the new tests/config_anchor.rs integration tests failed the same way at that commit (left: ["LEXICAL"], right: ["PHYSICAL"]).

Fix

path_table::config_anchor_as now folds .. only for verbatim Windows paths (\\?\), where the OS takes .. literally. This is the same rule resolve_as applies to path-tables. All other anchors keep .. as written, and the OS resolves it. The live watcher already watches the canonicalized anchor.

The on-file hook now receives paths, and {root}, with the .. as written (see the migration fragment).

Tests:

  • Unit tests in path_table.rs: an absolute anchor keeps ..; a verbatim Windows anchor still folds; the ../shared anchor expectation is updated to /cfg/../shared.
  • SDK integration tests in tests/config_anchor.rs (cfg(unix)): the absolute and ../ forms through a real symlink.

By hand (debug CLI, y/link -> real/sub; bash cat on each glob prints PHYSICAL):

glob '/tmp/r1627.CU4W/y/link/../*.md' -> PHYSICAL
glob '../y/link/../f.md' (config in /tmp/r1627.CU4W/cfg) -> PHYSICAL

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass (impacted subset)
  • TypeScript SDK e2e: pass
  • Rust core e2e (if applicable): pass, apart from the non-UTF-8 name suites, which fail on this host while creating their fixtures (unrelated; see below)
  • packages/python/e2e-attestations/<branch>.json receipt written if packages/python changed (just e2e-attest-python)
  • packages/ts/e2e-attestations/<branch>.json receipt written if packages/ts changed (just e2e-attest-ts)
  • Command(s) run: cd packages/python && uv run maturin develop --release, then testing-conventions e2e attest 'uv run python -m pytest tests/e2e/on_file_query_test.py tests/e2e/declared_table_name_test.py tests/e2e/fanout_test.py tests/e2e/query_contract_test.py tests/e2e/use_case_transcripts_test.py -x -q'; just e2e-attest-ts; cargo test --workspace --features cli --no-fail-fast
  • Result summary: Python 18 passed. TS 28 passed. In Rust, everything passed except tests/non_utf8_names.rs and tests/non_utf8_names_e2e.rs. Those fail while creating their fixtures (Os { code: 84, "Invalid or incomplete multibyte or wide character" }) because this host's filesystem rejects non-UTF-8 file names. CI runs them.

Changelog / Migrations

  • Changelog fragment added under <root>/<pkg>/changelog.d/ for each changed package (or: skip-changelog trailer on a commit with reason)
  • Migration fragment with the same slug added under <root>/<pkg>/migrations.d/ for each changed package (every subsection but Summary _None._ when nothing breaks)

Red ahead of the fix: the config anchor folds '..' lexically, so a '..' after a symlinked directory reads a different file than the shell does.
The config anchor no longer folds '..' lexically; the filesystem resolves it, as for path-tables. Verbatim Windows paths, where the OS takes '..' literally, still fold.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config [[table]] globs fold '..' lexically instead of resolving it like the shell

1 participant