authz-schema-sync
Sync packages/authz-rpc with lightbridge-authz's authz.cstack schema and regenerate the TypeScript client. Use whenever a task mentions a new or changed RPC procedure, cratestack, authz.cstack, genera
SKILL.md.claude/skills/authz-schema-sync/SKILL.md
GitHubSyncing the authz RPC schema
packages/authz-rpc/generated/ is gitignored and cratestack-generated. Never hand-edit it,
and never assume a warm local tree proves anything about CI.
Backend source of truth: lightbridge-authz's schema/authz.cstack on its main branch.
The sequence
1. Copy the schema from lightbridge-authz main
# From a lightbridge-authz checkout, read main directly — do not trust a feature branch
git -C /Users/selast/dev/gis/lightbridge-authz show origin/main:schema/authz.cstack \
> packages/authz-rpc/schema/authz.cstack
If the procedure you need is not in origin/main yet, stop: the console cannot ship against a
schema the backend has not merged. Say so and take the dependency.
2. Wipe and regenerate — wipe is not optional
rm -rf packages/authz-rpc/generated
pnpm --filter @lightbridge/authz-rpc codegen
The generator does not remove files for symbols that disappeared. Regenerating over a populated directory leaves orphans that still typecheck locally and do not exist in CI.
3. Fix the Create*Input helpers
The TypeScript codegen keeps @readonly fields required on Create*Input, unlike the Rust
side. Every build*Input helper in apps/console/src/containers/build-create-*.ts exists to paper
over exactly that. After a schema change, re-check them — a new @readonly field is a new required
property the console must supply or the build breaks.
4. Typecheck the whole workspace, not just the package
pnpm -r typecheck
pnpm --filter @lightbridge/authz-rpc test
pnpm --filter console test
pnpm --filter console build:web
The CI trap this skill exists for
generated/ is gitignored and postinstall runs codegen:all, which means:
- A warm local tree keeps working after a generator version bump, because the old output is still on disk.
- CI is always cold, so it regenerates with the new generator and breaks.
After any bump of @cratestack/cli or @cratestack/api/@cratestack/cbor, you must
rm -rf packages/authz-rpc/generated, regenerate, and run the real build. A green
pnpm -r typecheck on a warm tree proves nothing about that bump.
The same applies to packages/api-rest (Hey API / OpenAPI): also generated, also do-not-hand-edit.
Pitfalls
pnpm installruns codegen viapostinstall. Ifgenerated/is missing after a fresh clone and typecheck fails, runpnpm --filter @lightbridge/authz-rpc codegenbefore debugging anything else.- A version bump must move
@cratestack/cli,@cratestack/apiand@cratestack/cbortogether. They are pinned to the same version on purpose. normalize-generated-specifiers.mjsruns after the generator and is part of the script — do not invokecratestack generate-typescriptalone.- Do not commit
generated/to "fix CI". The gitignore is deliberate; the fix is making the cold path work. - A procedure existing in the schema does not mean the console may call it. Check the gate
(
docs/knowledge/authorization-and-permissions.md) and add the permission toapps/console/src/shared/permissions.tsif the screen needs one.