Repository navigation
fix(core-engine): yaml args reads declared inputs: and counts parameters, not blocks (#2753) - #2759
Merged
Merged
Conversation
…ers, not blocks (#2753) `yaml/args` read 0 against a rosetta median of 13. The rule was narrower than the language on two axes: 1. It matched only `with:` -- the CALL-SITE argument block, which binds to `uses:`. The parameter surface a YAML file DECLARES (what every other language's `args` reads off a def/function/sub line) is `inputs:`: `on: workflow_dispatch:`/`workflow_call:` inputs, and action.yml's top-level `inputs:`. A composite action declaring 24 inputs read 0. 2. It counted BLOCKS, not parameters: the regex consumed the header through its first key as one match, so a `with:` carrying five inputs read 1. A YAML key line means "parameter" or "ordinary config key" purely by what it is nested under (`fetch-depth: 0` is an argument beneath `with:` and a plain setting anywhere else) -- the enclosing form, which no flat pattern can see. So the rule now matches every indented mapping key and a registry-declared `yaml_parameter_block` scope filter (#2674's mechanism) keeps only the keys whose immediate parent is a valueless `with:` / `inputs:` / `args:` header. Direct children only: under `inputs:` the direct children are the parameter names, and their own `description:`/`required:`/`default:` keys are that parameter's attributes. The walk skips block-scalar bodies, so a `run: |` heredoc that itself contains `with:` / `key: value` lines cannot forge a parameter block out of text. It also strips a trailing comment before deciding whether a header carries a value, preserving epic #813/#843's `with: # inputs for this action` fix, and has no {0,10} cap on the comment/blank run before the first key. Because a filtered rule matches a superset on purpose, `_calculate_block_metrics`' per-function args count is re-pointed at the already-filtered spatial map for any rule with a declared scope filter -- otherwise every `- run:` step would have "declared" one argument off its own `run:` key. Ansible's module-parameter surface (the mapping under a bare module name) is deliberately out of scope: its key vocabulary is unbounded, so recognising it would mean treating any nested mapping as a parameter block. `vars:` is left out for the same reason it is not `state_mutation`'s job to guess -- nothing on the block distinguishes Ansible's variable block from the parameter-passing use on `include_role`/`include_tasks`. Measured: against a PyYAML oracle over 196 unique real .yml/.yaml files (GitHub Actions workflows, action.yml composite actions, compose/k8s/openapi), 868 parameter keys, engine and oracle agree exactly on every file. Both corpora (keyword-rosetta and language-crucible) still read 0 -- neither contains a `with:`/`inputs:`/`args:` block -- so no golden master moves; the rosetta cell needs its paired corpus plant (keyword-rosetta#59). Closes #2753 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
squid-protocol
added a commit
that referenced
this pull request
Sep 5, 2026
Conflict was the two golden-master fixtures again, both auto-generated: #2755 (jcl api/cleanup/globals) and #2759 (yaml args) re-blessed them on main while this branch was in flight. `gitgalaxy/core/detector.py` merged cleanly -- their changes are in the rules, this one is in the Mode D slicer. Resolved per .agents/skills/ci-push-checklist section 6: took origin/main's version of both fixtures to clear the markers, then re-ran `crucible_check.py --update --yes` so they are recalculated from the merged code rather than stitched together. Verified rather than trusted: re-attributed the regenerated fixture against origin/main and got the same profile as before the merge, exactly -- 20 differences, 0 topology movement, `Start Line` the only field changed inside `5. Function Analysis`, and all 17 per-file diffs on `.sh` files. #2755's and #2759's own contributions are in the base and untouched. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WfeHRWra1d6Z5uSReFajSq
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 #2753
yaml/argsread 0 against a rosetta median of 13. The rule was narrower than the language on both axes the issue names.1.
with:is the call site;inputs:is the declarationThe old rule matched only
with:supplies arguments to an action (it binds touses:). The parameter surface a YAML file declares — what every other language'sargsreads off adef/function/subline — isinputs::on: workflow_dispatch:/workflow_call:inputs (the latter being the signature of the reusable-workflow API #2743 added to theapitrigger set), andaction.yml's top-levelinputs:. None matched, so a composite action declaring 24 inputs read 0.2. It counted blocks, not parameters
The regex consumed the header through its first key as one match, so a
with:carrying five inputs readargs1. Every other language records one hit per parameter.The shape
Both are fixed by inverting the rule. A YAML key line means "parameter" or "ordinary config key" purely by what it is nested under —
fetch-depth: 0is an argument beneathwith:and a plain setting anywhere else — and that is the enclosing form, which no flat pattern can see. Soargsnow matches every indented mapping keyand #2674's registry-declared scope-filter mechanism keeps only the keys whose immediate parent is a valueless
with:/inputs:/args:header. Direct children only: underinputs:the direct children are the parameter names, and their owndescription:/required:/default:keys are that parameter's attributes, not further parameters._yaml_parameter_child_offsetsis one indentation walk, O(lines). It skips block-scalar bodies, so arun: |heredoc that itself containswith:andkey: valuelines cannot forge a parameter block out of shell text — the single most dangerous false positive this shape invites. It strips a trailing comment before deciding whether a header carries a value, which preserves epic #813/#843'swith: # inputs for this actionfix, and it has no{0,10}cap on the comment/blank run before the first key.The other consumer of the rule
A rule with a declared scope filter matches a superset on purpose, so
_calculate_block_metrics' generic single-.search()args derivation would have read that superset: every- run:step would have "declared" one argument off its ownrun:key, a pure measurement artefact (the shape #2722 hit for shell). For any rule with a declared scope filter the per-function count now comes off the already-filtered spatial map (hit_vector["args"]) instead. Only yaml declares one forargs, so nothing else changes.Measured against a real YAML parser
Not just corpus counts: a PyYAML oracle counts the direct children of every
with:/inputs:/args:mapping, and the engine is compared to it file by file..yml/.yamlon the dev box — GitHub Actions workflows,action.ymlcomposite actions, compose/k8s/openapi/ansiblePlus 18 adversarial shapes pinned as tests (block scalars, tabs, dash-introduced keys, flow-style
with: {…}, commented-out blocks, sequence-formargs:, empty blocks, awith:nested inside awith:value).Cost
Matching every indented key sounds expensive; measured, it isn't — the old
with:regex was itself scanning the whole file, and the filter is one pass over the lines.coding_analysison the largest YAML to hand, a 361 KBswagger.yaml: 1169 ms → 1135 ms (0.97x). A 21 KBmkdocs.yml: 19.0 → 19.7 ms. A 4 KB workflow: 2.8 → 2.9 ms. The walk itself is pinned linear by a test on three pathological shapes (one enormous parameter block, 20k indentation changes, one enormous block scalar).Deliberately out of scope
fail:→msg:) — its key vocabulary is unbounded (every module in every collection), so recognising it would mean treating any nested mapping as a parameter block, which is the over-claim this rule already had in the other direction.vars:— Ansible's variable block, the analogue of yaml's ownenv:(whichstate_mutationclaims).vars:oninclude_role/include_tasksreally does pass parameters, but nothing on the block itself distinguishes the two uses. Both are recorded in the code comment.Verification
pytest tests/audit_check.py(ruff/mypy/dead-key/ast-accuracy)tree_sitter_accuracy_audit.py --ci --alltri_comparison_chart.py --all --cirosetta_audit.pycrucible_check.pyNo golden-master bless is owed. Neither corpus contains a
with:/inputs:/args:block — the language-crucible yaml sample is 7 Ansible task files, and the rosetta shell isrun:steps — so both readargs0 before and after. That is also why the old rule was unexercised by the golden master (the caveat recorded as language-crucible#23).Cross-repo
The rosetta cell needs its paired corpus plant: squid-protocol/keyword-rosetta#59 (pairing table row for #2753). Engine merges first, then the corpus PR re-blesses against engine
main(docs/GATING.md "Cross-repo flow"; gitgalaxy#2682 — no pins). The corpus plant declares oneinputs:key per function definition in each file (main 4, a/b/c 3 each = 13, exactly SPEC's "13 function definitions, each taking one argument"), which needs nouses:line and so adds no fake edge to the planted main→a→b→c DAG — the objection that made the original ledger entry decline thewith:plant.Docs:
how_to_add_a_language.mdrule 17 gains the yaml filter as the worked example of a scope filter used in the widening direction, with the warning to check every other consumer of a rule before letting it match a superset.🤖 Generated with Claude Code