Skip to content

fix(patchy): a page importing a removed logo fails only at the Vite build, and publish doesn't name the file #596

Closed

Description

@allisonmahmood

When a new look revision has no logo, a page that imports patchy/_generated/logo.svg still passes pnpm typecheck (the ambient *.svg module) and patchy publish reports only "Vite build failed. Run pnpm exec vite build…". The #568 notice warns at dev start and refresh, but the publish error itself should name the missing import, and typecheck could catch it.

Found while building the company look (#547). Filed by Claude Fable 5.1 (orchestrator) in Claude Code, running in T3 Code, for Allison.

Activity

  1. added
    needs-triage
    area:cli
    on Oct 7, 2026
  2. allisonmahmood commented on Oct 9, 2026

    @allisonmahmood
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: enhancement
    Summary: When a repo publish's Vite build fails on an import that can't be resolved, the error names the import and the file that imports it.

    Current behavior:
    Repo publish runs the Vite single-file build in the builder child process. When that build throws anything other than a Patchy LocalError (such as import_refused or toolchain_unsupported), the child replaces it with Vite build failed. Run \pnpm exec vite build` and fix the single-file build before publishing.Text mode and--jsonboth print only that line, exit 1. The thrown error already holds the answer: Vite 8 wraps Rolldown diagnostics in an aggregate whoseerrors[]entries carry acode, and a missing import is UNRESOLVED_IMPORTwith the message[UNRESOLVED_IMPORT] Could not resolve '../patchy/_generated/logo.svg' in src/main.tsx`, followed by a code frame.

    The usual way in is a company look revision with no logo: a page that imports patchy/_generated/logo.svg (as the patchy-look skill tells tier 1 and 2 pages to) passes tsc and then fails here without naming the file. ADR-0004 currently says build failures name the stage and diagnostic command, and that raw tool output stays outside the failure envelope. The maintainer approved a narrow exception for unresolved imports.

    Desired behavior:

    • When the page or server build fails with one or more UNRESOLVED_IMPORT diagnostics, the failure names each missing specifier and its importer, repo-relative. Use the first line of each diagnostic with ANSI escapes stripped, and keep the hint to run pnpm exec vite build. Show at most the first few, then say how many more there are. No code frames, stacks or absolute paths.
    • Every other failure keeps today's generic message, including PLUGIN_ERROR, config-load throws, config syntax errors and non-Error throws. A plugin's thrown text can contain anything, so it stays out.
    • Existing LocalError refusals (import_refused, toolchain_unsupported, invalid_manifest) are unchanged. No new code; ADR-0004 allows build failures without one.
    • Tier 2's server build runs through the same child and gets the same behavior.
    • ADR-0004's sentence on compiler/build failures states the exception: unresolved imports are named; other raw tool output stays outside the failure envelope.

    Key interfaces:

    • The builder child's stdout reply { ok: false, error, code? }: only the error string changes. The reply is a private protocol across releases, so keep its shape.
    • The aggregate build error's errors[] entries (code, message, id, loc): select on code === "UNRESOLVED_IMPORT". The aggregate's own first line is only "Build failed with N error(s)" and doesn't name the file.
    • stripVTControlCharacters from node:util for the ANSI codes Rolldown emits even without a TTY.

    Acceptance criteria:

    • A tier 1 repo whose src/main.tsx imports a missing ../patchy/_generated/logo.svg: patchy publish --json exits 1 with empty stdout; the stderr document's error contains ../patchy/_generated/logo.svg and src/main.tsx and no ANSI escapes; no /api/publish request is made. Text mode prints the same message.
    • A Vite plugin whose transform hook throws a marker string still produces the generic message, and the marker never reaches stderr. Add it beside the existing "keeps … failure diagnostics out of the public envelope" cases.
    • The existing suppression cases (patchy.config.ts, vite.config.ts, and the src/main.ts row, which exercises the typecheck stage because the tier 1 starter's entry is src/main.tsx) still pass unchanged.
    • ADR-0004 states the unresolved-import exception.

    Out of scope:

    • Making tsc catch a missing asset. vite/client's ambient declare module "*.svg" matches any specifier without checking the file exists, and allowArbitraryExtensions / noUncheckedSideEffectImports don't change that.
    • Summarizing tsc failures; typecheck output stays suppressed.
    • Tier 0: a missing <img src="/patchy/_generated/logo.svg"> is rejected by the bundle completeness check as <img> src is not embedded without the URL. Separate concern; not filed.
    • patchy dev: Vite's watcher already writes the full diagnostic to the dev log (patchy dev logs).
    • A logo-specific publish preflight.
  3. added
    enhancement
    ready-for-agent
    area:docs
    and removed
    needs-triage
    on Oct 9, 2026
  4. added a commit that references this issue on Oct 15, 2026
    74179dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:docsenhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions