This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(create-plugin): refuse an unoffered licence id instead of answering it with MIT text (objectui#8892) - #8998
Merged
Conversation
…ng it with MIT text (objectui#8892) `buildLicenseFile`'s docblock declared one state unreachable — "a manifest claiming a licence with no text beside it" — and defended the MIT fallback as what kept it so, ending "the manifest is written from the same resolved id, so the two still agree." That last sentence was false, and the fallback made a worse state reachable in its place. `vars.license` reaches a scaffolded plugin through SIX statements and `buildLicenseFile` is the only one that resolves it: `buildPackageJson`, `buildReadme` and the four source-file headers interpolate it verbatim. Measured on 4d65991 with `license: 'NOT-A-LICENCE'`, `buildPluginFiles` returned a plugin whose manifest, README and four headers all named `NOT-A-LICENCE` while the LICENSE beside them carried the MIT text — the disagreement the author then carries into their own distribution. Agreement cannot be restored at this one end for the other five, so the id is refused for all six. Refusing costs nothing the fallback bought: `resolveLicenseId` is total onto the offered ids and `index.ts` is the only caller, so the CLI cannot produce the throw; nothing outside the package can call it at all (`bin` only, no `exports`/`main`/`types`, one bundled `dist/index.js`); and `buildPluginFiles` runs before anything is created on disk (objectui#8786), so the throw lands on a run that has written nothing. The docblock is rewritten to describe the refusal, not to describe the old behaviour — the triage ruling is explicit that making the prose match the defect would preserve it while removing the only signal that it is one. Tests: the pin that asserted the MIT fallback is replaced by one asserting the refusal names the offending id, names every offered id, and emits NO file at all. A new end-to-end case drives the built bin into a scratch directory, selects a NON-default licence, and asserts all six statements agree as a relation read back off the emitted manifest — every other run in that file ends at MIT, so a template hard-coding "MIT" was green in all of them. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MPaVWWMuWeT5LgB1qoXjVB
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
os-steve
marked this pull request as ready for review
September 10, 2026 16:39
This was referenced Sep 10, 2026
This was referenced Sep 10, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #8892
The contract, and what the code did
buildLicenseFile's docblock declared one state unreachable — "a manifest claiming a licence with no text beside it" — and defended the MIT fallback as what kept it so, ending: "the manifest is written from the same resolved id, so the two still agree." That last sentence was false, and the fallback made a worse state reachable in its place.Per the triage ruling the disagreement is fixed, not the docblock. The docblock here is rewritten to describe the refusal that replaces the fallback — never to describe the defect.
Both code paths — and the assumption that was falsified
The dispatching seat assumed two paths that can disagree only via the fallback. Measured on
4d65991c5, it is five against one, not one against one.vars.licensereaches a scaffolded plugin through six statements; exactly one of them resolves the id:vars.licensepackage.jsonlicensefieldbuildPackageJsonREADME.md## LicenselinebuildReadmesrc/index.tsxheaderbuildIndexFilesrc/NAMEImpl.tsxheaderbuildImplFilesrc/types.tsheaderbuildTypesFilesrc/NAMEImpl.test.tsxheaderbuildTestFileLICENSEbuildLicenseFileThere is no second divergence point; there are four additional divergent outputs sharing the same one point. Measured directly against
origin/main, withlicense: 'NOT-A-LICENCE':Is the unoffered id reachable? Measured, not assumed
index.tspassesresolveLicenseId(answers.license), total onto the four offered ids; there is no--licenseflag (commander declares only-d/--descriptionand-a/--author).package.jsondeclaresbinonly — noexports, nomain, nomodule, notypes— andtsupemits a single bundleddist/index.js(plus a 20-byteindex.d.tsthat is just the shebang). Probed with the package linked into a scratch consumer: a bareimportand a deepdist/templates.jsimport both giveERR_MODULE_NOT_FOUND.PluginTemplateVarsby hand — today the tests, tomorrow a future in-repo caller or a--licenseflag wired pastresolveLicenseId.⇒ This falsifies the card's stated cost for direction 2 ("changes a published function's failure mode"): there is no published function to change.
Which fix, and why
Direction 2 — refuse the unoffered id — not direction 1 (resolve a second time inside
buildPackageJson). Three reasons:resolveLicenseId) is already total; the consumer-side??was the defect.Refusing costs nothing the fallback bought: the CLI cannot produce the throw, nothing outside the package can call it, and
buildPluginFilesruns beforeindex.tscreates anything on disk (objectui#8786), so the throw lands on a run that has written nothing rather than half a plugin.Tests
cli-cancel-and-nontty-8786.test.ts): drives the builtdist/index.jsinto a scratch cwd under a pty, selects a non-default licence (one arrow-down off MIT), and asserts the six statements agree as a relation read back off the emitted manifest — not compared to a constant. Every other run in that file ends at MIT, so a template hard-coding "MIT" in five of the six places was green in all of them. It shares that file's single unconditionalbeforeAllbuild on purpose: vitest runs test files in parallel worker threads (pool: 'threads',isolate: true) andtsupcleansdist/before writing, so a second file building this package would delete the bin out from under these runs.licenses.test.ts): the pin that asserted the MIT fallback pinned exactly the branch this PR deletes, so it is replaced rather than edited. The replacement asserts the refusal names the offending id, names every offered id, points atresolveLicenseId— and, the point of the card, that nothing at all is emitted. A bare.toThrow()would be green on both sides: the pre-fix code also threw here, for a different reason and with a message naming neither the offending id nor a way out.Ablation — two arms, both predicted before running
Each arm: mutate, prove it landed on disk (occurrence counts of injected and removed text), run, restore, prove the restore landed (
git hash-objectagainst the HEAD blob and an emptygit diff HEAD). Restore isgit checkout HEAD -- PATHwith absolute paths in anEXIT INT TERMtrap.buildLicenseFile1 failed | 37 passed— the refusal test; all 8 spawn tests greenindex.tsignores the licence answer1 failed | 37 passed— the end-to-end test; every unit test greenArm A's narrowness is the finding, not a weak test: the eight spawn tests staying green is the measurement that the defect is unreachable from the CLI. Arm B exists because arm A cannot witness the end-to-end assertion — its mutation was confirmed to reach
dist/index.js(the suite rebuilds it unconditionally), and it reddens only the end-to-end case, proving that assertion catches a divergence no builder-level test can see.Gates
Exit codes captured to disk before reading, never through a pipe.
pnpm exec vitest run packages/create-plugin/(repo root)3 files / 38 testsscripts/__tests__files that read this tree5 files / 76 testspnpm --filter @object-ui/create-plugin run type-checktsc --noEmit+tsconfig.test.jsonpnpm --filter @object-ui/create-plugin run lintcheck-control-bytes.mjscheck-changeset-presence.mjscheck-governed-queue-guard.mjs --test(my four paths)check:doc-snippetscheck:doc-examples124 blocks — 35 compile, 89 fail, 89 declared in the ledgercheck:doc-typescheck:new-line-citations0 new citation(s)Heavy runs went through
../objectstack/scripts/pm/os-verify-lock.sh(slotobjectui-8892); every verdict above is the wrapper's ownVERDICT command-exitline.Serial adjacency — re-derived here, not cited
Enumerated all 11 currently-open PRs and read each one's file list: none touches
packages/create-plugin/or this changeset. objectui#8778 has no open PR, so the emitted-template surface is uncontended — and its copyright-header block is untouched by this diff.origin/mainhad not moved from the branch point when this was pushed.Out of scope, noted and not filed
scripts/__tests__/one-authority-per-exported-name-6273.test.tscarries a provenance comment citingcreate-plugin/src/templates.ts:417; that line has never held the quoted text (checked at the branch point, before this diff). A stale pointer in a fixture comment — no behaviour, no reproduction, andcheck:new-line-citationsexplicitly warns against shifting existing addresses by a hunk delta. Nobody is queued on that file. Left alone deliberately.Session reference, as a code span so it survives a body edit:
https://claude.ai/code/session_01MPaVWWMuWeT5LgB1qoXjVB🤖 Generated with Claude Code
https://claude.ai/code/session_01MPaVWWMuWeT5LgB1qoXjVB
Generated by Claude Code