You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The files code is in the old shape, measured on main at f82dbc33:
api/routes/files.py builds its own queries (the listing and its cursor), commits, and raises HTTPException itself. It is on ROUTE_DATABASE_IMPORT_BASELINE and TRANSACTION_CONTROL_BASELINE.
services/file_service.py has fetch_file(db, ...), a module-level function that takes the session. It is on SERVICE_DATABASE_IMPORT_BASELINE and FLAT_MODULE_BASELINE. services/file_store.py is on FLAT_MODULE_BASELINE.
services/files/__init__.py exports eight names (five functions, a class and two data types), not one service.
The routes return dict[str, Any], built by FileObject.to_dict() and FileObject.to_anthropic_dict() on the ORM model.
Proposal
The six steps in docs/domains.md ("What one domain change does"), as separate commits, or separate PRs:
Schemas: the request and response models go into schemas/files.py, and the routes return them. Remove to_dict() and to_anthropic_dict() from FileObject.
Repositories: every files query goes into repositories/files/, as classes over BaseRepository, with the bundle the service receives in files_repositories.py.
Service: one files service in services/files/, built in api/deps.py. The other modules become its private modules, and the package root exports the service and its types.
Commits: into Unit of Work blocks.
Errors: into exceptions/files_exceptions.py, on the bases in exceptions/_base.py.
Baselines: remove the moved modules from every baseline.
FileObject moves to models/files.py and joins the import list in models/__init__.py.
Record the domain's counts before and after, as docs/domains.md asks.
Doing #1473, #1475 and #1478 first avoids moving code that is about to change. #1484 lands before or with step 3.
Acceptance
api/routes/files.py, services/file_service.py and services/file_store.py are on no baseline.
make lint, make typecheck and the files tests pass.
make openapi-check, make postman-check and the dashboard client drift check pass.
Problem
The files code is in the old shape, measured on
mainatf82dbc33:api/routes/files.pybuilds its own queries (the listing and its cursor), commits, and raisesHTTPExceptionitself. It is onROUTE_DATABASE_IMPORT_BASELINEandTRANSACTION_CONTROL_BASELINE.services/file_service.pyhasfetch_file(db, ...), a module-level function that takes the session. It is onSERVICE_DATABASE_IMPORT_BASELINEandFLAT_MODULE_BASELINE.services/file_store.pyis onFLAT_MODULE_BASELINE.services/files/__init__.pyexports eight names (five functions, a class and two data types), not one service.repositories/files/holds module-level functions, not classes overBaseRepository.BaseRepositorycan serve a declarative table since refactor(repositories): let a repository serve a declarative model #1451.dict[str, Any], built byFileObject.to_dict()andFileObject.to_anthropic_dict()on the ORM model.Proposal
The six steps in
docs/domains.md("What one domain change does"), as separate commits, or separate PRs:schemas/files.py, and the routes return them. Removeto_dict()andto_anthropic_dict()fromFileObject.repositories/files/, as classes overBaseRepository, with the bundle the service receives infiles_repositories.py.services/files/, built inapi/deps.py. The other modules become its private modules, and the package root exports the service and its types.exceptions/files_exceptions.py, on the bases inexceptions/_base.py.FileObjectmoves tomodels/files.pyand joins the import list inmodels/__init__.py.Record the domain's counts before and after, as
docs/domains.mdasks.Doing #1473, #1475 and #1478 first avoids moving code that is about to change. #1484 lands before or with step 3.
Acceptance
api/routes/files.py,services/file_service.pyandservices/file_store.pyare on no baseline.make lint,make typecheckand the files tests pass.make openapi-check,make postman-checkand the dashboard client drift check pass.Depends on #1482.
Part of #1470.