Commit f0eda7b
fix(toml): keep every segment of a dotted key
Follow-up to #378 (@zuoYu-zzz), whose TOML extractor is otherwise sound and
whose array-table handling I could not break.
_extract_key handled a dotted_key by scanning its DIRECT children for
bare_key/quoted_key. tree-sitter-toml nests dotted_key left-recursively:
[tool.ruff.lint]
-> dotted_key( dotted_key( bare_key tool, bare_key ruff ), bare_key lint )
The inner dotted_key was not in the filter tuple, so every segment except the
last was dropped. Two-level paths worked, which is why it looked correct at a
glance. Three-plus levels broke, on this repo's own pyproject.toml:
[tool.hatch.build.targets.wheel] -> wheel / signature [wheel]
[tool.pytest.ini_options] -> ini_options / [ini_options]
[tool.ruff.lint] -> lint / [lint]
[tool.ruff.lint.per-file-ignores] -> per-file-ignores / [per-file-ignores]
The signature is the sharp end. "[wheel]" is a header that appears NOWHERE in
the file, so search_symbols would hand an agent fabricated source text. And
...targets.wheel / ...targets.sdist collapse to names that collide with any
other three-deep table sharing that leaf.
_extract_key becomes _extract_key_parts, returning segments instead of a
pre-joined string and recursing on the nested dotted_key. Building from parts
also fixes name/qualified_name, which the PR set to the same value: name is now
the LEAF and qualified_name the full dotted path, the convention every other
extractor in this module already follows.
New test asserts three- and five-deep tables, a dotted key inside a table
(a.x.y.z), a dotted array table, and that a table's signature is text that
actually occurs in the source. Proven non-vacuous: restoring the single-token
bug flips it to FAIL. The PR's own test uses only single-segment headers, so
nothing in the suite could have caught this.
Docstring now records that the every-pair-at-every-depth policy diverges from
_parse_json_symbols (root-level keys only) DELIBERATELY, so nobody "fixes" it
later: TOML tables are genuinely structural, and lock files never route here
because Cargo.lock / uv.lock / poetry.lock carry no .toml extension.
Rides the next release alongside #379. No schema, tool-count, or INDEX_VERSION
change; previously-skipped .toml files simply gain correct symbols on reindex.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent b19e518 commit f0eda7b
2 files changed
Lines changed: 98 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6362 | 6362 | | |
6363 | 6363 | | |
6364 | 6364 | | |
| 6365 | + | |
| 6366 | + | |
| 6367 | + | |
| 6368 | + | |
| 6369 | + | |
| 6370 | + | |
| 6371 | + | |
| 6372 | + | |
6365 | 6373 | | |
6366 | 6374 | | |
6367 | 6375 | | |
| |||
6371 | 6379 | | |
6372 | 6380 | | |
6373 | 6381 | | |
6374 | | - | |
6375 | | - | |
| 6382 | + | |
| 6383 | + | |
| 6384 | + | |
| 6385 | + | |
| 6386 | + | |
| 6387 | + | |
| 6388 | + | |
| 6389 | + | |
6376 | 6390 | | |
6377 | | - | |
| 6391 | + | |
6378 | 6392 | | |
6379 | 6393 | | |
6380 | | - | |
| 6394 | + | |
6381 | 6395 | | |
6382 | | - | |
| 6396 | + | |
6383 | 6397 | | |
6384 | | - | |
6385 | | - | |
6386 | | - | |
6387 | | - | |
| 6398 | + | |
| 6399 | + | |
| 6400 | + | |
| 6401 | + | |
6388 | 6402 | | |
6389 | 6403 | | |
6390 | 6404 | | |
| |||
6394 | 6408 | | |
6395 | 6409 | | |
6396 | 6410 | | |
6397 | | - | |
6398 | | - | |
6399 | | - | |
| 6411 | + | |
| 6412 | + | |
| 6413 | + | |
6400 | 6414 | | |
6401 | 6415 | | |
6402 | 6416 | | |
6403 | | - | |
| 6417 | + | |
6404 | 6418 | | |
6405 | 6419 | | |
6406 | 6420 | | |
| |||
6411 | 6425 | | |
6412 | 6426 | | |
6413 | 6427 | | |
6414 | | - | |
| 6428 | + | |
6415 | 6429 | | |
6416 | 6430 | | |
6417 | 6431 | | |
6418 | 6432 | | |
6419 | 6433 | | |
6420 | 6434 | | |
6421 | 6435 | | |
6422 | | - | |
6423 | | - | |
6424 | | - | |
| 6436 | + | |
| 6437 | + | |
| 6438 | + | |
6425 | 6439 | | |
6426 | 6440 | | |
6427 | 6441 | | |
6428 | | - | |
| 6442 | + | |
6429 | 6443 | | |
6430 | 6444 | | |
6431 | 6445 | | |
| |||
6436 | 6450 | | |
6437 | 6451 | | |
6438 | 6452 | | |
6439 | | - | |
| 6453 | + | |
6440 | 6454 | | |
6441 | 6455 | | |
6442 | 6456 | | |
| |||
6448 | 6462 | | |
6449 | 6463 | | |
6450 | 6464 | | |
6451 | | - | |
6452 | | - | |
6453 | | - | |
| 6465 | + | |
| 6466 | + | |
| 6467 | + | |
6454 | 6468 | | |
6455 | 6469 | | |
6456 | 6470 | | |
6457 | 6471 | | |
6458 | 6472 | | |
6459 | 6473 | | |
6460 | 6474 | | |
6461 | | - | |
| 6475 | + | |
6462 | 6476 | | |
6463 | 6477 | | |
6464 | 6478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2539 | 2539 | | |
2540 | 2540 | | |
2541 | 2541 | | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
0 commit comments