Skip to content

Unbalanced braces and brackets in a glob are literal - #1342

Merged
thekevinscott merged 13 commits into
mainfrom
claude/1268-unbalanced-brackets
Oct 6, 2026
Merged

thekevinscott merged 13 commits into
mainfrom
claude/1268-unbalanced-brackets

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1268

An unmatched {, } or [ in a glob is a literal character, as in bash, on both path-table queries and config [[table]] glob. Path-tables: brace::escape_braces now escapes an unclosed [ instead of leaving it for globset to reject. Config globs: new unbalanced::escape_unbalanced, applied in TableMatcher::new.

Checked against bash -O globstar -O nullglob -c 'shopt -u dotglob; printf "%s\n" ...' on a fixture holding each named file. All agree: ./{a.md, ./a}.md, ./{a,b.md, ./[a.md, ./a].md, ./[]a.md, ./a[b.md, ./[!a.md, ./{a[.md, ./x{.md (each returns the literal file); ./a[b]c.md and ./[{].md (a real class, no match). Existing tests that used [ as an invalid glob now use [z-a].

Changelog / Migrations

  • Changelog fragment added under packages/{python,ts,rust}/changelog.d/
  • Migration fragment with the same slug added under packages/{python,ts,rust}/migrations.d/

E2E Verification

  • TypeScript SDK e2e: pass, receipt packages/ts/e2e-attestations/claude-1268-unbalanced-brackets.json
  • Python SDK e2e: pass after merging main (Test one-level glob listings at speed of light #1317), receipt packages/python/e2e-attestations/claude-1268-unbalanced-brackets.json. Impacted files only (glob parsing/matching): glob_speed_depth_bound_test.py, glob_speed_recursive_test.py, query_contract_test.py, fanout_test.py, capture_collision_test.py -- 15 passed
  • Rust core: cargo test --features cli --no-fail-fast passes apart from inotify watcher tests that flake under host load and pass alone; new tests/unbalanced_glob_e2e.rs passes.
  • Command(s) run: just e2e-attest-ts, testing-conventions e2e attest 'uv run python -m pytest tests/e2e/<impacted files> -x -q', cargo test --features cli

@thekevinbot
thekevinbot marked this pull request as ready for review October 6, 2026 01:03
@thekevinscott
thekevinscott merged commit 8a5cd97 into main Oct 6, 2026
84 checks passed
@thekevinscott
thekevinscott deleted the claude/1268-unbalanced-brackets branch October 6, 2026 23:01
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.

An unbalanced '{', '}' or '[' is a glob error; bash reads it literally

2 participants