Repository navigation
fix(detector): shield yaml block-scalar content in the indentation slicer (#3277) - #3279
Merged
Merged
Conversation
…icer (#3277) A YAML `|`/`>` block scalar's content is opaque literal text (a `run:` shell body, a github-script `with: script:` JS block), but Mode C's index-aligned indentation shield never treated it as such. Its unbounded single-quote pass then paired an apostrophe embedded in that literal (`console.log('done')`, `const x = 'it\'s here'`) with a much-later quote and blanked the real `- name:`/`run:` step keys in between -- the #1302/#1184 quote-cascade shape, here triggered by embedded JS/shell rather than a stray English contraction. Confirmed on language-crucible's vscode api-proposal-version-check.yml: func_start matched 7 step keys but only 3 became units, with a lone `script:` unit (the github-script input, not a step) running loc=163 to EOF and swallowing 4 real steps (Pass on override comment / Check for version changes / Post warning comment / Fail if version changed). Fix: `_blank_yaml_block_scalars` blanks every block scalar's body to spaces (index-aligned, newlines preserved) BEFORE the string/comment shield, so the quote pass can't cross into/out of literal content and the dedent scan sees real step structure only. Gated to lang_id == "yaml"; python/haskell Mode C untouched. Result: yaml signal(127) == named(127) on every scanned file (was 127->123), each unit a real CI step. Independent per-file cross-check vs a `run/script/ before_script/after_script` step-key parse on block-blanked text: EXACT on all 32 scanned files (127==127, zero mismatches; moby/arm64.yml hand-checked 11==11) -> yaml func precision manual-verified 127/127** in manual_verification.json. Both golden masters re-blessed (yaml files gain function units; 82 topological + 12 substantive, all yaml + a composition ripple; no file newly parsed/excluded). Tri-comparison + tree-sitter-accuracy charts regenerated. Regression test added. Gates green: ruff/mypy/dead-key --ci, tree_sitter_accuracy --all --ci 30/30, 205 detector/badge tests. Separately filed #3278: ~9 CI workflow files (dotfiles like .test.yml, pr-*-test.yml) aren't classified/scanned as yaml at all -- an aperture gap that lowers the found-count but not the precision of what IS found. Closes #3277. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_014YjKQbFUMBMsH4oXKhT36G
Contributor
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.
Closes #3277.
The bug
A YAML
|/>block scalar's content is opaque literal text (arun:shell body, a github-scriptwith: script:JS block), but Mode C's indentation shield never treated it as such. Its unbounded single-quote pass paired an apostrophe embedded in that literal (console.log('done'),const x = 'it\'s here') with a much-later quote and blanked the real- name:/run:step keys in between — the #1302/#1184 quote-cascade shape, here triggered by embedded JS/shell.Confirmed repro (
vscode api-proposal-version-check.yml):func_startmatched 7 step keys but only 3 became units; a lonescript:unit (a github-script input, not a step) ranloc=163to EOF, swallowing 4 real steps.The fix
_blank_yaml_block_scalarsblanks every block scalar's body to spaces (index-aligned, newlines preserved) before the string/comment shield, so the quote pass can't cross into/out of literal content and the dedent scan sees real step structure only. Gated tolang_id == "yaml"— python/haskell Mode C untouched.Result — and yaml is now verified
run/script/before_script/after_scriptstep-key parse (on block-blanked text): EXACT on all 32 scanned files (127==127, zero mismatches; moby/arm64.yml hand-checked 11==11).127/127**inmanual_verification.json(the last remaining bare0/Ngg-only precision cell — now every gg-only language carries a**).Cascade (all in this PR)
test_detector_yaml_block_scalar_does_not_swallow_following_steps).Verification
ruff/mypy/dead_key --ciclean ·tree_sitter_accuracy --all --ci30/30 · 205 detector/badge tests · 197+429 detector/Mode-C tests earlier (python/haskell unaffected).Follow-up (separate)
#3278: ~9 CI workflow files (dotfiles like
.test.yml,pr-*-test.yml) aren't classified/scanned as yaml at all — an aperture/detection gap that lowers the found-count but not the precision of what IS found.🤖 Generated with Claude Code