Skip to content

Move source Files out of store into files and filepg - #318

Merged
SaladDay merged 2 commits into
mainfrom
refactor/files-domain
Sep 30, 2026
Merged

SaladDay merged 2 commits into
mainfrom
refactor/files-domain

Conversation

@SaladDay

@SaladDay SaladDay commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1 (store layering), PR 7: source Files move out of store.

  • files domain package: the File/Upload/ListQuery vocabulary with its rules, a Service for create/delete (bounded upload writer, envelope validation), Storage/Reader ports, and ErrNotFound/ErrInvalidInput/ErrTooLarge.
  • persistence/postgres/filepg: the PostgreSQL adapter. Content goes into large objects, and write audits are recorded in the same transaction via auditpg. Reads run on one snapshot, so a concurrent delete never truncates a read it admitted.
  • pgunit.CreateLargeObject/LargeObjectWriter: replace store/source_file_writer.go. Session artifact capture and initial files use them too.
  • api: Files (service) and FilesReader (adapter) Dependencies fields, strict fakes, and writeFilesError. Public responses are unchanged.
  • cmd/server: wires filepg.New(units) and files.NewService.
  • Deleted from store: source_files.go, source_file_writer.go and their tests. The tests moved to files/filepg.

Checks on the final head (rebased onto 417bc36):

  • go build ./... and go vet ./services/core/... across the whole module
  • In full: files, filepg, pgunit, api, cmd/... and sandbox/providers
  • store, by -run only: the Files, initial-file, artifact-capture and audit tests in the changed and conflicted files
  • scripts/check-names.py

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 d34e791 into main Sep 30, 2026
6 checks passed
@SaladDay
SaladDay deleted the refactor/files-domain branch September 30, 2026 17:22
Artifact capture and source Files both stream content into a new large
object in bounded chunks and record its size and SHA-256 digest. pgunit
now owns that writer, and artifact capture uses it.
The files domain owns the File vocabulary, the upload envelope and
512 MiB content bound, the list rules and the create and delete use
cases. filepg stores metadata in source_files and content in large
objects on pgunit, records the write audit in the same transaction and
reads a page's cursor and rows from one snapshot.

api takes the Files use cases and the FilesReader separately, maps
their errors in errors_files.go and tests the handlers with strict
fakes. cmd/server and the store router fixture wire the real domain.
Store keeps only the Session-creation copy of an initial File, which
reads source_files inside its own transaction until Sessions move.
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