Repository navigation
feat(api): add API v1 columns (migration 0024) and principal via - #224
Merged
Merged
Conversation
api_key.member_id with an (account_id, member_id) index, and form.created_via, form.previous_config and form.previous_published_at_ms, in SQLite and Postgres and in both Drizzle schemas. Purely additive: an upgraded database keeps every row and the new columns read NULL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Josue Hernandez <josue@daptatech.com>
…ncipal HostPrincipal gains via: 'session' | 'api_key' and an optional apiKeyId. AuthService.resolveHost only resolves sessions today, so it always returns via: 'session' and otherwise the same principal as before. isApiKeyPrincipal is the one check the key, strict validation and created-via metric code will use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Josue Hernandez <josue@daptatech.com>
… new specs The upgrade test now migrates through 0024 only, so a later migration cannot change what it asserts. Both new spec files follow the shared Prettier preset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Josue Hernandez <josue@daptatech.com>
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.
Summary
Lays the groundwork for the public API v1: the database columns it needs and a way for request handlers to tell how the caller authenticated. No user-facing behavior changes yet.
Changes
api_key.member_idplus indexapi_key_account_member_idxform.created_via,form.previous_config(JSONB in PG, TEXT in SQLite),form.previous_published_at_ms(BIGINT in PG, INTEGER in SQLite)via: 'session' | 'api_key'(and optionalapiKeyId). Session requests getvia: 'session'in both the home workspace and a workspace selected by header.isApiKeyPrincipalhelper, exported fromauth.provider.tsand re-exported fromauth.service.ts.@quill/dbminor.How it was tested
migration-0024.spec.tsstages the upgrade at exactly 0023 then 0024 with realistic rows: no row lost, existing values unchanged, new columns NULL.auth-principal.specpins the exact principal keys for home and header-selected workspaces; unit tests forisApiKeyPrincipal.pnpm typecheck,pnpm lint(no new warnings), fullpnpm teston SQLite.db:migrateapplies 0024,db:seedworks,@quill/dband@quill/apisuites pass against Postgres 16.Review notes
An independent review found no bugs. Notes for follow-up work:
isApiKeyPrincipalreturns false whenviais missing, so test stubs built withoutviaread as session. Give those stubsvia: 'session'explicitly when they are next touched.apiKeyIdwithoutvia: 'api_key'; a discriminated union could tighten this once the API key principal is built.🤖 Generated with Claude Code