Removes DiagramCache.cachedSVG and stale cutover comments, and gets Prism building and testing under Xcode 27, including a fix for blank SVG zoom snapshots on macOS 27.
DiagramCache.cachedSVG removed; nine stale comments naming T-1542-deleted types rewritten against their real callers.AppStoreSyncing is nonisolated.var, @Entry closures).SIMULATOR variable (iPhone 18 Pro); result checker accepts Xcode 27 node types.make test (iOS, every locale configuration) stalled twice for suite-load reasons and make test-ui was not run. Both were left at the user's direction; suite cost is tracked in T-2389. Verified: make build-macos and make build-ios with zero warnings, make lint, make verify-make-guards, and make test-quick (macOS, 4,941 tests; the only failures were load flakes that passed when re-run alone).Ready to push, with a test caveat
No critical or major findings remain; review fixes are committed. Test caveat: make test (iOS, every locale configuration) stalled twice for suite-load reasons and make test-ui was not run. Both were left at the user's direction; suite cost is tracked in T-2389. Verified: make build-macos and make build-ios with zero warnings, make lint, make verify-make-guards, and make test-quick (macOS, 4,941 tests; the only failures were load flakes that passed when re-run alone).
039865b2 T-1687: Record final verification state in implementation explanation dc97b73c T-1687: Add implementation explanation and correct Q5/Q8 in decision log a7742395 T-1687: Apply pre-push review fixes 1ae43fe6 T-1687: Mark remaining smolspec tasks complete 502636dc T-1687: Fix SVG snapshots and details-navigation tests under WebKit 27 8acd973f T-1687: Build and test under Xcode 27 9fe5c566 T-1687: Remove dead DiagramCache.cachedSVG and stale cutover comments What changed. When Prism moved to rendering documents in a web view (T-1542), old screens were deleted but some code and comments still referred to them. This branch deletes one method only those screens used and rewrites the comments to point at today's code.
It also catches the project up with Xcode 27: some small helpers are marked safe to call from any thread, the build uses the iPhone 18 Pro simulator, and two WebKit 27 changes are handled — a scrollbar gutter that squashed SVG previews, and scroll anchoring that confused two scroll tests.
DiagramCache.cachedSVG deleted; cacheKey stays for render.isSVG: PrismDocSchemeHandler, WebImageDetailSheet, ImageDetailWindow).AppStoreSyncing becomes nonisolated protocol (Xcode 27 applies the target's MainActor default to protocols; the actor test double could not conform).nonisolated; URLRequest built as a let; @Entry closures replaced with explicit FocusedValueKeys.svg-template.html: vertical-align: top plus overflow: hidden.WebDetailsNavigationOrderingTests cases turn off scroll anchoring (Decision 1).Trade-off: folding Xcode 27 work into a cleanup ticket widens the PR, but the cleanup could not be verified otherwise (Q7).
max-width:100% shrinks the SVG → pass 2 measures the shrunk size. Either CSS rule breaks the loop; both are kept. overflow:hidden could clip only if the view were sized below the SVG, which the renderer does not do.DocumentStructure only the method that warned. No shared mutable state is exposed.SIMULATOR elsewhere.prism/Resources/svg-template.html
Why it matters. User-visible: SVG zoom snapshots on macOS 27 came out shrunk or blank.
What to look at. prism/Resources/svg-template.html:9-16
prism/Services/AppStoreSync.swift
Why it matters. Correctness: the test target did not compile under Xcode 27.
What to look at. prism/Services/AppStoreSync.swift:13-22
prism/Services/DiagramCache.swift
Why it matters. The ticket's core change; removes a method only the deleted BackgroundDiagramRenderer used.
What to look at. prism/Services/DiagramCache.swift
Tools/check-test-results.sh
Why it matters. Without it the fail-closed guard rejects every Xcode 27 result bundle.
What to look at. Tools/check-test-results.sh NODE_TYPES
prismTests/WebRendering/WebDetailsNavigationOrderingTests.swift
Why it matters. WebKit 27 anchoring moved scrollY by 124 px, failing tests that detect re-asserts via scrollY.
What to look at. WebDetailsNavigationOrderingTests.swift:198-213, 331, 393
prism/App/DiagramFocusedValues.swift
Why it matters. Removes a new Xcode 27 warning without changing behaviour.
What to look at. prism/App/DiagramFocusedValues.swift
User direction; the test target did not compile, so the cleanup could not be verified otherwise.
Product keeps anchoring (T-1965); a 124 px tolerance would hide real re-asserts.
Keeps behaviour identical; a wrapper would change when the menu sees new closures.
iOS 27 has no iPhone 17 Pro; DEVICE_MODEL stays for physical installs.
It is test input, not a comment.
| Severity | Area | Finding | Resolution |
|---|---|---|---|
| major | decision_log.md | Xcode 27 scope expansion not recorded. | Added Q7-Q11 and Decision 1. |
| minor | svg-template.html | overflow:hidden hid the symptom; comment claimed exact sizing. | Added vertical-align: top on the container; reworded comment. |
| minor | DiagramFocusedValues.swift | Comment called menu re-evaluation harmless and implied explicit keys fixed it. | Reworded: warning silenced, cost accepted and predates Xcode 27. |
| minor | docs/agent-notes | Xcode 27 isolation, scroll anchoring, node types and SVG gutter not recorded. | Added to development-tooling.md and webview-pool.md. |
| nit | DiagramFocusedValues.swift | Keys nested in the extension, unlike repo convention. | Moved to file scope. |
| nit | Makefile / CLAUDE.md | SIMULATOR missing from make help; CLAUDE.md example hard-codes the device. | Help line added; example points at SIMULATOR. |
| minor | WebDetailsNavigationOrderingTests | Suggested an anchoring-on variant. | Skipped: eight other tests in the class run with anchoring on and assert landing. |
| minor | SVGRendererTests | Suggested asserting snapshot size. | Skipped: existing pixel tests fail without the fix on the current toolchain; review rules avoid test changes. |
| nit | MarkdownSection.swift | Make all of DocumentStructure nonisolated. | Skipped: speculative; only the warning member changed. |
| minor | MermaidTypeParser / DiagramWindowManager | iconName(for:) and the diagramOwnerURL environment value are now dead code. | Out of scope; noted on T-1687 for follow-up. |
Source: local run at 2026-10-03T21:00:00+10:00 · snapshot 039865b2
Baseline: none
Execution: not run · JUnit: none · Coverage: none · Baseline: absent
Coverage scope: as the project configures it
The test runner could not be detected.
Derived by declaration name, from the diff (no baseline run).
No new or removed test declarations.
No declaration pattern applies to Tools/Tests/test-check-test-results.sh; those files yield nothing.
Files that import a changed file on the left, changed files in the centre, files a changed file imports on the right. Snapshot working-tree against base d0ccb610bfe13e1a207a868f629acfc1fe850091.
prism/Resources/mermaid.min.js — blob over 1 MB29 files: 21 code · 8 docs. Click to expand.
diff --git a/Makefile b/Makefileindex b88fd0e2..9be5e56f 100644--- a/Makefile+++ b/Makefile@@ -58,6 +58,11 @@ CONFIG ?= Debug # does NOT affect the `id=$(DEVICE_ID)` install target, which must reach the device. DEST_TIMEOUT = -destination-timeout 20 +# Simulator for the iOS build and test targets. Without an OS, xcodebuild picks+# the newest runtime, so this must be a device that runtime ships (Xcode 27:+# iOS 27, whose default Pro model is the iPhone 18 Pro).+SIMULATOR ?= iPhone 18 Pro+ # Pipe through xcbeautify if available, otherwise raw output XCBEAUTIFY := $(shell command -v xcbeautify 2>/dev/null) ifdef XCBEAUTIFY@@ -106,6 +111,7 @@ help: @echo " Utilities:" @echo " clean - Clean build artifacts" @echo ""+ @echo "iOS simulator targets use SIMULATOR (default: iPhone 18 Pro)" @echo "Device targets use DEVICE_MODEL (default: iPhone 17 Pro)" @echo "Override with: make install DEVICE_MODEL='iPhone 16'" @echo ""@@ -158,7 +164,7 @@ build-ios: -project $(PROJECT) \ -scheme $(SCHEME) \ $(DEST_TIMEOUT) \- -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \+ -destination 'platform=iOS Simulator,name=$(SIMULATOR)' \ -configuration $(CONFIG) \ -derivedDataPath $(DERIVED_DATA) \ $(SIGNING_FLAGS) \@@ -220,7 +226,7 @@ test: verify-test-isolation -project $(PROJECT) \ -scheme $(SCHEME) \ $(DEST_TIMEOUT) \- -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \+ -destination 'platform=iOS Simulator,name=$(SIMULATOR)' \ -configuration Debug \ -derivedDataPath $(DERIVED_DATA) \ -resultBundlePath $(RESULT_BUNDLE_IOS) \@@ -237,7 +243,7 @@ test-ui: -project $(PROJECT) \ -scheme $(SCHEME) \ $(DEST_TIMEOUT) \- -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \+ -destination 'platform=iOS Simulator,name=$(SIMULATOR)' \ -configuration Debug \ -derivedDataPath $(DERIVED_DATA) \ -resultBundlePath $(RESULT_BUNDLE_UI) \
diff --git a/Tools/Tests/Fixtures/check-test-results/xcode27-message-nodes/summary.json b/Tools/Tests/Fixtures/check-test-results/xcode27-message-nodes/summary.jsonnew file mode 100644index 00000000..202182d4--- /dev/null+++ b/Tools/Tests/Fixtures/check-test-results/xcode27-message-nodes/summary.json@@ -0,0 +1,16 @@+{+ "title": "Test - prism",+ "startTime": 1000000000,+ "finishTime": 1000000010,+ "environmentDescription": "prism · Debug · macOS",+ "topInsights": [],+ "result": "Passed",+ "totalTestCount": 6,+ "passedTests": 4,+ "failedTests": 0,+ "skippedTests": 1,+ "expectedFailures": 1,+ "statistics": [],+ "devicesAndConfigurations": [],+ "testFailures": []+}
diff --git a/Tools/Tests/Fixtures/check-test-results/xcode27-message-nodes/tests.json b/Tools/Tests/Fixtures/check-test-results/xcode27-message-nodes/tests.jsonnew file mode 100644index 00000000..ea1851f1--- /dev/null+++ b/Tools/Tests/Fixtures/check-test-results/xcode27-message-nodes/tests.json@@ -0,0 +1,57 @@+{+ "testPlanConfigurations": [],+ "devices": [],+ "testNodes": [+ {+ "nodeType": "Test Plan",+ "name": "prism",+ "result": "Passed",+ "children": [+ {+ "nodeType": "Unit test bundle",+ "name": "prismTests",+ "result": "Passed",+ "children": [+ {+ "nodeType": "Test Suite",+ "name": "SampleTests",+ "result": "Passed",+ "children": [+ {+ "nodeType": "Test Case",+ "name": "testOne()",+ "result": "Passed",+ "duration": "0.01s",+ "children": []+ },+ {+ "nodeType": "Test Case",+ "name": "testSkipped()",+ "result": "Skipped",+ "children": [+ {+ "nodeType": "Skip Message",+ "name": "Test skipped: Requires full app context with window"+ }+ ]+ },+ {+ "nodeType": "Test Case",+ "name": "testExpectedFailure()",+ "result": "Expected Failure",+ "duration": "0.01s",+ "children": [+ {+ "nodeType": "Expected Failure",+ "name": "Known budget overrun (tracked)."+ }+ ]+ }+ ]+ }+ ]+ }+ ]+ }+ ]+}
diff --git a/Tools/Tests/test-check-test-results.sh b/Tools/Tests/test-check-test-results.shindex 4bdc6185..4acf71e6 100755--- a/Tools/Tests/test-check-test-results.sh+++ b/Tools/Tests/test-check-test-results.sh@@ -218,6 +218,8 @@ expect_pass "skipped-with-executed" \ "a run whose top-level result is Skipped but which executed tests reports OK" expect_pass "expected-failure-result" \ "a run whose top-level result is Expected Failure reports OK"+expect_pass "xcode27-message-nodes" \+ "Xcode 27 Skip Message / Expected Failure leaf nodes are recognised, not drift" expect_fail "all-skipped-selection" \ "a selection that resolved entirely to skipped tests fails as ZERO executed" \
diff --git a/Tools/check-test-results.sh b/Tools/check-test-results.shindex c2458bc7..57aa3247 100755--- a/Tools/check-test-results.sh+++ b/Tools/check-test-results.sh@@ -393,6 +393,9 @@ NODE_TYPES = { "Device", "Test Plan Configuration", "Arguments", "Repetition", "Test Case Run", "Failure Message", "Source Code Reference", "Attachment", "Expression", "Test Value", "Runtime Warning",+ # Added to the schema in Xcode 27: result-less leaf messages under a Skipped+ # or Expected Failure Test Case, the same shape as Failure Message.+ "Skip Message", "Expected Failure", } ATTEMPT_TYPES = {"Repetition", "Test Case Run"}
diff --git a/prism/App/DiagramFocusedValues.swift b/prism/App/DiagramFocusedValues.swiftindex d6c9c692..615e1e4e 100644--- a/prism/App/DiagramFocusedValues.swift+++ b/prism/App/DiagramFocusedValues.swift@@ -8,6 +8,17 @@ import SwiftUI // MARK: - Diagram Zoom FocusedValues (macOS) #if os(macOS)+// Explicit keys rather than `@Entry`: from Xcode 27 the macro warns that a+// stored closure is not comparable and may invalidate dependents on every+// update. Explicit keys only silence that; the invalidation itself remains.+// `MermaidDiagramWindow` publishes fresh closures on each body evaluation+// (every zoom, pan or resize frame), so the View menu (`DiagramZoomCommands`)+// re-evaluates with them. That cost predates Xcode 27 and is accepted here.+private struct DiagramZoomInKey: FocusedValueKey { typealias Value = () -> Void }+private struct DiagramZoomOutKey: FocusedValueKey { typealias Value = () -> Void }+private struct DiagramResetZoomKey: FocusedValueKey { typealias Value = () -> Void }+private struct DiagramFitToWindowKey: FocusedValueKey { typealias Value = () -> Void }+ /// FocusedValue keys for diagram window zoom actions. /// /// These allow the View menu commands to trigger zoom actions on the focused@@ -16,15 +27,27 @@ import SwiftUI /// Requirements: 6.1, 6.2, 6.3, 6.4 extension FocusedValues { /// Action to zoom in on the focused diagram.- @Entry var diagramZoomIn: (() -> Void)?+ var diagramZoomIn: (() -> Void)? {+ get { self[DiagramZoomInKey.self] }+ set { self[DiagramZoomInKey.self] = newValue }+ } /// Action to zoom out on the focused diagram.- @Entry var diagramZoomOut: (() -> Void)?+ var diagramZoomOut: (() -> Void)? {+ get { self[DiagramZoomOutKey.self] }+ set { self[DiagramZoomOutKey.self] = newValue }+ } /// Action to reset zoom to 100% on the focused diagram.- @Entry var diagramResetZoom: (() -> Void)?+ var diagramResetZoom: (() -> Void)? {+ get { self[DiagramResetZoomKey.self] }+ set { self[DiagramResetZoomKey.self] = newValue }+ } /// Action to fit the diagram to the window.- @Entry var diagramFitToWindow: (() -> Void)?+ var diagramFitToWindow: (() -> Void)? {+ get { self[DiagramFitToWindowKey.self] }+ set { self[DiagramFitToWindowKey.self] = newValue }+ } } #endif
diff --git a/prism/Models/MarkdownSection.swift b/prism/Models/MarkdownSection.swiftindex 4a3d96aa..42df2209 100644--- a/prism/Models/MarkdownSection.swift+++ b/prism/Models/MarkdownSection.swift@@ -211,7 +211,10 @@ extension DocumentStructure { /// occurrences apart needs an identity this index does not carry; that is /// the occurrence-identity cluster (T-2045, T-2084–T-2088), not this /// lookup.- func sourceIndex(forBlockId blockId: String, headingPath: [String]?) -> Int? {+ ///+ /// `nonisolated`: pure over a `let`, and called from `BlockDOMID`, which is+ /// nonisolated.+ nonisolated func sourceIndex(forBlockId blockId: String, headingPath: [String]?) -> Int? { guard let headingPath else { return nil } let prefix = "\(blockId)-" var earliest: Int?
diff --git a/prism/Models/UTType+Markdown.swift b/prism/Models/UTType+Markdown.swiftindex 5ef27e67..d4a33866 100644--- a/prism/Models/UTType+Markdown.swift+++ b/prism/Models/UTType+Markdown.swift@@ -22,7 +22,9 @@ extension UTType { /// resolution. Entry-point classification (file importer, macOS drop) must /// agree with the `CFBundleDocumentTypes` declaration in Info.plist, so it /// uses this narrower set.-enum MarkdownFileExtensions {+///+/// `nonisolated`: pure, and called from `URLDocumentLoader`'s off-main load.+nonisolated enum MarkdownFileExtensions { /// Extensions accepted as markdown for app entry points. Compared /// case-insensitively against `URL.pathExtension`. static let accepted: Set<String> = ["md", "markdown"]
diff --git a/prism/Resources/svg-template.html b/prism/Resources/svg-template.htmlindex 8bd19069..e3128bf6 100644--- a/prism/Resources/svg-template.html+++ b/prism/Resources/svg-template.html@@ -6,8 +6,14 @@ content="default-src 'none'; script-src 'none'; img-src data:; style-src 'unsafe-inline';"> <style> * { margin: 0; padding: 0; box-sizing: border-box; }+ /* The renderer sizes the view to the measured SVG, so any page overflow+ makes WebKit 27 reserve a scrollbar gutter, which shrinks the SVG and+ snapshots it near-blank. `vertical-align: top` removes the overflow's+ source (the inline-block container's descender gap); `overflow: hidden`+ keeps a gutter from ever being reserved. */+ html, body { overflow: hidden; } body { background: transparent; }- #svg-container { display: inline-block; }+ #svg-container { display: inline-block; vertical-align: top; } svg { display: block; max-width: 100%; height: auto; } </style> </head>
diff --git a/prism/Services/AppStoreSync.swift b/prism/Services/AppStoreSync.swiftindex e952d0e5..a06088e1 100644--- a/prism/Services/AppStoreSync.swift+++ b/prism/Services/AppStoreSync.swift@@ -10,7 +10,11 @@ import StoreKit /// all, so its one-line wiring — forwarding `verifyEntitlements()`'s return /// value rather than re-reading `entitlementState` — was unpinned and could be /// reverted with the whole suite still green (T-2237).-protocol AppStoreSyncing: Sendable {+///+/// `nonisolated` because the target defaults to MainActor isolation, which+/// Xcode 27 applies to the protocol itself; the test double is an `actor`, and+/// an actor cannot conform to a global-actor-isolated protocol.+nonisolated protocol AppStoreSyncing: Sendable { /// Re-syncs the App Store account, throwing so the caller can surface a /// user-visible error (req 6.4 / 7.2). func sync() async throws
diff --git a/prism/Services/DiagramCache.swift b/prism/Services/DiagramCache.swiftindex 7464271f..64fcaf5f 100644--- a/prism/Services/DiagramCache.swift+++ b/prism/Services/DiagramCache.swift@@ -105,20 +105,6 @@ actor DiagramCache { cache.removeAll() } - /// Returns a cached SVG string if one exists, without triggering a render.- ///- /// Used by BackgroundDiagramRenderer for the two-layer caching strategy- /// (Decision 11): if an SVG is already cached, load it directly into a- /// WebView for snapshotting instead of running the full mermaid.js pipeline.- ///- /// - Parameters:- /// - source: The mermaid diagram source code.- /// - theme: The Prism theme to look up.- /// - Returns: The cached SVG string, or nil if not cached.- func cachedSVG(source: String, theme: PrismTheme) -> String? {- cache[cacheKey(source: source, theme: theme)]- }- /// Returns the number of cached entries (for testing). var count: Int { cache.count
diff --git a/prism/Services/DiagramWindowManager.swift b/prism/Services/DiagramWindowManager.swiftindex 38c374ee..e3aef6e5 100644--- a/prism/Services/DiagramWindowManager.swift+++ b/prism/Services/DiagramWindowManager.swift@@ -311,8 +311,7 @@ private struct DiagramOwnerURLKey: EnvironmentKey { extension EnvironmentValues { /// The owner URL used for diagram window lifecycle tracking. ///- /// Set by DocumentReaderView to provide ownership context to MermaidPlaceholderCard.- /// For file-based documents this is the file URL; for clipboard sessions+ /// Set by DocumentReaderView. For file-based documents this is the file URL; for clipboard sessions /// this is a synthetic URL based on the session ID. var diagramOwnerURL: URL? { get { self[DiagramOwnerURLKey.self] }
diff --git a/prism/Services/GitHubURLTransformer.swift b/prism/Services/GitHubURLTransformer.swiftindex 9c3f6762..ffcda19a 100644--- a/prism/Services/GitHubURLTransformer.swift+++ b/prism/Services/GitHubURLTransformer.swift@@ -17,7 +17,9 @@ import Foundation /// Requirements covered: /// - 2.2: Transform GitHub blob URLs to raw URLs /// - 2.3: Pass through raw.githubusercontent.com URLs as-is-enum GitHubURLTransformer {+///+/// `nonisolated`: pure, and called from `URLDocumentLoader`'s off-main load.+nonisolated enum GitHubURLTransformer { /// Result of URL transformation. struct TransformResult {
diff --git a/prism/Services/ImagePathResolver.swift b/prism/Services/ImagePathResolver.swiftindex 3ddfe499..50fa16e0 100644--- a/prism/Services/ImagePathResolver.swift+++ b/prism/Services/ImagePathResolver.swift@@ -420,8 +420,9 @@ enum ImagePathResolver { /// Returns true if the source or resolved URL points to an SVG file. ///- /// Used by downstream consumers (e.g., `ImageBlockView`) to route SVG- /// sources to the SVG rendering pipeline instead of the raster image loader.+ /// Used by `PrismDocSchemeHandler` and the zoom views (`WebImageDetailSheet`,+ /// `ImageDetailWindow`) to route SVG sources to the SVG pipeline instead of+ /// the raster image loader. static func isSVG(source: String, resolved: ResolvedImageSource) -> Bool { if source.lowercased().hasSuffix(".svg") { return true } switch resolved {
diff --git a/prism/Services/MarkdownBlockParser.swift b/prism/Services/MarkdownBlockParser.swiftindex a69d4946..31b1e0f1 100644--- a/prism/Services/MarkdownBlockParser.swift+++ b/prism/Services/MarkdownBlockParser.swift@@ -857,8 +857,8 @@ enum MarkdownBlockParser: Sendable { // empty result would have returned nil above. return .paragraph(markdown) default:- // Image-only paragraphs become a block child so they render via- // `ImageBlockView` (zoom, error placeholders, path resolution).+ // Image-only paragraphs become a block child so `BlockHTMLEmitter`+ // renders them as image figures (zoom button, error state). return .block(converted) } }
diff --git a/prism/Services/MermaidTypeParser.swift b/prism/Services/MermaidTypeParser.swiftindex 39703388..923ba7a1 100644--- a/prism/Services/MermaidTypeParser.swift+++ b/prism/Services/MermaidTypeParser.swift@@ -126,9 +126,6 @@ nonisolated enum MermaidTypeParser { /// Returns the SF Symbol name for a given diagram type string. ///- /// Used by both `MermaidPlaceholderCard` and `MermaidPreviewCard` to display- /// a type-appropriate icon alongside the diagram.- /// /// - Parameter diagramType: The human-readable diagram type (e.g., "Flowchart"). /// - Returns: The SF Symbol name for the diagram type. static func iconName(for diagramType: String) -> String {
diff --git a/prism/Services/RenderingUtilities.swift b/prism/Services/RenderingUtilities.swiftindex d7aeef22..8ddd0efd 100644--- a/prism/Services/RenderingUtilities.swift+++ b/prism/Services/RenderingUtilities.swift@@ -65,10 +65,10 @@ enum WindowAttachmentValidator { } } -/// Shared rendering helpers used by `SVGRenderer`, `BackgroundDiagramRenderer`,-/// and `MermaidRenderer`. The helpers cover three patterns that were previously-/// duplicated across the three renderers: racing an async operation against a-/// timeout, JSON-encoded innerHTML injection, and JS-driven dimension extraction.+/// Shared rendering helpers used by `SVGRenderer` and `MermaidRenderer`. The+/// helpers cover three patterns that were previously duplicated across the+/// renderers: racing an async operation against a timeout, JSON-encoded+/// innerHTML injection, and JS-driven dimension extraction. /// /// Implementation notes: /// - The namespace deliberately does not depend on `WebViewPool` so
diff --git a/prism/Services/URLDocumentLoader.swift b/prism/Services/URLDocumentLoader.swiftindex ebac2a23..44749f01 100644--- a/prism/Services/URLDocumentLoader.swift+++ b/prism/Services/URLDocumentLoader.swift@@ -178,8 +178,7 @@ nonisolated enum URLDocumentLoader { let session = URLSession(configuration: config, delegate: chunkLoader, delegateQueue: nil) defer { session.invalidateAndCancel() } - var request = URLRequest(url: transformed.fetchURL)- request.timeoutInterval = 30+ let request = URLRequest(url: transformed.fetchURL, timeoutInterval: 30) // Download via `ChunkedBodyLoader` (Decision 8: streaming, not a // bulk `session.data(for:)`, so an oversized body without a
diff --git a/prismTests/ImageIntegrationTests.swift b/prismTests/ImageIntegrationTests.swiftindex f428561c..baa75706 100644--- a/prismTests/ImageIntegrationTests.swift+++ b/prismTests/ImageIntegrationTests.swift@@ -253,7 +253,7 @@ struct ImageIntegrationTests { return } - // Simulate the search highlight check that ImageBlockView performs+ // The parsed alt text matches a search query case-insensitively let query = "sunset" let isHighlighted = alt.localizedCaseInsensitiveContains(query) #expect(isHighlighted)
diff --git a/prismTests/ListItemParagraphOrderingTests.swift b/prismTests/ListItemParagraphOrderingTests.swiftindex ea92755f..2f7f15ef 100644--- a/prismTests/ListItemParagraphOrderingTests.swift+++ b/prismTests/ListItemParagraphOrderingTests.swift@@ -298,9 +298,9 @@ struct ListItemParagraphOrderingTests { func testTrailingImageOnlyParagraphBecomesBlockImage() { // Local-review follow-up: top-level `convertParagraph` detects // image-only paragraphs and emits `.image` blocks; trailing- // paragraphs in list items must get the same treatment so they- // render via `ImageBlockView` (zoom, error placeholders, path- // resolution) rather than as inline markdown.+ // paragraphs in list items must get the same treatment so+ // `BlockHTMLEmitter` renders them as image figures (zoom button,+ // error state) rather than as inline markdown. let content = """ - Intro: ```swift
diff --git a/prismTests/WebRendering/WebDetailsNavigationOrderingTests.swift b/prismTests/WebRendering/WebDetailsNavigationOrderingTests.swiftindex 10462173..bb18917f 100644--- a/prismTests/WebRendering/WebDetailsNavigationOrderingTests.swift+++ b/prismTests/WebRendering/WebDetailsNavigationOrderingTests.swift@@ -195,6 +195,23 @@ struct WebDetailsNavigationOrderingTests { return try #require(result as? Double) } + /// Turns off the engine's CSS scroll anchoring for this page.+ ///+ /// The `scrollY` comparisons below rely on "opening a `<details>` ABOVE the+ /// viewport reflows the document without scrolling it". WebKit on macOS/iOS 27+ /// ships scroll anchoring (`overflow-anchor: auto`), which shifts `scrollY` by+ /// exactly the height that opened above the viewport (measured: document grows+ /// 124 px, `scrollY` moves 124 px, no navigation armed). That shift is the+ /// engine keeping the reader's content still, not a re-assert, so these tests+ /// switch it off to keep `scrollY` a clean signal for the re-assert alone.+ /// Product deliberately leaves anchoring on (see `prism-scroll.js`, T-1965).+ private func disableScrollAnchoring(_ harness: WebDocumentLiveHarness) async throws {+ _ = try await harness.page.callJavaScript(+ "document.documentElement.style.overflowAnchor = 'none'; return null;",+ contentWorld: harness.bridgeWorld+ )+ }+ /// Polls until the target's top settles at the viewport top, or gives up and /// returns the last reading for the failure message. private func settledTop(@@ -311,6 +328,7 @@ struct WebDetailsNavigationOrderingTests { let mapped = BlockDOMID.map(blocks: blocks) let unrelatedDomID = mapped[1].domID let domID = try detailsDOMID(blocks)+ try await disableScrollAnchoring(harness) #expect(try await isOpen(harness, unrelatedDomID) == false) #expect(try await isOpen(harness, domID) == false)@@ -372,6 +390,7 @@ struct WebDetailsNavigationOrderingTests { let mapped = BlockDOMID.map(blocks: blocks) let secondDomID = mapped[1].domID let firstDomID = try detailsDOMID(blocks)+ try await disableScrollAnchoring(harness) // Navigation 1: a TOC selection targets the closed trailing details — // clamped.
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 168a65ca..3845a39c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Agent notes no longer describe the SwiftUI/Textual renderer deleted in the T-1542 WebKit cutover as current code (T-2001). `textkit2-attachment-issues.md` and `mermaid-preview.md` are deleted; `layout-views.md` and `table-display-modes.md` are rewritten for the web path; `footnotes.md` keeps only its current architecture section; fourteen other notes had stale passages rewritten against current code or removed. Spec and sweep residuals in `specs/purge-stale-agent-notes/`.+- Builds and tests under Xcode 27. The test target compiles again: `AppStoreSyncing` is now `nonisolated`, because Xcode 27 applies the target's default MainActor isolation to the protocol and the `actor` test double could no longer conform. Both builds are back to zero warnings: three pure helpers called off the main actor are `nonisolated` (`GitHubURLTransformer`, `MarkdownFileExtensions`, `DocumentStructure.sourceIndex(forBlockId:headingPath:)`), `URLDocumentLoader` builds its request as a `let`, and the diagram zoom focused values use explicit keys instead of `@Entry`, which now warns about stored closures. The iOS simulator is a `SIMULATOR` Makefile variable defaulting to the iPhone 18 Pro, since the newest runtime no longer ships the iPhone 17 Pro. `Tools/check-test-results.sh` accepts the `Skip Message` and `Expected Failure` node types added to the result-bundle schema, with a regression fixture.+- Post-cutover cleanup (T-1687): removed `DiagramCache.cachedSVG(source:theme:)`, which had no callers since `BackgroundDiagramRenderer` was deleted in the T-1542 WebKit cutover, and corrected source and test comments that still named `BackgroundDiagramRenderer`, `MermaidPreviewCard`, `MermaidPlaceholderCard` or `ImageBlockView` as live (`RenderingUtilities`, `MermaidTypeParser`, `ImagePathResolver`, `MarkdownBlockParser`, `DiagramWindowManager`, two test files). No behaviour change. Smolspec in `specs/remove-dead-cachedsvg/`. - CLAUDE.md cut back to a working guide (478 lines / 67 KB → 143 lines / 13.5 KB): each subsystem states the rules a change must not break and links to its agent-note; incident narratives moved verbatim into `docs/agent-notes/` (new `external-file-moves.md`, plus sections in `webview-rendering-status.md`, `footnotes.md`, `image-support.md`, `inapp-purchase.md`, `development-tooling.md`); stale descriptions of deleted SwiftUI views and the hand-maintained Source Structure tree removed (T-2376) - The per-locale test sweep no longer runs in CI; it is now a local step before merging. `localisation-tests.yml` is the only workflow that builds or runs this project's tests, and it ran the whole suite four times over on a hosted `macos-latest` runner — billed time, and time the suite could not use. In the one sweep that ran to completion, 6,661 test executions took over 30 seconds each and the slowest took 72, against sub-second times on a developer machine, so every live-WebKit and UI test holding a deadline failed: 283 of 4,725 unit tests in `en (base)`, 96% of them live-WebKit suites, and 167 of 281 UI tests, which never saw the app's interface appear at all. None of those were real defects, which is the worse half of the problem — a sweep whose red means nothing trains you to merge past it. The workflow is now `workflow_dispatch` only, so it can still be run deliberately from the Actions tab, and `make test-locales` is the documented step before a merge. What remains automatic is File Checks, SwiftLint and Stylelint, all on Linux; a green pull request now says nothing about the tests, and CLAUDE.md says so where a reader will meet it. `make verify-workflow-triggers` was taught the two shapes this file is allowed to be in — automatic, with both `paths:` filters listing every input, or disabled, with `workflow_dispatch:` alone and the local requirement recorded in CLAUDE.md — and refuses anything in between, so the sweep cannot drift back to half-triggered or lose the note that it moved to a local step. @@ -27,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- SVG zoom snapshots on macOS 27 no longer come out shrunk or blank. The snapshot view is sized to the SVG exactly, and the template's inline-block container overflows it by a few pixels; WebKit 27 then reserves a scrollbar gutter that squeezes the SVG to a sliver. `svg-template.html` now removes that overflow (`vertical-align: top` on the container) and hides overflow on `html` and `body` so no gutter is reserved. `WebDetailsNavigationOrderingTests` now turn off WebKit 27's CSS scroll anchoring in the two cases that measure re-asserts, because anchoring moves `scrollY` when a `<details>` above the viewport opens; the product keeps anchoring on. - Task list items render the way they did before the WebKit rendering cutover: the checkbox replaces the list marker, with a space before the text (T-1542 regression). `document.css` has carried rules for a `prism-task` item class since the cutover, but `BlockHTMLEmitter` never put that class on the `<li>`, so every task item drew its bullet or number AND the checkbox, with the text jammed against the box. The class is now emitted, and the stylesheet seats the checkbox in the marker gutter rather than shifting the whole item left, so a task item's text lines up with its sibling bullet items at every nesting level and in ordered lists, and the item's add-note "+" and note-indicator column needs no task-specific offset. - A document's YAML frontmatter is shown again as a collapsed "Metadata" card at the top of the document, expandable in place to reveal the raw YAML. The WebKit rendering cutover (T-1542) dropped this: the parser still produced the frontmatter block, but the emitter wrote it out as an inert hidden section, so a document that opened with `---` metadata simply started at its first heading with no way to see what the frontmatter said. The card is a native `<details>` disclosure — no script of its own — whose title comes from the localisation catalog, whose body is the YAML as escaped monospaced text, and whose open state is recorded natively like every other disclosure, so it survives a WebContent recovery. Because the block now lays out, the native raw-to-rendered position picker no longer has to skip it to agree with the page about which sections exist, and the pre-cutover SwiftUI `MetadataView` that nothing had rendered since the cutover is removed.
diff --git a/CLAUDE.md b/CLAUDE.mdindex aa028d2b..6a70cb18 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -22,10 +22,10 @@ make lint # Run SwiftLint make lint-fix # Run SwiftLint with auto-fix ``` -To run a single test class or method:+To run a single test class or method (use the simulator named by `SIMULATOR` in the Makefile): ```bash xcodebuild test -project prism.xcodeproj -scheme prism \- -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \+ -destination 'platform=iOS Simulator,name=iPhone 18 Pro' \ -only-testing:'prismTests/MarkdownBlockParserTests/testMermaidDetection()' test ```
diff --git a/docs/agent-notes/development-tooling.md b/docs/agent-notes/development-tooling.mdindex 9806a7e4..d654ae2b 100644--- a/docs/agent-notes/development-tooling.md+++ b/docs/agent-notes/development-tooling.md@@ -263,6 +263,9 @@ result bundle — `log show --predicate 'process == "launchd"'` filtered to - **`SVGWebViewTests` no longer needs skipping** (fixed on the T-1541 bugfix branch; `specs/bugfixes/svgwebviewtests-offmain-crash/report.md`). Root cause of the full-run host crash: the suite was the only one constructing `WKWebView` in *synchronous* test bodies. A sync `@MainActor` function has no hop-on-entry — its isolation depends on the caller hopping, and swift-testing's `nonisolated(nonsending)` thunks (Swift 5 mode + Approachable Concurrency, no default isolation in the test target) run on the runner's cooperative pool under full-suite load. WebKit's init `RELEASE_ASSERT(main thread)` then killed the host. The `@MainActor` added in 81c1636 could only move the trap. The rule for this target: **touch WebKit only from an `async` test in a `@MainActor` suite** (an ACTOR-ISOLATED async function hops on entry as ABI — `async` on its own hops nowhere); the suite additionally wraps construction in `MainActor.run`, which is runtime-enforced. - **The app and test targets have different actor-isolation defaults.** `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` is set on the app target only; `prismTests` and `prismUITests` have no default. Production code is therefore implicitly main-actor while the same type called from a test is not, which silently turns "safe because everything is on the main actor" into a real race in tests (see `RecentFileEntry.relativeDateFormatter`). Do not assume a production type's isolation holds inside a test.+- **Xcode 27 applies the app target's default MainActor isolation to protocols.** An unannotated protocol in `prism/` became `@MainActor`, so an `actor` test double could no longer conform (`StubAppStoreSync` / `AppStoreSyncing`); declare such protocols `nonisolated protocol`, as `StoreProduct` and `SecurityScopedResourceAccessing` already were. Pure helpers called from `nonisolated` code need `nonisolated` too, or Xcode 27 warns.+- **WebKit 27 ships CSS scroll anchoring (`overflow-anchor: auto`).** Opening a `<details>` above the viewport moves `scrollY` by the height it adds. A live test that uses `scrollY` to detect a re-assert must turn anchoring off for that page (`WebDetailsNavigationOrderingTests.disableScrollAnchoring`); the product keeps it on (T-1965).+- **Xcode 27's result bundles add `Skip Message` and `Expected Failure` nodes** to the per-test tree; `check-test-results.sh` lists them in `NODE_TYPES`. Re-copy that set from `xcrun xcresulttool get test-results tests --schema` when a new Xcode adds more. - **`check-test-results.sh`'s arithmetic check now folds in `expectedFailures`, and it gates the build.** An expected failure is counted in neither `passedTests` nor `failedTests`, so the original `passed+failed+skipped != total` check tripped on every run containing an `XCTExpectFailure` (currently 2, T-1985 and T-1986) and printed a `WARN` everyone learned to ignore. Fixed in both directions (T-1993): `expectedFailures` is part of the sum, so those runs now reconcile exactly, and a mismatch is a hard FAIL rather than a warning — counts that do not reconstruct the whole mean nothing below them can be trusted. Do not expect a benign warning here any more; if this fires, the bundle is wrong. - **`check-test-results.sh` fails closed on anything it cannot read, including the per-test tree.** Beyond the counts it reads `xcrun xcresulttool get test-results tests` and refuses to report OK when: the tree contains an unrecognised `nodeType` or result value; contains no `Test Case` node while the summary counts tests; records a `Test Case` as `Failed` while `failedTests` is zero; shows any test whose final result was reached only after a failed attempt (T-2224); either `xcresulttool` call it depends on (the summary read or the per-test tree read) exits non-zero, even when its stdout still parses cleanly; a Test Case or attempt result is `"unknown"` — a genuine `TestResult` enum member, just never a RESOLVED one; a `children` field is present but not a JSON array; a grouping node (Test Plan, Test Suite, ...) itself carries an invalid or unresolved result; an attempt node (`Repetition` / `Test Case Run`) sits somewhere OUTSIDE any Test Case's own subtree, a shape no real bundle here has shown but nothing in the schema forbids; or a Test Case's `result` is absent or null (T-2243, closed in two rounds — the last two only found on a follow-up review of the first four). Two things worth knowing before debugging a surprise FAIL: a future Xcode that adds a `TestNodeType` will trip the unrecognised-node check until the enum copy inside the script is updated (deliberate — a guard that goes quiet exactly when the format moves is worse), and the retry scan walks a Test Case's WHOLE subtree rather than its direct children, because on any run without `-only-test-configuration` — i.e. `make test` and `make test-ui` — a Test Case's direct children are `Test Plan Configuration` nodes and nothing else structural (measured: 5,627 of 5,627 cases across every multi-configuration bundle on this machine, four configurations each). Where a per-attempt node would land inside that subtree is inference, not measurement — no bundle on this machine has ever contained a `Repetition` or `Test Case Run` node, which is exactly why the scan accepts either type at any depth. Regression suite: `Tools/Tests/test-check-test-results.sh`, run by `make verify-make-guards`. - **One `MockURLProtocol` used to be shared by five suites** across `URLDocumentLoaderTests`, `ImageLoaderTests`, and `SVGSourceLoaderTests`. `.serialized` only orders tests *within* a suite, so the suites overwrote each other's static handler and served each other's payloads. Handlers are now registered per scope (`MockURLScope`), carried as a request header set from the session configuration. If you add a networked suite, give it its own scope rather than a global handler.
diff --git a/docs/agent-notes/webview-pool.md b/docs/agent-notes/webview-pool.mdindex 30f1af71..55b49c8a 100644--- a/docs/agent-notes/webview-pool.md+++ b/docs/agent-notes/webview-pool.md@@ -27,6 +27,10 @@ WebViewPool is fully implemented. `SVGRenderer` delegates pool management to `We - `webViewWebContentProcessDidTerminate` nils ALL pool slots and resumes ALL pending continuations (not just the reported WebView's), because all WebViews sharing a WKProcessPool share a single WebContent process - Renderers catch `WebViewPoolError.processTerminated` (and `WKError.webContentProcessTerminated` for JS evaluation failures) and retry once +## SVG template overflow under WebKit 27++`SVGRenderer` sizes the view to the measured SVG. On WebKit 27 any page overflow then reserves a ~17px scrollbar gutter, `max-width: 100%` shrinks the SVG into what is left, and pass 2 measures the shrunk size, so the snapshot comes out a few pixels wide and near-blank. `svg-template.html` removes the overflow's source (`vertical-align: top` on the inline-block container) and sets `overflow: hidden` on `html, body`. `SVGRendererTests`' T-1896 pixel checks catch a regression, but only on macOS 27.+ ## SVGRenderer template tracking - `templateReady: Set<ObjectIdentifier>` tracks which WebViews have loaded the SVG template
diff --git a/specs/remove-dead-cachedsvg/decision_log.md b/specs/remove-dead-cachedsvg/decision_log.mdnew file mode 100644index 00000000..a7dab62c--- /dev/null+++ b/specs/remove-dead-cachedsvg/decision_log.md@@ -0,0 +1,50 @@+# Decision Log: Remove Dead cachedSVG and Stale Cutover References++## Quick Decisions++| ID | Date | Decision | Rationale |+|----|------|----------|-----------|+| Q1 | 2026-10-03 | Widen the comment cleanup from `BackgroundDiagramRenderer` to all four types deleted by T-1542 (`MermaidPreviewCard`, `MermaidPlaceholderCard`, `ImageBlockView`) in `prism/` and `prismTests/` | Explanation validation and design critique both found the same class of stale comment for the other three types; they are comment-only edits with the same intent as the ticket |+| Q2 | 2026-10-03 | Keep comments that name a deleted type as retired or old | They are accurate history and explain where the current code came from |+| Q3 | 2026-10-03 | Leave all `docs/agent-notes/` changes out of this change | A separate agent-notes cleanup task already covers them (user direction). For that task: `mermaid-preview.md` only describes deleted code, and its T-1042 auto-dismiss rule died with the overlay |+| Q4 | 2026-10-03 | Leave UI tests for deleted views to T-2158, which already scopes them | Removing or retargeting UI tests is a separate decision from a dead-method cleanup |+| Q5 | 2026-10-03 | Gate on `make lint`, `make build-macos` and targeted `DiagramCacheTests` instead of `make test-quick` | The change deletes an uncalled method and edits comments; the build proves no caller, and the full quick suite only adds flake exposure. Pre-push review still runs the full gates. Superseded in practice by Q7: once the test target compiled again, the full `make test-quick` ran |+| Q6 | 2026-10-03 | Leave `ImageBlockView` in `ExportNestedListImportTests.swift:22` | It is markdown fixture text inside a test input string, not a comment about the codebase; editing it changes test input for no benefit |+| Q7 | 2026-10-03 | Fold the Xcode 27 build and test fixes into this change | User direction: the test target no longer compiled under Xcode 27, so this change's own verification could not run |+| Q8 | 2026-10-03 | Make `AppStoreSyncing`, `GitHubURLTransformer`, `MarkdownFileExtensions` and `DocumentStructure.sourceIndex(forBlockId:headingPath:)` `nonisolated` | Xcode 27 applies the target's MainActor default to protocols and flags pure helpers called off the main actor; matches the existing `nonisolated protocol StoreProduct` pattern. The two stateless enums are marked whole; on `DocumentStructure` only the method that warns |+| Q9 | 2026-10-03 | Declare the diagram zoom focused values with explicit `FocusedValueKey`s instead of `@Entry` | `@Entry` now warns about stored closures; explicit keys keep behaviour identical. The re-evaluation cost predates Xcode 27 and an Equatable action wrapper would change when the menu sees new closures |+| Q10 | 2026-10-03 | Add a `SIMULATOR` Makefile variable defaulting to the iPhone 18 Pro | Without an OS, xcodebuild picks the newest runtime, and iOS 27 has no iPhone 17 Pro. `DEVICE_MODEL` names the physical device and stays as is |+| Q11 | 2026-10-03 | Fix the SVG template with `vertical-align: top` on the container plus `overflow: hidden` on `html, body` | WebKit 27 reserves a scrollbar gutter on any overflow, which shrank SVG snapshots to near-blank; the first removes the overflow's source, the second stops a gutter being reserved at all |++## Decision 1: Turn Off Scroll Anchoring Only in the Re-assert Tests++**Date**: 2026-10-03+**Status**: accepted++### Context++WebKit 27 ships CSS scroll anchoring (`overflow-anchor: auto`). When a `<details>` above the viewport opens, the engine moves `scrollY` by the height added (measured: 124 px). Two `WebDetailsNavigationOrderingTests` cases use `scrollY` to detect whether a stale navigation target was re-asserted, so the anchoring shift made them fail although no re-assert happened. `prism-scroll.js` deliberately leaves anchoring on (T-1965).++### Decision++The two affected tests set `overflow-anchor: none` on their page before arming a navigation. Product code and the other tests keep anchoring on.++### Rationale++Anchoring is the behaviour readers want, and the product is correct under it. The tests need `scrollY` to change only when a re-assert fires, so they remove the one other source of movement. Assertions and tolerances are unchanged, and both positive controls still pass.++### Alternatives Considered++- **Turn anchoring off in `document.css`**: Makes tests and product match - Rejected because T-1965 keeps anchoring on deliberately, and opening content above the reader would then jump the page.+- **Widen the tolerance to absorb the shift**: Keeps anchoring on in the test - Rejected because a 124 px tolerance would also hide a real re-assert.++### Consequences++**Positive:**+- The tests again isolate the re-assert they are named for.+- No product behaviour change.++**Negative:**+- These two tests run in a configuration the product never ships. The other eight tests in the class run with anchoring on and still assert the landing position.++---
diff --git a/specs/remove-dead-cachedsvg/implementation.md b/specs/remove-dead-cachedsvg/implementation.mdnew file mode 100644index 00000000..5dc60725--- /dev/null+++ b/specs/remove-dead-cachedsvg/implementation.md@@ -0,0 +1,73 @@+# Implementation Explanation: Remove Dead cachedSVG (T-1687)++Branch `worktree-t-1687-remove-dead-cachedsvg`, 5 commits on `origin/main`. The branch does two things. It removes `DiagramCache.cachedSVG(source:theme:)` and fixes comments that still describe types deleted in the T-1542 WebKit cutover (the smolspec scope). It also gets the project building and testing under Xcode 27 (decision log Q7–Q11 and Decision 1, added at the user's request because the test target no longer compiled).++## Beginner++**What changed.** When Prism moved to rendering documents in a web view (T-1542), several old screens were deleted. Some code and comments still talked about them as if they existed. This branch deletes one method that only those old screens used, and rewrites the comments so they point at the code that does the job today. A comment that sends a reader looking for a file that no longer exists wastes their time.++The second part is upkeep after a tool upgrade. Apple's Xcode 27 is stricter in a few places:+- Swift checks more carefully which thread code may run on. Some small helpers had to be marked as safe to call from any thread (`nonisolated`).+- The iPhone simulator the build used (iPhone 17 Pro) is not in the newest simulator set, so the Makefile now has a `SIMULATOR` setting, defaulting to the iPhone 18 Pro.+- The newer web engine (WebKit 27) behaves differently in two ways that broke tests. It reserves room for a scrollbar when a page is slightly too big, which squashed SVG previews to almost nothing. It also keeps your reading position steady when content opens above you ("scroll anchoring"), which confused two tests that watch the scroll position.++**Why it matters.** Fewer misleading comments, and a project whose builds and tests run again on current tools.++**Key terms.** *Dead code*: code nothing calls. *Main actor*: Swift's name for "runs on the main (UI) thread". *Snapshot*: a picture of a rendered web page, used for zoomed SVG views.++## Intermediate++**Cleanup (commit 9fe5c566).**+- `prism/Services/DiagramCache.swift`: `cachedSVG` deleted. The private `cacheKey(source:theme:)` stays because `render` uses it (line 64). `render`, `clear`, `count` are untouched.+- Comment rewrites: `RenderingUtilities.swift` header now names `SVGRenderer` and `MermaidRenderer` (the only callers). `ImagePathResolver.isSVG` names `PrismDocSchemeHandler`, `WebImageDetailSheet` and `ImageDetailWindow` (verified by grep). `MarkdownBlockParser` and `ListItemParagraphOrderingTests` name `BlockHTMLEmitter`. `MermaidTypeParser.iconName` and `DiagramWindowManager.diagramOwnerURL` lost their consumer clause. `ImageIntegrationTests` describes what the test checks.++**Xcode 27 (commits 8acd973f, 502636dc, a7742395).**+- `AppStoreSyncing` becomes `nonisolated protocol`. Xcode 27 applies the target's `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` to the protocol, and the `actor` test double cannot conform to a MainActor protocol. Same pattern as `StoreProduct`.+- `GitHubURLTransformer`, `MarkdownFileExtensions` and `DocumentStructure.sourceIndex(forBlockId:headingPath:)` are `nonisolated` because they are pure and called from nonisolated code (`URLDocumentLoader`, `BlockDOMID`).+- `URLDocumentLoader` builds the request as a `let` via `URLRequest(url:timeoutInterval:)`, so no `var` is captured by a later closure.+- `DiagramFocusedValues.swift`: four `@Entry` closures become explicit `FocusedValueKey`s. This silences the new warning only; the menu still re-evaluates when the window publishes new closures (stated in the comment, Q9).+- `svg-template.html`: `vertical-align: top` on the inline-block container (removes the descender gap that overflowed the exactly-sized view) and `overflow: hidden` on `html, body` (no gutter is ever reserved).+- `Tools/check-test-results.sh`: `Skip Message` and `Expected Failure` added to `NODE_TYPES`, with a regression fixture, so the fail-closed guard does not reject Xcode 27 bundles.+- `WebDetailsNavigationOrderingTests`: two re-assert tests set `overflow-anchor: none` before arming a navigation.++**Trade-offs.** Folding the Xcode 27 work into a cleanup ticket makes the PR wider than its title, but the cleanup could not be verified otherwise (Q7). Disabling anchoring only in two tests keeps product behaviour (T-1965) at the cost of those tests running in a configuration the product does not ship (Decision 1).++## Expert++- **Isolation semantics.** Making the whole `GitHubURLTransformer` and `MarkdownFileExtensions` enums `nonisolated` is broader than "only the members that warn" (Q8), but both are stateless namespaces, so there is nothing to protect. `sourceIndex` is a single method on a value type reading `let`s, so it is narrowly scoped. App and test targets still have different default isolation; `development-tooling.md` records the new protocol rule.+- **SVG fix.** The bug is a feedback loop: view sized to the measured SVG, a few px of inline-block descender overflow, WebKit 27 reserves ~17 px of gutter, `max-width: 100%` shrinks the SVG, pass 2 measures the shrunk size. Either CSS change alone breaks the loop; both are kept so a future overflow source cannot reintroduce the gutter. `overflow: hidden` could clip content if the view is ever sized smaller than the SVG; today the renderer sizes to the measurement, so this is not reachable. The T-1896 pixel checks only catch a regression on macOS 27.+- **Result-bundle guard.** The node-type set is a copy of the xcresult schema enum. The guard fails closed on unknown types by design, so each Xcode upgrade may need this edit; the agent note says how to re-copy it.+- **Scroll anchoring.** The disabled tests still assert the absence of a re-assert; positive controls and the other eight tests in the class run with anchoring on. If WebKit changes anchoring heuristics, only the eight tests exercise the product configuration.+- **Simulator.** `SIMULATOR ?= iPhone 18 Pro` without an OS version still picks the newest runtime; on a machine without iOS 27 runtimes the default will fail and must be overridden.++## Completeness Assessment++**Smolspec requirements**++| Requirement | Status | Evidence |+|---|---|---|+| No `DiagramCache.cachedSVG` or its doc comment | Done | Removed; grep finds no matches |+| `DiagramCache` behaviour unchanged | Done | Only the method deleted; `cacheKey` kept; tasks.md records `DiagramCacheTests` passing |+| Comments do not present the four deleted types as live | Done | Remaining matches are the four history/fixture mentions the smolspec lists |+| `RenderingUtilities` header names only `SVGRenderer`, `MermaidRenderer` | Done | Grep confirms those are the only callers |+| grep for `cachedSVG\|BackgroundDiagramRenderer` returns nothing | Done | Verified on HEAD |++**Xcode 27 decisions**++| Decision | Status | Notes |+|---|---|---|+| Q7 fold in Xcode 27 fixes | Done | Commits 8acd973f, 502636dc, a7742395 |+| Q8 `nonisolated` protocol/helpers | Done | Enums are marked whole rather than per member (harmless, see Expert) |+| Q9 explicit `FocusedValueKey`s | Done | Keys at file scope; cost documented |+| Q10 `SIMULATOR` variable | Done | Used by `build-ios`, `test`, `test-ui`; in `make help`; CLAUDE.md example updated |+| Q11 SVG template fix | Done | Both CSS rules present |+| Decision 1 anchoring off in two tests | Done | Lines 331 and 393 of the test file |++**Partial / missing**+- Verification of the final state: both builds (zero warnings), `make lint` and `make test-quick` (macOS) are green. `make test` (iOS, all locale configurations) stalled twice for suite-load reasons and `make test-ui` was not run; both were left at the user's direction, with suite cost tracked in T-2389.+- Q5 said to gate on targeted `DiagramCacheTests` rather than `make test-quick`; the decision log now records that Q7 superseded it.++**Flags (not covered by the spec)**+- `MermaidTypeParser.iconName(for:)` (`prism/Services/MermaidTypeParser.swift:131`) now has no callers in `prism/`, `prismTests/` or `prismUITests/`. Its comment was removed, but the method is dead code of the same kind as `cachedSVG`.+- The `diagramOwnerURL` environment value (`DiagramWindowManager.swift:307-319`) is set in `DocumentReaderView.swift:283` but never read via `@Environment`; its only reader was `MermaidPlaceholderCard`. The rewritten comment ("Set by DocumentReaderView") is accurate, but the value itself looks dead. `DocumentSession.diagramOwnerURL`, which `DocumentFlowCoordinator` uses, is a separate property and is live.+- The smolspec puts all `docs/agent-notes/` changes out of scope (Q3). The branch edits `development-tooling.md` and `webview-pool.md`, but only to add Xcode 27 notes, not to clean stale renderer text. Consistent with Q3's intent; worth knowing in review.
diff --git a/specs/remove-dead-cachedsvg/smolspec.md b/specs/remove-dead-cachedsvg/smolspec.mdnew file mode 100644index 00000000..cbf26e4c--- /dev/null+++ b/specs/remove-dead-cachedsvg/smolspec.md@@ -0,0 +1,49 @@+# Remove Dead cachedSVG and Stale Cutover References++Transit: T-1687++## Overview++The T-1542 WebKit cutover deleted `BackgroundDiagramRenderer`, `MermaidPreviewCard`, `MermaidPlaceholderCard` and `ImageBlockView`, but left behind code and comments that still refer to them as live. `DiagramCache.cachedSVG(source:theme:)` existed only for `BackgroundDiagramRenderer` and now has no callers. This change removes that method and corrects the comments that describe the deleted types as current, so readers are not sent looking for code that no longer exists.++## Requirements++- The system MUST NOT contain `DiagramCache.cachedSVG(source:theme:)` or its doc comment.+- `DiagramCache` behaviour (`render`, `clear`, `count`, cache keying) MUST be unchanged.+- Comments in `prism/` and `prismTests/` MUST NOT present `BackgroundDiagramRenderer`, `MermaidPreviewCard`, `MermaidPlaceholderCard` or `ImageBlockView` as existing types. Comments that explicitly name them as retired or old (history) MAY stay.+- The `RenderingUtilities` header comment MUST name only the types that call it (`SVGRenderer` and `MermaidRenderer`).+- `grep -rn "cachedSVG\|BackgroundDiagramRenderer" prism prismTests` MUST return no matches.++## Implementation Approach++Code (line numbers as of `main` at 14078ed9):+- `prism/Services/DiagramCache.swift:108-120`: delete `cachedSVG(source:theme:)` and its doc comment (which cites `BackgroundDiagramRenderer` and an old mermaid-preview "Decision 11", unrelated to the webview-rendering Decision 11 cited elsewhere; leave those alone). Keep the private `cacheKey(source:theme:)`, which `render` uses.+- `prism/Services/RenderingUtilities.swift:68`: the header says the helpers are used by `SVGRenderer` and `MermaidRenderer`, and "the three renderers" becomes "the renderers". `grep -rn "RenderingUtilities\." prism` shows calls only in those two files; `URLDocumentLoader.swift` mentions it only in a comment.+- Comments that describe a deleted type as live; rewrite each to describe the current consumer, or drop the clause if there is none:+ - `prism/Services/MermaidTypeParser.swift:129` (`MermaidPlaceholderCard` and `MermaidPreviewCard`)+ - `prism/Services/ImagePathResolver.swift:423` (`ImageBlockView`)+ - `prism/Services/MarkdownBlockParser.swift:861` (`ImageBlockView`)+ - `prism/Services/DiagramWindowManager.swift:314` (`MermaidPlaceholderCard`)+ - `prismTests/ListItemParagraphOrderingTests.swift:302`, `prismTests/ImageIntegrationTests.swift:256` (`ImageBlockView`)+ - Find current consumers with grep (for example, callers of the `MermaidTypeParser` method at line 129). These are comment-only edits; no code changes.+- Accurate history that stays as is: `prism/Views/MediaZoomPresenter.swift:78` ("the old MermaidPreviewCard behaviour"), `prism/Views/ImageDetailWindow.swift:20` ("retired in the T-1542 WebKit cutover"), `prism/Views/MermaidDiagramSheet.swift:6` ("Extracted from the retired MermaidPlaceholderCard"), and `prismTests/ExportNestedListImportTests.swift:22`, which is markdown fixture text inside a test input string, not a comment (per Q6).++Verification (Makefile and targeted tests, per CLAUDE.md):+- `make lint` and `make build-macos` pass, the build with zero warnings.+- `DiagramCacheTests` pass (`xcodebuild test -project prism.xcodeproj -scheme prism -destination 'platform=macOS' -only-testing:prismTests/DiagramCacheTests`). `prismTests/DiagramCacheTests.swift` never calls `cachedSVG`, so no tests are removed.+- Checking that the rewritten comments are accurate is done in review; grep only proves that names are gone.++**Out of Scope**+- All of `docs/agent-notes/`, including `mermaid-preview.md`, `webview-pool.md:5` and `webview-rendering-status.md` item 4. A separate agent-notes cleanup task owns these.+- `prismUITests/MermaidPreviewUITests.swift`, `prismUITests/MermaidPlaceholderCardUITests.swift` and the deleted-view references in `prismUITests/ImageDetailSheetUITests.swift` (covered by T-2158, scope item 4). Removing or retargeting UI tests is a separate decision.+- Mentions in `specs/`, and any behavioural change to `DiagramCache`, `SnapshotCache` or the renderers.++## Risks and Assumptions++- Assumption: `cachedSVG` has no callers outside `prism/` and `prismTests/`. | Validation: `grep -rn cachedSVG prism prismTests prismUITests Tools` before deleting.+- Risk: line numbers drift if `main` moves. | Mitigation: locate each comment by its quoted type name, not by line number.+- Risk: the targeted test run fails for reasons unrelated to this change (machine contention, NSCache flakes). | Mitigation: re-run the class on its own. If it fails the same way on `main`, report it as inherited.+- Prerequisite: none. T-2376 already updated CLAUDE.md.++## Escalation Note+This change was scoped as a smolspec. If implementation reveals ambiguity only the user can resolve, an irreversible boundary (public API, persisted schema, auth path), or a contested architectural choice, stop and escalate to the full spec workflow rather than deciding it inline.
diff --git a/specs/remove-dead-cachedsvg/tasks.md b/specs/remove-dead-cachedsvg/tasks.mdnew file mode 100644index 00000000..4d3fcb33--- /dev/null+++ b/specs/remove-dead-cachedsvg/tasks.md@@ -0,0 +1,30 @@+---+references:+ - specs/remove-dead-cachedsvg/smolspec.md+ - specs/remove-dead-cachedsvg/decision_log.md+---+# Remove Dead cachedSVG and Stale Cutover References (T-1687)++- [x] 1. DiagramCache no longer exposes the dead cachedSVG lookup, with its other behaviour unchanged <!-- id:loaddlm -->+ - See smolspec.md Requirements and Implementation Approach (DiagramCache.swift)+ - cacheKey(source:theme:) stays because render uses it+ - Verified 2026-10-03: make build-macos and make build-ios with zero warnings; DiagramCacheTests pass in make test-quick (after the Xcode 27 test-target fix)++- [x] 2. Source comments in prism/ name only types that exist, apart from explicitly historical mentions <!-- id:loaddln -->+ - See smolspec.md Implementation Approach: RenderingUtilities.swift header, MermaidTypeParser.swift, ImagePathResolver.swift, MarkdownBlockParser.swift, DiagramWindowManager.swift+ - Each rewritten comment describes the current consumer (find it with grep) or drops the clause; comment-only edits+ - Leave the MediaZoomPresenter.swift, ImageDetailWindow.swift and MermaidDiagramSheet.swift history comments as is+ - Verify: make build-macos succeeds with zero warnings; each rewritten comment is checked against its actual callers+ - Blocked-by: loaddlm (DiagramCache no longer exposes the dead cachedSVG lookup, with its other behaviour unchanged)++- [x] 3. Test comments in prismTests/ no longer describe ImageBlockView as live <!-- id:loaddlo -->+ - See smolspec.md: ListItemParagraphOrderingTests.swift, ImageIntegrationTests.swift (ExportNestedListImportTests.swift:22 is fixture text, left as is per decision Q6)+ - Comment-only edits; test behaviour unchanged+ - Verified 2026-10-03: both classes pass in make test-quick+ - Blocked-by: loaddln (Source comments in prism/ name only types that exist, apart from explicitly historical mentions)++- [x] 4. The cleanup is verified against the smolspec success checks <!-- id:loaddlp -->+ - grep -rn "cachedSVG\|BackgroundDiagramRenderer" prism prismTests returns no matches+ - Remaining MermaidPreviewCard/MermaidPlaceholderCard/ImageBlockView matches in prism/ and prismTests/ are only the explicitly historical comments listed in smolspec.md+ - make lint passes+ - Blocked-by: loaddlo (Test comments in prismTests/ no longer describe ImageBlockView as live)
make test stalled twice; make test-ui not run. See T-2389.
The CSS change should be neutral on WebKit 26, but only macOS 27 was exercised.
Override with make test SIMULATOR='iPhone 17 Pro'.