Skip to content

fix(patchy): publish names the import the build can't resolve - #686

Merged
allisonmahmood merged 2 commits into
mainfrom
fix/596-publish-names-unresolved-import
Oct 15, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
fix/596-publish-names-unresolved-import

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

A page that imports a file the build can't find, most often patchy/_generated/logo.svg after a company look revision drops its logo, passes tsc and then fails patchy publish with only "Vite build failed". Nothing says which import or which file, so the agent has to rerun Vite by hand to find out.

The builder child now reads Vite 8's aggregate build error. For each UNRESOLVED_IMPORT diagnostic it takes the first line ([UNRESOLVED_IMPORT] Could not resolve '<import>' in <file>), strips ANSI and the repo's own path, and names up to three, then counts the rest. The pnpm exec vite build hint stays. Everything else keeps today's generic message: plugin errors, config throws, non-Error throws and tsc output. Patchy's own refusals (import_refused, toolchain_unsupported, invalid_manifest) are unchanged. The child's reply keeps its { ok: false, error, code? } shape, and tier 2's server build goes through the same path.

Tested by hand

On this worktree's brightline environment, through its installed CLI. An admin published a look with a logo. Kudos (tier 1) imported ../patchy/_generated/logo.svg in src/App.tsx and published fine. Then the admin published a revision with no logo, and Kudos refreshed.

Before:

$ patchy publish
Vite build failed. Run `pnpm exec vite build` and fix the single-file build before publishing.
exit=1
$ patchy publish --json        # stdout empty
{"ok":false,"error":"Vite build failed. Run `pnpm exec vite build` and fix the single-file build before publishing.","kind":"local"}
exit=1

After:

$ patchy publish
Vite build failed:
- [UNRESOLVED_IMPORT] Could not resolve '../patchy/_generated/logo.svg' in src/App.tsx
Run `pnpm exec vite build` and fix the single-file build before publishing.
exit=1
$ patchy publish --json        # stdout empty, no ANSI escapes
{"ok":false,"error":"Vite build failed:\n- [UNRESOLVED_IMPORT] Could not resolve '../patchy/_generated/logo.svg' in src/App.tsx\nRun `pnpm exec vite build` and fix the single-file build before publishing.","kind":"local"}
exit=1

Tier 2 server graph: New Business's server/deals.ts imports a missing ../helpers/stage-rules.js. Before, it got the same generic line. After:

{"ok":false,"error":"Vite build failed:\n- [UNRESOLVED_IMPORT] Could not resolve '../helpers/stage-rules.js' in server/deals.ts\nRun `pnpm exec vite build` and fix the single-file build before publishing.","kind":"local"}

An absolute import of a missing <repo>/src/brand/logo.svg names it repo-relative, with no machine path:

{"ok":false,"error":"Vite build failed:\n- [UNRESOLVED_IMPORT] Could not resolve 'src/brand/logo.svg' in src/App.tsx\nRun `pnpm exec vite build` and fix the single-file build before publishing.","kind":"local"}

A plugin whose transform throws private-diagnostic-marker still gets only the generic message, and the marker never reaches stderr. The "after" outputs are from the final commit.

Surfaces

  • CLI: only the error text changed. There's no new code, flag or exit code, and text and --json print the same message. packages/patchy/README.md (repo publish) and ADR-0004 (its sentence on compiler/build failures) now state the exception.
  • Skills: the global patchy skill and patchy-look still read correctly, so neither changed.
  • Wire contract, dev loop, vocabulary, migrations: not touched.

Tests

These sit beside the existing "keeps … failure diagnostics out of the public envelope" cases in cliRepoRecovery.test.ts:

  • A missing logo import produces the exact message in --json and text, with no /api/publish request.
  • Five absolute missing imports name three without the repo path, then say "and 2 more".
  • Two new suppression rows: a throwing transform hook, and a non-Error throw shaped like Vite's aggregate. Both vite.config.ts rows now assert the exact generic message.

Closes #596

Made by Claude Opus 5.5 in Claude Code, running in T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

GPT 6.1 Sol review (codex, xhigh), two passes:

  1. Medium: an absolute missing specifier printed the repo's absolute path. Fixed in b124517: the line drops the repo root, and the overflow test imports absolute paths and asserts the root never appears.
  2. Medium: a non-Error throw shaped like Vite's aggregate passed the structural guard and leaked its text. Fixed in b124517: only an Error is read; a new suppression row throws that shape from a config hook.
  3. Low: the plugin row didn't prove the message was unchanged. Fixed in b124517: both vite.config.ts rows assert the exact generic message.

Second pass on the fix commit: all three fixed, nothing new.

@github-actions github-actions Bot added area:cli Touches the cli area area:docs Touches the docs area size:m 100-500 changed lines labels Oct 15, 2026
A page importing a file that no longer exists, such as a logo a later
company look dropped, failed publish with a generic Vite message. The
builder child now names each unresolved import and its importer from
Rolldown's diagnostics, at most three plus a count; other tool output
stays out of the envelope. ADR-0004 and the CLI README state the
exception.

Closes #596

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… imports

Strip the repo's own path from an unresolved import's line, so an
absolute specifier never prints it, and read Vite's aggregate only
from an Error. Both vite.config.ts suppression rows now assert the
generic message, beside a new non-Error row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the fix/596-publish-names-unresolved-import branch from b124517 to 5d78cde Compare October 15, 2026 19:16
@allisonmahmood
allisonmahmood merged commit 298ec0d into main Oct 15, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the fix/596-publish-names-unresolved-import branch October 15, 2026 19:26
allisonmahmood added a commit that referenced this pull request Oct 16, 2026
…u when they fail (#720)

Release 13's What's new entry, written from `c9b8fc4`, ahead of
deploying it. `patchy` and `CURRENT_RELEASE` move to `0.13.0`, so CLIs
and patch repos installed before this deploy are told to upgrade.

| Change | PRs |
| --- | --- |
| New: Home puts the patches you use first | #713, #716, #719 |
| New: Every patch in one list | #715 |
| Improved: Each patch's page leads with Open | #717 |
| New: See when your tools are failing | #718 |
| Fixed: Everyone has a name | #687 |
| Improved: Your company's look is easier to get right | #697, #696,
#703, #688 |
| Improved: Forms follow your look's error states | #691, #692 |
| Improved: Clearer answers when a publish goes wrong | #686, #685, #689
|
| Fixed: Your agent's Patchy commands are steadier | #695, #704, #680,
#681 |
| Behind the scenes: stricter checks on static pages and tools' database
requests; malformed requests are logged | #682, #693, #683 |
| Behind the scenes: usage numbers count every publish, sharing change
and restore | #698, #699, #700, #690 |
| Test and tooling only, no line | #705, #702, #701, #694, #684, #607 |

Made by Claude Opus 5.5 in Claude Code, running in T3 Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Touches the cli area area:docs Touches the docs area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant