Skip to content

canCall's role table shares one object per gate, so the index chunk carries no literal per op - #375

Merged
zlareb1 merged 3 commits into
mainfrom
perf/can-call-shared-gates
Nov 7, 2026
Merged

zlareb1 merged 3 commits into
mainfrom
perf/can-call-shared-gates

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The dashboard's index chunk is 2 kB smaller uncompressed, which keeps it under its bundle budget: its table of the role each operation needs shares one object per gate.

Why

OP_MIN_ROLE (frontend/src/lib/canCall.ts) sits in the index chunk, and each of its 72 entries was its own { min, by } object literal, which the minifier keeps per entry. The index chunk was 119.9 kB of its 120 kB budget, so the next few gated dashboard controls would each fail npm run budget.

Scope and risk

  • Four shared gates (VIEWER, WRITER, ADMIN, ADMIN_CLAIM), each an OpGate, whose fields are now readonly so no write can change every op sharing one; every entry names one. The table's keys and each op's role are unchanged, and canCall.test.ts still checks every namespace entry against the generated SDK's roles.
  • npm run budget, before → after: index … 119.9 kB → index … 117.9 kB (uncompressed, what the budget measures); boot scripts 185.7 kB gzipped → 185.5 kB gzipped.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: revert.

Tests

  • vitest src/lib and src/layout (551 pass), tsc -b, npm run budget, biome format and lint.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I checked the budget before and after.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

zlareb1 and others added 3 commits November 7, 2026 13:16
…nk carries no literal per op

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1 zlareb1 changed the title canCall's role table shares one gate object per role, so the boot chunk carries no literal per op canCall's role table shares one gate object per role, so the index chunk carries no literal per op Nov 7, 2026
@zlareb1 zlareb1 changed the title canCall's role table shares one gate object per role, so the index chunk carries no literal per op canCall's role table shares one object per gate, so the index chunk carries no literal per op Nov 7, 2026
@zlareb1
zlareb1 merged commit 3dc50a4 into main Nov 7, 2026
38 checks passed
@zlareb1
zlareb1 deleted the perf/can-call-shared-gates branch November 7, 2026 13:40
@zlareb1 zlareb1 mentioned this pull request Nov 12, 2026
3 tasks done
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