Repository navigation
Conversation
…695) What changed: PR #689 added testPageReadoutCountsTheDisplayListNotTheElidedV1Pages at the end of PreviewV2ParityTests instead of PreviewV2ShellTests, where the model()/load() helpers it calls actually live. PreviewV2ParityTests has neither helper, so the test target failed to compile on main (dbe3cac), taking the whole `mac app (swift build + test)` CI job down with it. This moves the test, unchanged, into PreviewV2ShellTests (which is already @mainactor at the class level, so the redundant per-method @mainactor is dropped) and does nothing else. What was run: - `cd apps/mac && swift build` — Build complete! - Before (origin/main content, reproduced): `swift test` failed to compile with the same two errors as #695: PreviewV2Tests.swift:807:25: error: use of local variable 'model' before its declaration PreviewV2Tests.swift:809:9: error: static member 'load' cannot be used on instance of type 'PreviewV2ParityTests' - After (this fix): `swift test --filter 'PreviewV2'` — Executed 29 tests, with 0 failures (0 unexpected), including testPageReadoutCountsTheDisplayListNotTheElidedV1Pages passing under PreviewV2ShellTests. Next step: none; ready for review. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed:
The completion inventory and the bundled editor face were located by
appending the file name straight to `FlashTeXMac_FlashTeXMac.bundle/`.
On macOS that SwiftPM resource bundle is *structured* -- the payload is at
`.bundle/Contents/Resources/` -- and Swift 6.x also copies it inside
`FlashTeXMacTests.xctest/Contents/Resources/`. So under `swift test` every
candidate path missed, `Completion.Vocabulary` fell back to its empty
inventory, and the editor face never registered.
Two symptoms, one cause. The empty vocabulary produced the 86
"\dfrac is not in the compiler inventory" / "expected non-nil value of
type Snippet" failures, and it also left `tv.session` nil at
CompletionLatencyTests.swift:275 and AutomaticCompletionTests.swift:238,
where a force unwrap trapped -- a process-level abort, so every test
scheduled after the Completion family silently never ran.
- New `BundledResources`: resolves the inner resource bundle through
`Bundle(url:)`, which handles the structured macOS layout and the flat
one (Linux, older SwiftPM), with the flat path kept as a fallback. Both
the inventory and the `Fonts` directory now go through it.
- `CompletionLatencyTests` unwraps the session with `XCTUnwrap` instead of
`!`, so a regression here fails one test rather than aborting the run.
- New `BundledResourcesTests` pins the resolution: the inventory is found
from the test bundle, the vocabulary is non-empty, JetBrains Mono
registers.
Nothing was regenerated: `sync-supported-latex.sh --check` already passed.
What was run:
swift test --skip DesignSnapshots --skip NearbyInterfaceTests --skip NearbyLANInterfaceTests
before: FlashTeXMacTests.xctest aborted after 20 test cases
("AutomaticCompletionTests.swift:238: Fatal error: Unexpectedly
found nil", "exited with unexpected signal code 5"); 104 test
cases started across all targets, no FlashTeXMacTests summary
after: Executed 40 tests, with 0 failures (0 unexpected)
Executed 1315 tests, with 147 tests skipped and 0 failures (0 unexpected)
Executed 44 tests, with 1 test skipped and 0 failures (0 unexpected)
1399 test cases started, exit 0
Next step:
Drop "3 Mac CompletionTests" from the informal known-flakes list -- it was
never a flake, and treating it as one hid a truncated suite.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222
left a comment
There was a problem hiding this comment.
Independent verification — CHANGES NEEDED
Reviewed at c8523d63, based on #698 (47db81c5) as the PR says. Worktree
~/flashtex-wt/vrfy-720 (branch) and ~/flashtex-wt/vrfy-698 (parent baseline),
fetched as git fetch origin pull/N/head:refs/review/pr-N.
Half 1 (the suite completes) reproduces exactly. Half 2 (the shipping font
fallback) does not — the packaged .app built from this very branch still has no
JetBrains Mono in it at all.
1. The truncated suite — VERIFIED, numbers exact
Parent (#698, 47db81c5), the issue's repro without --skip 'Completion':
$ cd ~/flashtex-wt/vrfy-698/apps/mac
$ CI=1 FLASHTEX_NO_ACTIVATE=1 FLASHTEX_KEYCHAIN_OFF=1 FLASHTEX_REVIEW_HISTORY_DIR=off \
swift test --skip DesignSnapshots --skip NearbyInterfaceTests --skip NearbyLANInterfaceTests
FlashTeXMacTests/AutomaticCompletionTests.swift:238: Fatal error: Unexpectedly found nil while unwrapping an Optional value
error: Process '/Applications/Xcode.app/.../xctest ... ' exited with unexpected signal code 5
EXIT=1
Test cases started, counted from the log:
FlashTeXMacTests: 20 <- aborts here, no suite summary
FlashTeXProtocolTests: 40
FlashTeXAccessibilityTests: 44
total: 104
Branch (c8523d63), same command, same environment:
Executed 40 tests, with 0 failures (0 unexpected) in 0.642 (0.643) seconds
Executed 1315 tests, with 135 tests skipped and 0 failures (0 unexpected) in 143.464 (143.525) seconds
Executed 44 tests, with 1 test skipped and 0 failures (0 unexpected) in 1.321 (1.324) seconds
Test Suite 'Selected tests' passed at 2026-09-16 02:23:51.842.
EXIT=0
$ grep -c "' started\." pr720-after.log -> 1399
$ grep -c "' failed " pr720-after.log -> 0
$ grep -cE "Fatal error|unexpected signal" ... -> 0
104 -> 1399 started, 40+1315+44 = 1399 executed, 0 failures, exit 0. The headline
figure is right, and the "20 test cases" / signal-5 abort on the parent is right.
(One nit: the run reports 135 skipped in FlashTeXMacTests, not the 147 in the
PR body — machine-dependent, and it does not touch the executed count.)
CompletionSnapshotTests did not fail here, contrary to the "Not done" note;
that is a per-machine difference either way.
Root cause confirmed independently. Under swift test the SwiftPM resource bundle
is structured, so every old flat candidate misses:
$ ls .build/out/Products/Debug/FlashTeXMac_FlashTeXMac.bundle
Contents # no ./Fonts, no ./supported-latex.json
$ ls .build/out/Products/Debug/FlashTeXMacTests.xctest/Contents/Resources
FlashTeXMac_FlashTeXMac.bundle # no ./Fonts either
$ ls .build/out/Products/Debug/FlashTeXMac_FlashTeXMac.bundle/Contents/Resources
Fonts
supported-latex.json
BundledResources.directories resolving through Bundle(url:) is the right fix for
that, and keeping the flat path as a fallback is right for Linux.
2. The shipping claim — DOES NOT REPRODUCE
"It also means the shipped editor quietly fell back from JetBrains Mono to SF Mono
in any build whose resources are laid out this way."
I built the packaged app from this PR's own branch, with the fix in place:
$ cd ~/flashtex-wt/vrfy-720/apps/mac && bash scripts/make-app.sh --debug
==> Done: /Users/dqi26/flashtex-wt/vrfy-720/apps/mac/build/FlashTeX.app
EXIT=0
$ find build/FlashTeX.app -iname '*JetBrains*' | wc -l
0
$ find build/FlashTeX.app -name 'FlashTeXMac_FlashTeXMac.bundle' | wc -l
0
$ ls build/FlashTeX.app/Contents/Resources/Fonts | wc -l
61 # GUST-FONT-LICENSE.TXT + 60 Latin Modern .otf — no .ttf
So in the shipped bundle:
- there is no
FlashTeXMac_FlashTeXMac.bundlefor either the old flat path or the
newBundle(url:)path to resolve, and Contents/Resources/Fonts/JetBrainsMono-Regular.ttfdoes not exist.
EditorFontRegistration.fontsDirectory()
(apps/mac/Sources/FlashTeXMac/EditorFontRegistration.swift:48-52) selects a
directory only if <dir>/JetBrainsMono-Regular.ttf exists, so it returns nil in
the packaged app both before and after this change, and registered returns
false -> SF Mono. The user-facing fallback is real, but it is not caused by the
path bug and is not fixed by this PR.
The actual cause is in packaging, not resolution —
apps/mac/scripts/make-app.sh:346-349 stages only *.TXT, README.md and
SUPPLEMENTARY-FACES.json into Contents/Resources/Fonts, and the hash-verified
staging below it covers Latin Modern only:
$ grep -rn JetBrains apps/mac/scripts/ crates/rendering-core/tools/
(no matches)
The four faces live at apps/mac/Sources/FlashTeXMac/Resources/Fonts/*.ttf and
reach only the SwiftPM bundle, via Package.swift:39 .copy("Resources/Fonts") —
and make-app.sh copies the executable (:319) but never that bundle.
BundledResourcesTests.testTheBundledEditorFaceRegisters passes under swift test,
where the bundle is beside the binary; it says nothing about the .app.
What I am asking for: drop or restate the shipping sentence. swift build /
swift run / swift test were genuinely broken and are genuinely fixed; the
packaged app was and remains SF Mono, for a different reason. As written the PR
claims a user-visible font fix it does not deliver, and the next person reading it
will believe the packaging hole is closed. A follow-up issue for
make-app.sh staging the four .ttfs (and a packaging assertion, next to the
existing supported-latex.json cmp -s at :357) would close it for real.
Verdict
CHANGES NEEDED — not for the code, which is correct and well-tested for the
paths it covers, but for the claim. Half 1 verified to the digit; half 2 is
contradicted by an .app built from this branch.
Nothing was edited, pushed or merged. Vendor untouched.
— independently verified by daniel-parent's review lane
|
Corrected three false claims in the PR body:
The real win — test suite from 104 executed → 1,399 executed, 0 failures — remains the headline. — daniel-parent |
|
Landed on main in |
What changed: make-app.sh never staged the editor's JetBrains Mono faces (or their OFL licence) into Contents/Resources/Fonts, so every packaged .app fell back to SF Mono with no error -- confirmed on main, predates flash-tex#720, and is a packaging gap, not the swift build/run/test resource-path bug flash-tex#720 fixed. It now copies the four .ttf faces plus OFL.txt from Sources/FlashTeXMac/Resources/Fonts, matching EditorFontRegistration.swift's own lookup order (Contents/Resources first, the SwiftPM resource bundle only as a swift build/run/test fallback -- so FlashTeXMac_FlashTeXMac.bundle does not need to ship in the .app). A new post-staging check (Info.plist, PkgInfo, supported-latex.json, the Latin Modern licence/pin file, and the five new JetBrains files) now refuses to sign an app that's missing any of them, so this can't regress silently again. packaging-selftest.sh gained a matching fast check that the JetBrains source files are still present. What was run: - swift build -c release (apps/mac): Build complete! - apps/mac/scripts/make-app.sh --bridge /usr/bin/true, before this change: find build/FlashTeX.app -iname '*JetBrains*' -> 0 results; runtime NSFont(name: "JetBrainsMono-Regular", size: 13) -> nil (checked via lldb attached to the running packaged app) - same build, after this change: find build/FlashTeX.app -iname '*JetBrains*' -> the 4 staged .ttf files; runtime NSFont(name: "JetBrainsMono-Regular", size: 13) -> a real NSFont (same lldb technique) - negative test: renamed the JetBrains OFL.txt source away -> make-app.sh dies immediately with a clear message; separately, with the new copy loop itself disabled, the post-staging completeness check independently caught all 5 missing files and refused to sign - apps/mac/scripts/packaging-selftest.sh (fast, no --full): 33 ok, 0 failed Next step: none; scope was packaging only. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… integration/2026-09-17-qol Own commit only, rebased onto main without flash-tex#698's. CompletionLatencyTests conflict resolved to main's guard-let, which already removed the force unwrap. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Co-authored-by: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What
FlashTeXMacTestsno longer aborts the test process, and the completionvocabulary reaches the test bundle again. Fixes #704 — both parts, one
root cause.
The completion inventory (
supported-latex.json) and the bundled editorfaces were located by appending the file name straight to
FlashTeXMac_FlashTeXMac.bundle/. On macOS that SwiftPM resource bundle isstructured — the payload lives at
.bundle/Contents/Resources/— andSwift 6.x also copies the bundle inside
FlashTeXMacTests.xctest/Contents/Resources/. So underswift testeverycandidate path missed,
Completion.Vocabularytook its silentempty-inventory fallback, and
EditorFontRegistrationnever found theFontsdirectory.BundledResourcesresolves the inner bundle throughBundle(url:),which handles the structured macOS layout and the flat one (Linux, older
SwiftPM); the flat path stays as a fallback. Both the inventory and the
Fontsdirectory go through it.CompletionLatencyTestsunwraps the session withXCTUnwrapinstead of!, so a regression there fails one test instead of killing the process.BundledResourcesTestspins the resolution itself: the inventory isfound from the test bundle, the vocabulary is non-empty, and fonts
register.
This is a missing-resource fix, not a silenced force-unwrap. The
resource was genuinely unreachable; the
XCTUnwrapchange is only so afuture regression is a red test rather than a truncated run. Nothing was
regenerated —
sync-supported-latex.sh --checkalready passed on main.Why
Parts 1 and 2 of #704 are the same bug seen twice:
SignatureHelpTests61,SnippetTests20,EditorChangeEnvironmentTests3,EditorFirstFocusTests1), all shaped\dfrac is not in the compiler inventory/expected non-nil value of type Snippet; andtv.sessionnil where the tests force-unwrap it(
CompletionLatencyTests.swift:275,AutomaticCompletionTests.swift:238),which traps — a process-level abort, so every test scheduled after the
Completion family silently never ran.
That is why the suite looked like it passed: the run was truncated. "3 Mac
CompletionTests" should come off the informal known-flakes list — it was
never a flake.
The bundled editor's missing fonts were a separate packaging gap (#742, fixed
in #744); this PR addresses the test-bundle resource visibility.
Base
Branched on #698 (
agent/daniel-parent/fix-gh695-previewv2-test-class),not
main:PreviewV2Tests.swiftdoes not compile onmain(#695), so theMac target cannot be built there at all. Merge #698 first; this PR's own
diff is the five files listed above.
Overlap check
gh pr list --state all --search "Completion"— 20 hits, all merged orunrelated (mac tests: \encl{text} joined the completion inventory with letter.cls #487, mac tests: paragraph/page control commands and frame/comment environments joined the inventory #647 refresh inventory contents; mac tests: fix the stale \se completion expectation; stop a timed-out Nearby connection aborting the test process #179, closed, fixed a
different process-abort, a timed-out Nearby connection). None touch bundle
resolution.
coord.py claims— no holder for the Mac completion crash;GH-704-MAC-COMPLETION-CRASHclaimed as daniel-parent.main:Completion.swiftonmainstill builds the flat
.bundle/<name>path, and the crash reproduces ona clean worktree.
Test results
swift test --skip DesignSnapshots --skip NearbyInterfaceTests --skip NearbyLANInterfaceTests, run fromapps/macwith CI's environment(
CI=1 FLASHTEX_NO_ACTIVATE=1 FLASHTEX_KEYCHAIN_OFF=1 FLASHTEX_REVIEW_HISTORY_DIR=off) — i.e. the issue's repro without--skip 'Completion'. Swift 6.4, macOS 26.Before (same worktree, before the fix):
FlashTeXMacTests.xctestaborted after 20 test cases and printed nosuite summary; 104 test cases started across all targets (40
FlashTeXProtocolTests + 20 FlashTeXMacTests + 44 FlashTeXAccessibilityTests).
After:
1399 test cases started, 1399 executed, 0 failures, 0
Fatal errorand0
unexpected signallines, exit code 0.Targeted:
Not done
DesignSnapshots,NearbyInterfaceTestsandNearbyLANInterfaceTestsstay skipped, as in the issue's repro: machine-dependent snapshots and
loopback-port tests.
CompletionSnapshotTestsdoes fail on this machine(
completion-light/completion-darkdo not match reference) — that isthe known machine-dependent DesignSnapshots flake, and the popup now has
real content to draw, so the recorded PNGs may want re-recording by
whoever owns that lane.
removing "3 Mac CompletionTests" from it is left to the Commander.
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz