Repository navigation
feat: take the network ID from config and refuse to start on any doubt - #21
Merged
Merged
Conversation
Product Kratos releases must use the network that config names, never the oldest row in networks. Init now reads network.id (required except for migrate) and network.forbidden_id (optional), and fails fast on a missing, invalid, nil, forbidden or unknown network. No row is created. Claude-Session: https://claude.ai/code/session_01LdtTNtaWbgWyKokPFfvUL3
…etry checks A memory SQLite DSN lives only in this process, so nothing else can seed its networks row and every non-migrate command refused to start. Init now inserts the configured row for a memory DSN only, after all key checks, and logs a warning. Config-error tests run against an unreachable DSN and assert exact messages, so they fail if a check is removed or moved into the retry. The cleanup sql help example sets NETWORK_ID.
The e2e runner and Playwright start Kratos with no network.id, so serve refused to start. They now export a fixed NETWORK_ID and run the new test/e2e/seed-network helper between migrate and serve. The helper inserts the row once and skips it when the row exists.
Collaborator
Author
|
Ship summary: https://claude.ai/artifact/EfoAEDr5F66utPQd25cb66 |
5 tasks done
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.
RegistryDefault.Initnow takes the network from the config keynetwork.idand refuses to start when the key is missing, is not a UUID, is the nil UUID, names no row innetworks, or equalsnetwork.forbidden_id. It never creates a row, with one exception: for a memory SQLite DSN it inserts the configured row, because no other process can reach that database.migrateneeds no key.Why: the product Kratos releases must use their own network in the shared
kratos_db, never the oldest row. Every later tag cut fromgoodnotes, classic too, needsnetwork.id. The e2e runner and Playwright now setNETWORK_IDand runtest/e2e/seed-networkbetweenmigrateandserve. Thequickstart*.ymlfiles do not set it yet (tracked in kratos#fe5v).Upstream check:
ory/kratosmasteratb86338da04still callsDetermineinInitand has no config key for the network (searcheddriver/registry_default.go,driver/config,persistence/sql), so this is a local patch.Tests:
TestInitNetworkFromConfigcovers SQLite, CockroachDB v23.1 and memory, and its config cases fail if a check is removed.driver,migratest,cmd/cleanup,cmd/courier,cmd/serveandexamplespass. Real runs ofserve,courier watchandcleanup sqlexit 1 with no key and start with a valid key.