Skip to content

fix(detector): shield yaml block-scalar content in the indentation slicer (#3277) - #3279

Merged
squid-protocol merged 1 commit into
mainfrom
fix/3277-yaml-block-scalar-shield
Sep 22, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/3277-yaml-block-scalar-shield

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3277.

The bug

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 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_start matched 7 step keys but only 3 became units; a lone script: unit (a github-script input, not a step) ran loc=163 to EOF, swallowing 4 real steps.

The 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 — and yaml is now verified

  • 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 (the last remaining bare 0/N gg-only precision cell — now every gg-only language carries a **).

Cascade (all in this PR)

  • 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 (test_detector_yaml_block_scalar_does_not_swallow_following_steps).

Verification

ruff/mypy/dead_key --ci clean · tree_sitter_accuracy --all --ci 30/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

…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
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 62b5cd4 into main Sep 22, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the fix/3277-yaml-block-scalar-shield branch September 22, 2026 19:50
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.

yaml: multi-line |/> block-scalar content breaks the step slicer, dropping subsequent CI steps

1 participant