Skip to content

Move Projects and Project API keys out of store into projects and projectpg - #323

Merged
SaladDay merged 1 commit into
mainfrom
refactor/projects-domain
Sep 30, 2026
Merged

SaladDay merged 1 commit into
mainfrom
refactor/projects-domain

Conversation

@SaladDay

@SaladDay SaladDay commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1 (store layering), PR 4: Projects and Project API keys move out of store.

  • projects domain package: Project/APIKey vocabulary, name rules, a Service for create, rename, archive, issue key and revoke key, and Storage/KeyIssuanceTx/Reader ports. Key issuance runs as Load → Decide → Apply under a share lock on the Project, so an archive cannot race a new key. ValidateCredentialSeparation checks digests through Reader.APIKeyDigestExists.
  • persistence/postgres/projectpg: the PostgreSQL adapter. It allocates the tenant, records administrator audits in the same transaction via auditpg, and runs list reads in one snapshot. Key digests are typed [sha256.Size]byte.
  • api: Projects (service) and ProjectsReader (adapter) Dependencies fields, strict fakes, and the projects error writer. api generates the IDs.
  • cmd/server: wires projectpg and projects.NewService.
  • Deleted from store: the Project and API-key files and their tests. Coverage moved to projects/projectpg.

Behaviour changes:

  • An invalid admin audit source is now typed adminaudit.ErrInvalidSource. It still returns 400.
  • Name errors lose the "invalid session input:" prefix.
  • OpenAPI schema names change from store.* to projects.*. The shapes are identical.

Checks on the final head (15f7bda + 1):

  • go build ./... and go vet ./services/core/... across the whole module
  • projects, projectpg, api and cmd/server in full
  • execution and sandbox/providers: the tests in the changed or conflicted files, by -run
  • store: 12 tests by -run (every test using the Project fixtures or routes)
  • make openapi and make check-names

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@SaladDay
SaladDay merged commit 0a517bb into main Sep 30, 2026
@SaladDay
SaladDay deleted the refactor/projects-domain branch September 30, 2026 17:40
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant