Skip to content

test(order-flow): cover block comments through the write path - #195

Merged
martin-fleck-at merged 1 commit into
mainfrom
fix/ml-comment-fixture
Sep 23, 2026
Merged

martin-fleck-at merged 1 commit into
mainfrom
fix/ml-comment-fixture

Conversation

@martin-fleck-at

@martin-fleck-at martin-fleck-at commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

ML_COMMENT was the one grammar rule no model file in the sample workspace used, in all three grammars — and the trivia round-trip test only used // as well. So the block-comment half of comment preservation was never exercised anywhere.

The two forms are not interchangeable for this code path. A line comment's range runs to the end of its line, so a splice that misplaces one comments out whatever followed. A block comment's does not, so the same misplacement leaves live syntax to its right. Same defect, different symptom, and only the first was covered.

Preservation already handles both. This closes a coverage hole rather than fixing a bug.

  • A trivia case asserting /* */ survives serialize and reattach in all four positions — leading, trailing on a line, dangling after the last member, and document-level — including one spanning two lines, which keeps its own line breaks because the preserver carries the token rather than a reflowed rendering.
  • A block comment in the sample orders/returns.process, so the example workspace demonstrates a construct the grammar supports and no model file used. structured-write-path already round-trips that file and asserts it comes back byte-identical, so the comment is covered there for free.
  • The browser workspace seed regenerated, since it embeds the model files.

Why returns.process

The first push put the comment in fulfillment.process and e2e failed. The browser spec needs a header comment line and the effect line visible in one Monaco viewport at the same time; .view-line elements only exist for rendered lines, so five extra lines between them pushed one out of view and two occurrence-highlighting cases found zero elements. returns.process is referenced by the spec only for a diagnostics badge count, which a comment does not change.

That was my miss: I ran the order-flow server suite and not the e2e tier. This time both were run locally — 413 server tests and 69 e2e tests pass.

Found by running langium-ai-tools' LangiumDocumentAnalyzer over the sample workspace while evaluating whether Langium AI is worth adopting. It isn't, for unrelated reasons, but the coverage report was worth keeping.

- Add a trivia case asserting `/* */` comments survive serialize and
  reattach in all four positions, including one spanning two lines
- Put a block comment in the sample returns.process, so the example
  workspace demonstrates a construct no model file used, and the
  structured-write-path round trip asserts it comes back byte-identical
- Regenerate the browser workspace seed, which embeds those files

A line comment runs to the end of its line and a block comment does not,
so a misplaced splice leaves live syntax to its right instead of
commenting the remainder out. Preservation already handles both; nothing
exercised the second.

returns.process rather than fulfillment.process because the browser e2e
needs a header comment and an effect line visible in one Monaco viewport,
and five more lines between them pushes one out.
@martin-fleck-at
martin-fleck-at merged commit 40c75b5 into main Sep 23, 2026
7 checks passed
@martin-fleck-at
martin-fleck-at deleted the fix/ml-comment-fixture branch September 23, 2026 21:36
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.

1 participant