docs: README + DEVELOP — code map, Settings, bucket routing, troubleshooting
- README: refresh "what it does", "architecture at a glance", "containers" table, "configuration", "storage layout" (with usage_type→bucket routing table), and add "documentation" section pointing to ARCHITECTURE / HANDOVER / DEVELOP / CLAUDE. - DEVELOP: add the developer-facing guide that was previously only in CLAUDE.md. Covers code layout, the Settings singleton, conventions (DB / Storage / Auth / Permission gates / Outbox / async-sync signatures), local dev workflow, common tasks (adding a DAG endpoint, env var, MySQL table, RustFS bucket, schedule node type), tests status, and a troubleshooting section with the four real bugs hit this session (greenlet, MySQL, Jupyter 401, Schedule not advancing).
This commit is contained in:
+27
-6
@@ -286,16 +286,37 @@ See "Adding a new env var" above.
|
||||
|
||||
### Wire a new RustFS bucket
|
||||
|
||||
The current three buckets are wired in `backend/storage_api.py:resolve_bucket`:
|
||||
|
||||
```python
|
||||
BUCKET_FOR_USAGE: dict[str, str] = {
|
||||
"working_copy": settings.rustfs_workspace_bucket,
|
||||
"public_script": settings.rustfs_workspace_bucket,
|
||||
"data_resource": settings.rustfs_workspace_bucket,
|
||||
"snapshot": settings.rustfs_workspace_bucket,
|
||||
"version_artifact": settings.rustfs_version_bucket,
|
||||
"run_log": settings.rustfs_run_log_bucket,
|
||||
"run_result": settings.rustfs_run_log_bucket,
|
||||
}
|
||||
```
|
||||
|
||||
To add a fourth bucket:
|
||||
|
||||
1. Add the env var to `Settings`:
|
||||
```python
|
||||
rustfs_<feature>_bucket: str = Field(default="<feature>", description="...")
|
||||
```
|
||||
2. Add to `.env.example`.
|
||||
3. Extend the `Literal` in `ServerObjectRequest.usage_type` to include
|
||||
the new `usage_type` value, if applicable.
|
||||
4. In the consumer of the bucket, branch on `usage_type` (or the
|
||||
`bucket_name` argument) and pick the right bucket via
|
||||
`settings.rustfs_<feature>_bucket`.
|
||||
2. Add to `.env.example` with a one-line comment.
|
||||
3. Extend the `Literal` in `common/storage/schemas.py` (in
|
||||
`ServerObjectRequest.usage_type`, `CreateUploadRequest.usage_type`,
|
||||
`CompleteUploadRequest.usage_type`) to include the new value.
|
||||
4. Add an entry in `BUCKET_FOR_USAGE` mapping the new `usage_type` to
|
||||
the new bucket env var.
|
||||
5. Add the bucket to the `ensure_bucket` loop in
|
||||
`backend/main.py` lifespan.
|
||||
|
||||
A workspace's `artifact_bucket` column (when non-null) overrides the
|
||||
default for that workspace, regardless of `usage_type`.
|
||||
|
||||
### Add a new schedule node type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user