Public: anyone can read this; the crew can change it.

Merge scanTomlValue and scanYamlValue into one value scanner #17091

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scanTomlValue and scanYamlValue are now one function, scanConfigValue(line, from, out, dialect), in the new src/web/highlight/value.ts. The 90 tests in test/highlight.test.ts pass and tsc is clean. The gate showed no failing rules in its local run after the second commit.

Notes

opened this

scanTomlValue and scanYamlValue are now one function, scanConfigValue(line, from, out, dialect), in the new src/web/highlight/value.ts. The 90 tests in test/highlight*.test.ts pass and tsc is clean. The gate showed no failing rules in its local run after the second commit. The branch is pushed, and the forge's full check on the push is still to come.

The dialect argument is "toml" | "ini" | "yaml", and it carries the only places the two scanners differed:

  • Comments: TOML opens a comment on #, INI also on ;, and YAML only on a # that follows a space.
  • Anchors and tags: &anchor, *alias and !tag are read for YAML only.
  • Constants: TOML and INI mark true and false. YAML marks true, false, null, yes, no, on, off and ~, in any case.

toml.ts and yaml.ts now call the shared function, and scanToml maps its existing toml boolean to the "toml" or "ini" dialect. The function bodies moved from those two files into value.ts.

I added test/highlight-value.test.ts, which pins the dialect differences above. It builds real Out sinks, with no as never.

I did not touch scanYaml or scanToml line handling, and I did not add any dependency. I ran bun scripts/similar.ts on no draft; the new file is the two existing bodies merged.

Try it: open /docs and view a YAML or TOML code block; it should highlight as before. No page, action or route changed, so the commit lines say No door: and No look:.

🤖 Generated with Claude Code

Closes #16803

2 earlier comments
commented

scanTomlValue and scanYamlValue are now one function, scanConfigValue(line, from, out, dialect), in the new src/web/highlight/value.ts. The 90 tests in test/highlight*.test.ts pass and tsc is clean. The gate showed no failing rules in its local run after the second commit. The branch is pushed, and the forge's full check on the push is still to come.

The dialect argument is "toml" | "ini" | "yaml", and it carries the only places the two scanners differed:

  • Comments: TOML opens a comment on #, INI also on ;, and YAML only on a # that follows a space.
  • Anchors and tags: &anchor, *alias and !tag are read for YAML only.
  • Constants: TOML and INI mark true and false. YAML marks true, false, null, yes, no, on, off and ~, in any case.

toml.ts and yaml.ts now call the shared function, and scanToml maps its existing toml boolean to the "toml" or "ini" dialect. The function bodies moved from those two files into value.ts.

I added test/highlight-value.test.ts, which pins the dialect differences above. It builds real Out sinks, with no as never.

I did not touch scanYaml or scanToml line handling, and I did not add any dependency. I ran bun scripts/similar.ts on no draft; the new file is the two existing bodies merged.

Try it: open /docs and view a YAML or TOML code block; it should highlight as before. No page, action or route changed, so the commit lines say No door: and No look:.

🤖 Generated with Claude Code

commented

<!-- look-pages ebd3ca89be02 --> Look pages for ebd3ca8, from the gate:

  • look pages (inferred): this pull changes src/web/highlight/toml.ts, src/web/highlight/value.ts, src/web/highlight/yaml.ts; the forge pictures / (src/web/highlight/toml.ts), /docs (src/web/highlight/toml.ts), /explore (src/web/highlight/toml.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

No code change this round, so I pushed nothing new. The gate's comment on #17091 is an informational note, not a failure.

ebd3ca8 already carries the Looks: No look: line the note asks for. The gate infers the look pages from the files in the diff, and it lists 31 pages because the highlighter is imported widely. The note names /, /docs, /explore and 28 others, and the commit line overrides all of them.

Reason for No look: this is a pure refactor, and the highlighter's output is unchanged. The existing test/highlight*.test.ts suites (snapshots included) pass, and the new test/highlight-value.test.ts pins the differences between the TOML, INI and YAML dialects. I disagree with picturing every importing page: the before and after would look identical.

The other items on the checklist:

  • Both doors: the commit has a No door: line, because no page, action or route changed.
  • Dead code: the only new export is scanConfigValue, called from toml.ts and yaml.ts.
  • Issue number: the first commit says Direction: … (#16803).
  • Tests: they build real Out sinks, not as never.

Re-running bun scripts/gate.ts --explain locally shows no failing rules.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs