Repository navigation
[AI Improvement] [Task] Compile Auth Emulator OpenAPI validators lazily (lazyCompileValidationSchemas) to cut ~10 s per createApp() - #11176
Merged
joehan merged 9 commits intoNov 5, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request configures the exegesisExpress middleware in the Auth emulator server to compile validation schemas lazily by setting lazyCompileValidationSchemas to true. This optimization avoids the eager compilation of the 386 KB Identity Toolkit specification, reducing startup time and speeding up unit tests. There are no review comments, and I have no feedback to provide.
joehan
marked this pull request as ready for review
November 5, 2026 00:43
shettyvarun268
approved these changes
Nov 5, 2026
shettyvarun268
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Two small things, both non-blocking:
- Since this makes the Auth emulator start faster on
firebase emulators:startand that seems like a user facing change, should we add a CHANGELOG line? Something like:- Improved Auth emulator startup time by compiling validation schemas lazily. - With lazy compile, a bad schema in a future regenerated
apiSpec.tswould only show up as a 500 on the first request to that endpoint instead of failing at startup. Might be worth a follow-up test that compiles all validators once so CI still catches that.
Member
Author
Both good points - will address in the PR before merging. |
…11370) * refactor(functions): add KitSourceAdapter for npm and directory kits * refactor(functions): decouple createdPaths and inline adapter selection * test(functions): clean up overfitted adapter tests and simplify directory adapter signature
…11418) ### Description Part 1 of 3 (stacked) for seamless App Check debug tokens (go/firebase-api-sdk-cli-seamless-debug-tokens). `appcheck:debugtokens:create` now saves the token to `~/.config/configstore/firebase-appcheck.json` so local client SDKs and build plugins can discover it without copy-pasting from the Console. - **`src/appcheck/localConfig.ts`**: reads/writes `firebase-appcheck.json` (tokens keyed by GMP App ID, plus the optional server resource name under `tokenNames`), mirroring to an absolute `$XDG_CONFIG_HOME` when it differs from `~/.config`. Reads JSON directly so a malformed file raises an actionable error instead of being wiped by `Configstore`. - **`appcheck:debugtokens:create`**: - Saves locally by default; `--no-save-local` opts out (for CI/remote tokens). - Defaults `--display-name` to `<username>@<hostname>` (bounded to the backend's 50-char limit), or `CLI Debug Token (<shortHost>)` with `--no-save-local` so CI tokens don't replace the host's own token. - Validates UUID v4 / display name before any API call, respects the 20-token limit, creates the replacement before deleting the old token, includes `token` in `--json` output, and prints `.env.local` snippets for Web apps. ### Scenarios Tested - `npx mocha 'src/appcheck/**/*.spec.ts' 'src/commands/appcheck*.spec.ts'` - `npm run build`, `npm run test:compile`, lint, prettier. ### Sample Commands ```bash firebase appcheck:debugtokens:create --app 1:1234567890:ios:abcdef firebase appcheck:debugtokens:create --app 1:1234567890:web:abcdef --display-name "github-actions" --no-save-local --force --json ```
### Description Part 2 of 3 (stacked on #11418) for seamless App Check debug tokens (go/firebase-api-sdk-cli-seamless-debug-tokens). `appcheck:debugtokens:list --local` lists debug tokens saved in `~/.config/configstore/firebase-appcheck.json` as a table of App ID, token prefix, and server status (optionally filtered by `--app`). It works offline (`Unchecked`) and, when authenticated with an active project, reports `Active`, `Revoked`, or `App Deleted`. Without `--local`, `list` is unchanged. ### Scenarios Tested - `npx mocha 'src/appcheck/**/*.spec.ts' 'src/commands/appcheck*.spec.ts'` - `npm run build`, `npm run test:compile`, lint, prettier. ### Sample Commands ```bash firebase appcheck:debugtokens:list --local firebase appcheck:debugtokens:list --local --app 1:1234567890:ios:abcdef ```
…elete (#11421) ### Description Part 3 of 3 (stacked on the `list --local` PR) for seamless App Check debug tokens (go/firebase-api-sdk-cli-seamless-debug-tokens). - **`appcheck:debugtokens:prune`**: removes local entries in `~/.config/configstore/firebase-appcheck.json` for the active project whose app was deleted or whose token was revoked on the server. Prompts for confirmation unless `--force`, and states that server-registered tokens are untouched. - **`appcheck:debugtokens:delete`**: also removes the matching local entry when deleting this machine's server token; uses `.withForce()`. ### Scenarios Tested - `npx mocha 'src/appcheck/**/*.spec.ts' 'src/commands/appcheck*.spec.ts' 'src/commands/index.spec.ts'` - `npm run build`, `npm run test:compile`, lint, prettier. ### Sample Commands ```bash firebase appcheck:debugtokens:prune firebase appcheck:debugtokens:prune --force ```
- Add CHANGELOG entry for lazy OpenAPI validation schema compilation. - Export specForRouter() and support CreateAppOptions in createApp() to allow schema compilation override. - Add unit test in rest.spec.ts eagerly compiling all OpenAPI validation schemas to catch spec regressions in CI.
Member
Author
|
Addressed both points in commit
|
joehan
enabled auto-merge (squash)
November 5, 2026 22:36
…task-compile-auth-emulator-openapi- # Conflicts: # CHANGELOG.md
joehan
deleted the
ai-improve-566319964-task-compile-auth-emulator-openapi-
branch
November 5, 2026 23:09
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves Buganizer b/566319964 (parent goal b/566303602)
Proposed Improvement
Pass
lazyCompileValidationSchemas: trueinexegesisExpress.middleware(specForRouter(), { ... })insidecreateApp()insrc/emulator/auth/server.ts.By default, Exegesis eagerly compiles ajv validation schemas for every operation in the 386 KB Identity Toolkit spec at startup, which takes ~10-24 seconds per
createApp()invocation. The unit test suite creates one app per mode (NO_WARNINGandERROR), andfirebase emulators:start --only authpays for this compilation once on startup. EnablinglazyCompileValidationSchemas: truedefers ajv compilation of an operation's schema until that route is first requested.Verification
npx mocha 'src/emulator/auth/**/*.spec.ts'):singleProjectMode=ERRORduring eager schema compilation), taking >3 minutes.npm run lint:quietand prettier check passed cleanly.