Repository navigation
Conversation
…again A host's API structure carries settings the loaders resolved: CORS origins, auth, RLS, database, pubkey and WebAuthn settings. Each loader keeps its own cache (5 minutes for CORS, 1 minute for the others), and flushService only evicted the host. A host rebuilt within that time took the loaders' old copy and kept it for as long as the host stays cached. So a database whose CORS list gained an origin kept refusing it on every host read in the 5 minutes before the write, even after a schema:update: a new app's deployed site could not sign up through its auth host (constructive-planning#2539). flushService, flushAllServices and the authenticated /flush now clear the settings loaders for the database (or for all) before they evict its hosts.
|
Review complete. No issues found — approved ✅. This change introduces a flush middleware ( Reviewed commit: 368666d |
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.
Fixes the constructive half of constructive-io/constructive-planning#2539: a change to a database's CORS list (or its other API settings) can stay invisible on some of its hosts after a flush.
Why a flush wasn't enough
resolveModuleSettings): CORS origins, auth, RLS, database, pubkey and WebAuthn settings. The structure is cached per host insvcCache.corsOrigins, 1 minute for the others.flushServiceevicted the hosts but left the loader caches. A host rebuilt in that window got the loaders' old copy, and kept it as long as the host stayed cached.On devnet this blocked sign-up on every new Desktop app's deployed site:
auth-andapi-<db>refused the site's origin whileadmin-<db>allowed it.Change
invalidateApiSettings(databaseId?)inmiddleware/api.tsclears the loader registry the host builds read.flushService(schema:update),flushAllServices(listener reconnect) and the authenticated/flushcall it before they evict hosts.The other half of #2539, sending
schema:updatefrom the settings tables themselves, belongs in constructive-db. Until it lands, Desktop keeps writing a route back to trigger the flush.🤖 Generated with Claude Code
https://claude.ai/code/session_017WbsG8xSPVNk24sN2QThLw