Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

fix(create-plugin): refuse an unoffered licence id instead of answering it with MIT text (objectui#8892) - #8998

Merged
os-steve merged 1 commit into
mainfrom
claude/issue-8892-license-manifest-agreement
Sep 10, 2026
Merged

os-steve merged 1 commit into
mainfrom
claude/issue-8892-license-manifest-agreement

Conversation

@os-steve

Copy link
Copy Markdown
Collaborator

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.license reaches a scaffolded plugin through six statements; exactly one of them resolves the id:

Emitted statement Builder Treatment of vars.license
package.json license field buildPackageJson verbatim
README.md ## License line buildReadme verbatim
src/index.tsx header buildIndexFile verbatim
src/NAMEImpl.tsx header buildImplFile verbatim
src/types.ts header buildTypesFile verbatim
src/NAMEImpl.test.tsx header buildTestFile verbatim
LICENSE buildLicenseFile totalised — the divergence point

There is no second divergence point; there are four additional divergent outputs sharing the same one point. Measured directly against origin/main, with license: 'NOT-A-LICENCE':

manifest.license           = "NOT-A-LICENCE"
README ## License line     = "NOT-A-LICENCE © Jane Doe"
header src/index.tsx       = "licensed under the NOT-A-LICENCE license"
header src/HeatmapImpl.tsx = "licensed under the NOT-A-LICENCE license"
header src/types.ts        = "licensed under the NOT-A-LICENCE license"
header src/HeatmapImpl.test.tsx = "licensed under the NOT-A-LICENCE license"
LICENSE first line         = "MIT License"

Is the unoffered id reachable? Measured, not assumed

  • Not from the CLI. index.ts passes resolveLicenseId(answers.license), total onto the four offered ids; there is no --license flag (commander declares only -d/--description and -a/--author).
  • Not from any import. package.json declares bin only — no exports, no main, no module, no types — and tsup emits a single bundled dist/index.js (plus a 20-byte index.d.ts that is just the shebang). Probed with the package linked into a scratch consumer: a bare import and a deep dist/templates.js import both give ERR_MODULE_NOT_FOUND.
  • Reachable only from an in-repo caller that builds PluginTemplateVars by hand — today the tests, tomorrow a future in-repo caller or a --license flag wired past resolveLicenseId.

⇒ 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:

  1. Direction 1 repairs 1 of 6. It would leave the README and four source headers still naming an id the LICENSE beside them does not carry — the same defect one file over.
  2. Four of the five it cannot repair are the copyright-header block, which objectui#8778 queues behind this card and whose direction is unruled. Refusal closes all six at one point and touches none of that surface.
  3. AGENTS.md #0.1 (contract-first). Silently rewriting a caller's declared id into MIT across six emitted files is exactly the lenient coercion that rule bans. The producer (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 buildPluginFiles runs before index.ts creates anything on disk (objectui#8786), so the throw lands on a run that has written nothing rather than half a plugin.

Tests

  • End-to-end, the real scaffolder (cli-cancel-and-nontty-8786.test.ts): drives the built dist/index.js into 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 unconditional beforeAll build on purpose: vitest runs test files in parallel worker threads (pool: 'threads', isolate: true) and tsup cleans dist/ before writing, so a second file building this package would delete the bin out from under these runs.
  • Refusal (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 at resolveLicenseId — 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-object against the HEAD blob and an empty git diff HEAD). Restore is git checkout HEAD -- PATH with absolute paths in an EXIT INT TERM trap.

Arm Mutation Predicted Observed
A reinstate the deleted MIT fallback in buildLicenseFile only the new refusal test reddens; all 8 spawn tests stay green 1 failed | 37 passed — the refusal test; all 8 spawn tests green
B index.ts ignores the licence answer only the new end-to-end test reddens; every unit test stays green 1 failed | 37 passed — the end-to-end test; every unit test green

Arm 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.

Gate Exit Note
pnpm exec vitest run packages/create-plugin/ (repo root) 0 3 files / 38 tests
affected suite + the two scripts/__tests__ files that read this tree 0 5 files / 76 tests
pnpm --filter @object-ui/create-plugin run type-check 0 tsc --noEmit + tsconfig.test.json
pnpm --filter @object-ui/create-plugin run lint 0
check-control-bytes.mjs 0 plus a direct control-byte scan of the four changed files: no hits
check-changeset-presence.mjs 0 1 changeset declared for 3 published source files
check-governed-queue-guard.mjs --test (my four paths) 0 NOT GOVERNED — ordinary merge-queue route
check:doc-snippets 2 then 0 exit 2 was PREREQUISITE NOT MET; re-run green after the scoped build it names (35 tasks, 6m38s)
check:doc-examples 2 then 0 same prerequisite, same scoped build; 124 blocks — 35 compile, 89 fail, 89 declared in the ledger
check:doc-types 0
check:new-line-citations 0 0 new citation(s)

Heavy runs went through ../objectstack/scripts/pm/os-verify-lock.sh (slot objectui-8892); every verdict above is the wrapper's own VERDICT command-exit line.

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/main had 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.ts carries a provenance comment citing create-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, and check:new-line-citations explicitly 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

…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
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 50 chunks) 3484.4 KB 3512.7 KB
Main entry chunk (gzip) 144.2 KB 350 KB
Entry file index-DrRYIWul.js —
Status PASS —

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

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 16.69KB 6.21KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.06KB 3.86KB
auth (ActiveOrganizationStorage.js) 25.05KB 9.16KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.18KB 10.59KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.15KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.65KB 2.22KB
auth (SocialSignInButtons.js) 9.61KB 3.89KB
auth (UserMenu.js) 3.41KB 1.23KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.21KB 10.80KB
auth (createAuthenticatedFetch.js) 8.46KB 3.43KB
auth (index.js) 3.19KB 1.44KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 26.08KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 500.20KB 114.67KB
core (index.js) 7.95KB 3.19KB
create-plugin (index.js) 28.21KB 9.54KB
data-objectstack (index.js) 206.14KB 56.97KB
fields (index.js) 247.01KB 62.29KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 1.22KB 0.64KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 6.57KB 2.76KB
i18n (index.js) 3.65KB 1.47KB
i18n (pickLocalized.js) 7.62KB 3.26KB
i18n (provider.js) 26.89KB 9.04KB
i18n (useDisplayLocale.js) 2.85KB 1.45KB
i18n (useObjectLabel.js) 34.34KB 9.17KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 38.84KB 10.94KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 4.39KB 1.66KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.52KB 4.88KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.24KB 2.16KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.39KB 3.10KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 14.81KB 3.63KB
plugin-calendar (index.js) 49.03KB 13.93KB
plugin-charts (index.js) 71.63KB 19.99KB
plugin-chatbot (index.js) 195.32KB 46.51KB
plugin-dashboard (index.js) 132.41KB 34.84KB
plugin-designer (index.js) 215.68KB 44.27KB
plugin-detail (index.js) 253.71KB 65.78KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 136.79KB 34.19KB
plugin-gantt (index.js) 166.65KB 40.91KB
plugin-grid (index.js) 210.87KB 57.30KB
plugin-kanban (index.js) 46.03KB 14.30KB
plugin-list (index.js) 112.52KB 27.64KB
plugin-map (index.js) 20.49KB 6.83KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 43.42KB 11.92KB
plugin-timeline (index.js) 30.10KB 8.74KB
plugin-tree (index.js) 9.55KB 3.32KB
plugin-view (index.js) 84.42KB 20.80KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.66KB 3.50KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 83.34KB 27.61KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.63KB 2.18KB
react (schema-input.js) 2.32KB 1.24KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 6.58KB 2.74KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 5.66KB 2.50KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (kanban-quick-add.js) 3.89KB 1.87KB
sdui-parser (parse.js) 20.57KB 5.88KB
sdui-parser (provenance.js) 3.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 14.82KB 4.99KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 1.00KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 2.93KB 1.49KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 4.74KB 2.25KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 4.73KB 2.28KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 14.27KB 5.47KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(create-plugin): buildLicenseFile's MIT fallback lets the emitted manifest and LICENSE text disagree, against its own docblock

2 participants