Move Projects and Project API keys out of store into projects and projectpg - #323
Merged
Merged
Conversation
The projects domain owns Project and key names, catalog paging and the key issuance decision; projectpg persists them and records each admin mutation in the same transaction. api reads through ProjectsReader and changes through Projects, and cmd/server wires both. store keeps the remaining cross-resource transactions that read Project rows.
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.
Part of #1 (store layering), PR 4: Projects and Project API keys move out of
store.projectsdomain package: Project/APIKey vocabulary, name rules, aServicefor create, rename, archive, issue key and revoke key, andStorage/KeyIssuanceTx/Readerports. Key issuance runs as Load → Decide → Apply under a share lock on the Project, so an archive cannot race a new key.ValidateCredentialSeparationchecks digests throughReader.APIKeyDigestExists.persistence/postgres/projectpg: the PostgreSQL adapter. It allocates the tenant, records administrator audits in the same transaction viaauditpg, and runs list reads in one snapshot. Key digests are typed[sha256.Size]byte.Projects(service) andProjectsReader(adapter) Dependencies fields, strict fakes, and the projects error writer. api generates the IDs.cmd/server: wiresprojectpgandprojects.NewService.store: the Project and API-key files and their tests. Coverage moved toprojects/projectpg.Behaviour changes:
adminaudit.ErrInvalidSource. It still returns 400.store.*toprojects.*. The shapes are identical.Checks on the final head (15f7bda + 1):
go build ./...andgo vet ./services/core/...across the whole moduleprojects,projectpg,apiandcmd/serverin fullsandbox/providers: the tests in the changed or conflicted files, by-runstore: 12 tests by-run(every test using the Project fixtures or routes)make openapiandmake check-namesNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.