Skip to content

fix(lang)!: read a quoted !ii scalar as its text - #528

Merged
vjaganat90 merged 2 commits into
PolusAI:masterfrom
vjaganat90:fix/quoted-ii-is-text
Oct 13, 2026
Merged

vjaganat90 merged 2 commits into
PolusAI:masterfrom
vjaganat90:fix/quoted-ii-is-text

Conversation

@vjaganat90

@vjaganat90 vjaganat90 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Stacked on #527 (ci/release-artifact-check). Merge that first; this PR's own changes are the commits above it.

What

  • A quoted !ii scalar is its text, and a plain one is read as YAML reads the same plain scalar. !ii '5' is the string "5", and !ii 5 stays the int. A block scalar (!ii |) is text too, as YAML reads it.
  • The writer quotes a string that YAML would read as something else (!ii '0', !ii '1:30', !ii '') instead of falling back to the {wic_inline_input: ...} spelling. !cwl, !* and !& payloads are written plain wherever that is safe, and read back the same.
  • write_wic writes a real-time declaration back as run: cwl_subinterpreter and leaves the adapter out of the bundle. It used to copy the adapter beside the document as run: cwl_subinterpreter.cwl, which read back as an ordinary tool step, so max_times: !ii '20' became a wic020 on the step's int input once quoting meant text.
  • The CHANGELOG's 0.7.0 advice on !ii '007' is rewritten, and the language guide and spec state the rule.

Why
!ii re-read the text of a tagged scalar to recover numbers and booleans, but it never looked at the quoting, so quoting could not mean text. !ii '5' on a string input arrived as the int 5. Now a quoted number on an int input is wic020, not a silent conversion.

Checked against the external corpus (fresh mm-workflows and image-workflows): the compiled output is identical before and after. Its only quoted numbers are max_times: !ii '20' on real-time declarations, which accept a string integer.

@darkclad darkclad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vjaganat90
vjaganat90 force-pushed the fix/quoted-ii-is-text branch 3 times, most recently from 6baf579 to 7f796e5 Compare October 13, 2026 17:41
A tag switches off YAML's implicit typing, so the parser re-read an `!ii`
scalar's text to recover numbers and booleans, without looking at how it
was written: `!ii '5'` became the int 5, and there was no way to write
text that YAML would type. I now read an `!ii` scalar as YAML reads the
same scalar untagged: plain by what it says, quoted or block as its text.
The desugared `{wic_inline_input: '5'}` already read that way.

The writer keeps the distinction: a string YAML would read as something
else is written quoted, `!ii '0'`, instead of falling back to the
desugared spelling, whose reason is gone. The fallback for a construct as
the direct payload stays, since two tags cannot share a node. A plain
spelling is transcribed plain, so `!ii 1:30` no longer comes back quoted
and re-typed.

Every quoted `!ii` in mm-workflows and image-workflows is a glob or a
path, or a `max_times` the real-time declaration accepts as a digit
string, so the corpora compile unchanged.
write_wic wrote every step as `run: <stem>.cwl` with the tool copied
beside the document. A `run:` path that exists is registered under a
name of its own, so a cwl_subinterpreter step read back from the
bundle no longer ran the registry's adapter: it was an ordinary tool
step, emitted into the CWL, with its literals type-checked against the
adapter's inputs. The objects compiled to a declaration and their
bundle to a step, and `max_times: !ii '20'`, which the declaration
reads as 20, became a wic020 on the step's int input.

I now write the adapter by its registry stem, `run: cwl_subinterpreter`,
and leave it out of the bundle, so the bundle declares the same
analysis the objects do and the declaration stays the one place that
reads `max_times`.
@vjaganat90
vjaganat90 force-pushed the fix/quoted-ii-is-text branch from 7f796e5 to d69e945 Compare October 13, 2026 18:05
@vjaganat90
vjaganat90 merged commit 16ef65e into PolusAI:master Oct 13, 2026
3 checks passed
@vjaganat90
vjaganat90 deleted the fix/quoted-ii-is-text branch October 13, 2026 18:13
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.

2 participants