Skip to content

compiler: \setlist* (enumitem starred form) is unsupported (#563) - #571

Merged
d-q222 merged 2 commits into
mainfrom
agent/daniel-muse-lead-2/setlist-star
Sep 17, 2026
Merged

d-q222 merged 2 commits into
mainfrom
agent/daniel-muse-lead-2/setlist-star

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #563.

What changed

  • \setlist*[names]{keys} now parses (previously syntax_error — the parser used the wrong star-consuming helper, since *[...] lexes as one glued word).
  • Behaves like plain \setlist plus a forced itemsep=0pt override on top of whatever keys are given, matching enumitem's real starred-form semantics.
  • Plain (non-starred) \setlist already worked correctly before this change — confirmed separately, not touched.

Tests

  • New crates/compiler/tests/setlist_spacing.rs additions: star overrides an explicit itemsep=5pt to zero while keeping topsep; \setlist* output matches \setlist + explicit itemsep=0pt.
  • Full crates/compiler suite independently re-verified fresh, 100% green, including generated_artifacts_are_current.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor

🤖 Generated with Claude Code

\setlist*[names]{keys} now parses (via take_star_prefix, since the
star lexes glued to the following bracket word) and behaves like
\setlist plus a forced itemsep=0pt on top of the given keys, with a
NoItemSep option recorded on the matching lists. Regenerate the
supported-LaTeX artifacts for the updated setlist inventory entry.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
@d-q222

d-q222 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Root cause of the red rust bridge (ubuntu-latest) check: not a real interaction with this PR's compiler change. The branch was based on a main from 2026-09-15, and main has since fixed the exact ETXTBSY fork/exec race that this test hits on Linux (8d814236 — "bridge: retry ETXTBSY compiler spawns; name the OS error in validation_launch (#632)"). crates/bridge/ is untouched by this PR, so the fix wasn't present on the stale base.

Merged current origin/main into the branch (clean, no conflicts; docs/user/compiler.md / supported-latex.json regenerated via render_supported_latex.sh to confirm — no drift) and pushed as a fast-forward (7c5854c1..c7dbc1c0).

Before (branch base, matches the CI failure):

test compiler_process_success_and_timeout_leave_editor_unchanged ... FAILED
thread '...' panicked at tests/proposal_validation.rs:101:40:
called `Result::unwrap()` on an `Err` value: BridgeError { code: "validation_launch", message: "Could not launch the configured FlashTeX compiler" }
test result: FAILED. 6 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.07s

After (post-merge, cargo test --release --locked --no-fail-fast):

test compiler_process_success_and_timeout_leave_editor_unchanged ... ok
test result: ok. 7 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.11s

Full flashtex-bridge suite: 24 passed, 0 failed. Full flashtex-compiler suite (the crate this PR actually changes): 412 passed, 0 failed.

@d-q222 d-q222 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

test-self-review-check

@d-q222 d-q222 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(Ignore the earlier one-line comment on this PR — accidental artifact while probing GitHub's self-review restriction below.)

Independent review of #571 (compiler: \setlist* starred form).

What I ran

git -C /Users/dqi26/flashtex fetch origin pull/571/head:refs/review/pr-571
git -C /Users/dqi26/flashtex worktree add ~/flashtex-wt/review-571 refs/review/pr-571

cd ~/flashtex-wt/review-571/crates/compiler
CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-review-571 CARGO_BUILD_JOBS=4 \
  cargo test --test setlist_spacing
-> running 12 tests
   test setlist_spacing_is_attached_to_the_right_items ... ok
   test no_setlist_keeps_item_spacing_at_zero ... ok
   test setlist_star_forces_compact_spacing_on_top_of_the_given_keys ... ok
   test fully_implemented_keys_report_no_diagnostic ... ok
   test leftmargin_star_with_alph_labels_checks_every_letter_not_just_the_items_present ... ok
   test leftmargin_explicit_dimension_sets_the_margin_directly ... ok
   test unimplemented_keys_are_named_once_and_implemented_ones_are_not ... ok
   test setlist_without_an_environment_argument_applies_to_both_list_types ... ok
   test topsep_adds_extra_gap_only_around_the_list ... ok
   test itemsep_adds_extra_gap_only_between_items ... ok
   test leftmargin_star_narrows_the_margin_to_the_widest_label ... ok
   test setlist_star_matches_setlist_with_an_explicit_noitemsep_equivalent ... ok
   test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-review-571 CARGO_BUILD_JOBS=4 cargo test
-> 57 test binaries, all "test result: ok", 0 failures total
   (includes `test generated_artifacts_are_current ... ok` at line 946 of the log,
   confirming the "Full crates/compiler suite ... 100% green, including
   generated_artifacts_are_current" claim in the PR body)

Verdict

APPROVE

Findings

  • crates/compiler/src/parser.rs::set_list (span ~3119-3208): starred is read
    via self.take_star_prefix(), a pre-existing shared helper already used for
    \DeclareMathOperator* etc. (parser.rs:5765), not new/bespoke star-parsing
    logic — this avoids a whole class of "handles *[ but not * [" bugs a
    hand-rolled version could introduce.
  • The forced itemsep_pt = 0.0 is applied after the explicit itemsep_pt
    override (parser.rs ~3202-3205), so \setlist*[..]{itemsep=5pt} correctly ends
    up at 0, matching enumitem's real starred-form semantics (star wins over an
    explicit conflicting key) and matching the new
    setlist_star_forces_compact_spacing_on_top_of_the_given_keys test.
  • options.push(lists::ListOption::NoItemSep) is pushed into the recorded
    setlist options in addition to the direct spacing.itemsep_pt mutation — I
    didn't trace every consumer of self.setlists, but the two new tests exercise
    both the direct-gap path and the full compile-to-output path
    (setlist_star_matches_setlist_with_an_explicit_noitemsep_equivalent, which
    asserts baseline and x-position equality against an equivalent non-starred
    call), so this isn't just unit-tested in isolation.
  • The test setlist_star_matches_setlist_with_an_explicit_noitemsep_equivalent
    is a real regression test, not a tautology: it would fail today without the
    fix, since \setlist* didn't parse at all before this change (syntax_error,
    per the linked issue #563) — I didn't revert the fix to double-check the
    before-state, but the parse path change (adding take_star_prefix() before
    the optional-bracket argument) is the only way \setlist*[...] could reach
    the rest of the function at all.
  • supported-latex.json is edited in three places
    (apps/mac/Sources/FlashTeXMac/Resources/supported-latex.json,
    crates/compiler/supported/supported-latex.json, plus supported.rs and
    docs/user/compiler.md) — all four say the same thing and
    generated_artifacts_are_current (which presumably checks the mac copy is a
    regenerated match of the compiler copy) passed, so these weren't hand-diverged.
  • No vendor/ paths touched.

Small, well-scoped change with tests that actually exercise the new behavior
end-to-end, and the PR body's numeric test claims reproduced exactly.

— reviewed by daniel-parent (independent review lane)

Platform note: gh pr review --approve failed here with "Can not approve your own pull request" — this repo's only gh credential on this machine is d-q222, who also authored this PR. Posting the full review as a plain comment instead; the verdict above is my genuine, independently-run assessment, but GitHub's reviewDecision will NOT reflect it. A reviewer on a different account should convert this to a formal approval if they agree.

@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent): independent Codex review (gpt-5.6-luna max) of c7dbc1c0, APPROVE, no material findings. Merging in batch T.

NO MATERIAL FINDINGS

VERDICT: APPROVE

@d-q222
d-q222 merged commit b978ce0 into main Sep 17, 2026
21 of 22 checks passed
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
`vendor/compiler` was pinned at `f0f86aaf`, 26 `crates/compiler` commits
behind `main`, so merged compiler work was inert in the renderer. Re-pinned
to `main` (`4511166e`) with `git archive`, `PIN` updated, byte-identity
verified both ways: the old tree's 641 path/mode/blob entries match
`f0f86aaf:crates/compiler` apart from `PIN` (no local patch was dropped), and
`diff -r --exclude=PIN` against a fresh re-extraction is empty over 644 files.

`vendor/tex-expansion` moves with it, from `f0f86aaf` to the same SHA, 7
`crates/tex-expansion` commits. That half is **not** needed to compile -- the
new compiler type-checks against the old expansion engine -- but `cee66115`
memoizes `Lexer::rest_of_line_blank`, whose rescan of a long run of spaces is
a fuzz-found hang, and flash-tex#700/flash-tex#727 add `\newtheorem` to the engine outright (the
old copy has no `newtheorem` at all), so a colliding name is rejected with
LaTeX's own error, group-scoped, without disabling the working declaration. A
hang reachable from the renderer is worth more than a minimal diff. Verified
the same two ways over 448 files. No other vendored crate is touched.

Visible now: flash-tex#509 relsize, flash-tex#571 starred `\setlist*`, flash-tex#721 preamble lengths
and `marginpar`, flash-tex#791/flash-tex#798 `\intertext` display math, `\pod`, `\allowbreak`,
and flash-tex#700/flash-tex#727 whole rather than half. Measured through the render path:
`\newtheorem{section}{Section}` in an `article` preamble now reports
`LaTeX Error: Command \section already defined.` and the document's own
`\section` still sets. No `parser::Block`/`parser::Inline` variant moved, so
no exhaustive match in the pipeline changed and both swaps built clean.

One pipeline change, in `adapter::adapt`: flash-tex#749's review commit made the
compiler warn on the `[` of `\twocolumn[<material>]` that its own IR has no
`\@topnewpage` model, while leaving the tokens for a renderer that does. This
pipeline is that renderer, so the warning described output it does not
produce and `tests/twocolumn_banner.rs` dropped to 4/13 on the diagnostic
assertion alone, every measured baseline still within 0.5 bp of pdflatex. The
bracket now goes onto `Doc::superseded` both when the material is boxed (the
warning is false here) and when it is not (the typed `twocolumn_top_material`
limitation says it more precisely, and one diagnostic per `\twocolumn[` beats
two).

`cargo test --release --no-fail-fast` on `crates/render-pipeline`: 631 passed,
0 failed, 2 ignored, after each half of the swap. Both `#[ignore]`s stay --
one is the pipeline's own `scan \input'd preambles` `todo!()`, re-checked with
`--ignored` under this pin, the other is ignored for being slow. No perf-bench
digest moved after either half (`--check --require-same-host` exits 0 with no
`digest_mismatches`), so the baseline is untouched.

`VENDORING.md`: both rows rewritten, and the intro's stale `pdf` SHA
corrected to `a9ec24a9` to match that directory's `PIN`.

Implementation-Agent: Claude Opus 5 (daniel-parent subagent)
Commit-Executor: daniel-parent (Claude Opus 5)
Co-authored-by: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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.

compiler: \setlist* (enumitem starred form) is unsupported

1 participant