Skip to content

feat(registry): verify declared actions and i18n keys at publish - #46

Merged
maxscharwath merged 3 commits into
mainfrom
feat/declared-actions-manifest
Jul 5, 2026
Merged

feat(registry): verify declared actions and i18n keys at publish#46
maxscharwath merged 3 commits into
mainfrom
feat/declared-actions-manifest

Conversation

@maxscharwath

Copy link
Copy Markdown
Collaborator

Companion to brikalabs/brika#136: the registry now independently re-derives and verifies what the author's build declared.

What this does

  • Pins @brika/compiler@0.4.0-57e2df6836d4 (nightly from the brika branch). The gate report's ActionEntry renamed actionIdid; the registry's ActionEntry parses both keys, so version rows published before the rename keep serving through the report API while new publishes persist the new shape.
  • Actions drift gate: brika build writes discovered actions into the manifest's actions[] using the exact same static scan the publish gate re-runs over the untarred sources, so declared and re-derived must agree entry for entry (id + file + name). Manifests without an actions[] array (older toolchains) are exempt. A mismatch rejects with a "run brika build and republish" message naming the offending action.
  • i18n usage gate: the compiler's edge-safe analyzeI18nUsage runs in the Worker over the tarball sources and the bundled locales/<lang>/*.json (deep-merged with hub semantics). A t() key the code references that exists in NO locale rejects the publish — it would render raw at runtime. No locales bundled → gate skipped; warnings (unresolvable calls, stale keys) never gate.
  • Schema fork sync: ActionSchema + declared-action file backing (earlier commit on this branch), plus blocks[].fields and the localized readme map so z.object parsing no longer strips them.

Verification

  • 827 tests green (9 new: drift accept/reject both directions, i18n reject/accept/skip, legacy ActionEntry migration, D1 round-trip on the new shape), typecheck and biome clean.
  • The pre-existing Playwright specs still don't run under bun test (unrelated; they need the Playwright runner).

brika build now declares server actions as {id,file,name} entries (id is the
12-hex computeActionId hash). The publish schema validates the shape and
validateManifestCapabilities checks each declared action's source file is
present in the tarball, using the exact path the entry names.
Bumps @brika/compiler to nightly 0.4.0-57e2df6836d4 (the gate report's
ActionEntry now carries the id under 'id'; ActionEntry parses both keys so
pre-rename rows keep serving, and the report persists the new shape).

Two new publish rejections in the manifest validator:
- actions drift: brika build declares the discovered actions in the
  manifest's actions[] with the exact scan the gate re-runs, so declared and
  re-derived must agree entry for entry. An absent array (pre-collection
  toolchain) is exempt; a present one that disagrees means the manifest was
  built against different sources.
- i18n usage: every i18n key the plugin's code statically references must
  exist in some bundled locale (the same edge-safe analyzeI18nUsage that
  brika verify runs); a missing key would render raw at runtime. Skipped when
  the plugin bundles no locales; warnings do not gate.

Also syncs the schema fork with blocks[].fields and the localized readme map
so parsing no longer strips them.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
brika-store ec6d3c2 Jul 05 2026, 04:03 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
brika-registry ec6d3c2 Jul 05 2026, 04:03 PM

@maxscharwath maxscharwath changed the title Registry verifies declared actions and i18n keys at publish feat(registry): verify declared actions and i18n keys at publish Jul 5, 2026
Sonar new-code gate: validate's cognitive complexity dropped back under the
threshold by moving the bundle gate + actions drift + i18n usage checks into
runCompileGates, and the drift lookups use find instead of filter[0].
@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@maxscharwath
maxscharwath merged commit 8ea6821 into main Jul 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant