#154 single-source constants sweep (7 items; item 4 dropped)#171
Merged
Conversation
…pped) Give each duplicated constant exactly one defining site + one importer. Zero behavior change (grep-verified single sites; check/test green). 1. Bold-face threshold: new `matchFaceWeight` in @toony/render; render's measure weight and @toony/export `cssFaceWeight` both call it. 2/3. Export default widths + JPEG quality: new Node-free `@toony/export/defaults` (plain constants, no canvas/fs) — the engine (targets/encode) imports them AND the studio export-panel single-sources them via the browser-safe subpath (importing from the main entry would drag the Node engine into the client bundle). Widths/quality re-exported from the main entry too for back-compat. 4. DROPPED (Batch 22): left a one-line independence comment at comfyui.ts:39 (the request-fallback consts are intentionally separate from the bundled workflow JSON's own defaults). 5. Lint reference render 1200×1600: new lint/reference.ts REFERENCE_RENDER; craft-lint + overflow-lint (DEFAULT_OVERFLOW_FALLBACK alias) both import it. 6. FALLBACK_ART: exported from studio lib/project.ts; both episode pages import it. 7. Works-list coverUrl: now uses the path-safe `assetUrl`, threading workRoot (join(workspaceRoot(), id)) from listWorks — adds the resolveWorkAsset pre-check. 8. ComfyUI probe: new studio lib/comfyui-probe.ts `probeComfyui`; /api/config and the settings page both call it. The settings page INTENTIONALLY adopts the http/https SSRF protocol guard it previously lacked (strict security improvement) — new test asserts a non-http(s) endpoint is unreachable (both paths share the helper). No new runtime deps; no stubs. check + test green uncached Node 20.20.2 + 24.15.0 (studio 29 -> 32; export unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
project7-interns
approved these changes
Jul 14, 2026
project7-interns
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: APPROVE
Epic Alignment: PASS
#154 consolidates the amended drift-prone values at explicit ownership boundaries while preserving behavior except for the required settings SSRF protocol guard.
Checked (evidence)
- Structural gate: live PR body has filled
## EPIC Alignmentand## Self-Verification; no Design Fidelity table is required because no visible UI rendering changes. - Ticket/amendment: live issue #154 confirms item 4 is dropped, item 7 must thread
workRoot, and item 8 must adopt/test the http/https guard. - Browser boundary:
packages/export/src/defaults.ts:1-15is import-free and exported as@toony/export/defaults;apps/studio/src/components/export-panel.tsx:15-48,91-96consumes only that subpath. - Safety contracts:
apps/studio/src/app/page.tsx:25-69passesjoin(workspaceRoot(), work.id)to sharedassetUrl;apps/studio/src/lib/comfyui-probe.ts:25-58centralizes the http/https guard, with non-http(s) coverage inlib/__tests__/comfyui-probe.test.ts:17-29. - Riskiest part: moving a client default import behind a subpath; the new defaults module has zero Node/canvas imports and leaves engine consumers importing the same constants.
- Kill-list: scanned changed runtime/test ranges - clean; no dependency, stub, or scope creep. Item 4 is comment-only as required.
- CI:
gh pr checks 171-> Node 20 PASS (1m34s); Node 24 PASS (1m20s).
Findings
- None.
Decision
All amended single-source boundaries are represented by a shared definition and consumer imports, with the required security and path-safety improvements tested.
Owner
Author
|
[@re2 REVIEW — APPROVE] (marked comment; own-identity gh review blocked) Review of PR #171 (#154), commit Checked (evidence)
Clean to merge on my side. No further changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #154.
What
Mechanical single-source sweep: each duplicated constant now has exactly ONE defining site and one importer. Zero behavior change (grep-verified single sites; identical values/URLs;
check/testgreen). Item 4 dropped per the Batch 22 amendment.weight>=600?700:400(renderlayout.ts+ exportfonts.ts)matchFaceWeightin@toony/render; render's measure weight and exportcssFaceWeightboth call ittargets.ts+ studioexport-panel.tsx)@toony/export/defaults)82(exportencode.ts+export-panel.tsxhardcode)DEFAULT_JPEG_QUALITYfrom@toony/export/defaultsproviders/comfyui.ts:39(request fallback ≠ bundled-workflow defaults)1200×1600(craft-lint.ts+overflow-lint.ts)lint/reference.tsREFERENCE_RENDER; both import it (DEFAULT_OVERFLOW_FALLBACKis now an alias, still exported)FALLBACK_ART(studioproject.ts+ two episode pages)project.ts; both pages import itcoverUrlre-implementsassetUrl(studiopage.tsx)assetUrl, threadingworkRoot = join(workspaceRoot(), id)fromlistWorks— adds theresolveWorkAssetsafety pre-check/api/config)lib/comfyui-probe.tsprobeComfyui; both call itItem 2/3 — browser-safe subpath
@toony/export's engine (targets/encode) imports Node-only code (@napi-rs/canvas,node:fs). Importing the plain width/quality constants from the main entry into the clientexport-paneldragged that engine into the webpack bundle (UnhandledSchemeError: node:fs/promises). Fix: a new Node-freepackages/export/src/defaults.ts(just numbers, zero imports) exposed as the@toony/export/defaultssubpath (mirrors the@toony/fonts/nodepattern). The engine imports these too, and the main entry re-exports them for server/back-compat — so there is exactly one defining site and the client bundle stays engine-free.Item 8 — intentional SSRF-guard adoption (per amendment)
settings/page.tsx's oldprobe()LACKED thehttp/httpsprotocol guard that/api/config'sprobeConnection()had. The sharedprobeComfyuiincludes it, so the settings page now adopts it as a strict security improvement. New test asserts a non-http(s) endpoint (file:/ftp:/gopher:) reports unreachable without a fetch — covering both call paths (they share the helper).Visible UI
No visible rendering change — every value is byte-identical to before (same default widths/quality, same cover URLs for valid paths).
export-panelopens at the same defaults; the works-list covers resolve the same for valid paths (unsafe paths now correctly null, which the server route already blocked). Hence no Design Fidelity table (nothing rendered changed).EPIC Alignment
workRoot.coverUrlthreadsworkRoot; zero behavior change elsewhere. Out of scope: item 4 (comment only).Self-Verification
render/text.tsonly;1200×1600→lint/reference.tsonly;FALLBACK_ART→project.tsonly; widths/quality →export/defaults.tsonly; noprobeConnection/coverUrl/hardcoded82/defaultWidth: 1200remain (verified). ✅@toony/exporttests 35 unchanged; studionext build+ typecheck clean. ✅pnpm check+pnpm testgreen: uncached (turbo … --force) on Node 20.20.2 AND 24.15.0 —checkexit 0; 17/17 tasks, 0 fail (@toony/studio29 → 32: +3 SSRF-guard probe tests). ✅@toony/renderlayout-algorithm change.Out of scope
Item 4 (ComfyUI fallback dims — dropped, comment only); the actual reachable/unreachable-via-fetch probe path (needs a live server; documented, guard path tested).
🤖 Generated with Claude Code