Move GIGAFACTORY_ROADMAP.md and GIGAFACTORY_SYSTEM_OVERVIEW.md under agent-queue/docs/gigafactory/ so the scattered top-level docs are easy to discover. Update the README links, the overview code-map, and all phase job-spec source-of-truth paths to the new location. Pure docs move; no behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4.8 KiB
| engine | cwd | yolo | lock | timeout |
|---|---|---|---|---|
| devin | /Users/sd9235/code/mygh/learning_ai_common_plat | true | common-plat-artifacts | 4h |
ROLE: Senior backend engineer. Implement FLEET ARTIFACTS + BLOB WIRING (§13 leftover):
large run outputs (logs, coverage, screenshots, build output) are stored in blob
storage and only POINTERS (with size/content-type/SAS) live in the fleet_artifacts
Cosmos container — NEVER inline in Cosmos (doc-size + RU limits).
PARALLEL-SAFETY (two other Devins are running — DO NOT collide):
- You OWN the fleet_artifacts surface: types.ts (artifact schema only), repository.ts (artifact repo only), routes.ts (artifact endpoints only), cosmos-init.ts (only if the fleet_artifacts container needs registration), and a NEW artifacts.test.ts.
- You MUST NOT touch: coordinator.ts, coordinator.test.ts, scheduler.ts (another Devin owns the scheduler + claim ranking). Keep your edits to types/repository/routes additive and localized to the artifact pieces — do not refactor the job/lease/claim code.
- A third Devin is in a different repo (agent-queue) — no overlap.
READ FIRST:
- services/platform-service/src/modules/fleet/types.ts — find FleetArtifactDoc (the foundation may already declare it, pk /jobId). repository.ts — see if an artifacts repo already exists; extend, don't duplicate. cosmos-init.ts — see if fleet_artifacts is already registered.
- packages/blob (@bytelyst/blob) — the Azure Blob client + SAS token helpers. Learn the exact API (upload, container/key conventions, SAS generation, the memory/dev fallback). Use it the same way other consumers do (grep for existing @bytelyst/blob usage).
- ../learning_ai_devops_tools/agent-queue/docs/gigafactory/GIGAFACTORY_ROADMAP.md §13 (fleet_artifacts bullet) + §26 (insights/artifacts).
PREREQUISITE / BRANCHING: branch off CURRENT main → feat/gigafactory-p2-artifacts. Push + open PR. DO NOT merge.
DELIVERABLES
- FleetArtifactDoc (in types.ts — confirm/extend): { id, productId, jobId, runId?, kind ('log'|'coverage'|'screenshot'|'build'|'other'), blobKey, contentType, sizeBytes, sha256?, createdAt }. Zod schema → inferred type. productId on the doc.
- repository.ts — artifacts repo: createArtifact, listArtifactsByJob(jobId), getArtifact(id, productId), deleteArtifact. Single-partition (pk /jobId). Do not touch the job/lease/run repos beyond importing shared helpers.
- Blob integration (a small artifacts service fn, e.g. in a NEW
modules/fleet/artifacts-blob.ts): uploadArtifact(jobId, kind, bytes/stream, contentType)
→ stores in @bytelyst/blob under a deterministic key
(
fleet/<productId>/<jobId>/<id>-<kind>), returns the persisted FleetArtifactDoc with a short-lived SAS read URL. getArtifactDownload(id) → re-issues a SAS URL. Large content NEVER goes into Cosmos. - routes.ts — guarded endpoints (auth + productId, Zod-validated), additive only: POST /fleet/jobs/:id/artifacts (multipart or base64 body → upload + pointer) GET /fleet/jobs/:id/artifacts (list pointers) GET /fleet/artifacts/:artifactId (pointer + fresh SAS download URL) DELETE /fleet/artifacts/:artifactId Register exactly like the existing fleet routes (do not reorder/rewrite the others).
TESTS (artifacts.test.ts — memory blob + memory datastore; tests are sacred):
- upload → a fleet_artifacts pointer doc is created with productId, blobKey, sizeBytes, contentType; the bytes live in blob, NOT in the Cosmos doc (assert the doc has no inline payload field).
- list by job returns only that job's artifacts (partition isolation).
- get returns a (fresh) SAS download URL; a large payload (> a Cosmos-safe threshold) still succeeds (proves blob offload).
- delete removes the pointer (and blob if your helper does so).
- routes via fastify inject: upload/list/get/delete; auth + productId enforced; invalid body → 400; unknown id → 404.
- existing fleet tests (jobs/leases/claim/events) remain green and untouched.
VERIFY GATE:
- pnpm --filter @lysnrai/platform-service exec vitest run src/modules/fleet (all green)
- pnpm --filter @lysnrai/platform-service build
- pnpm build && pnpm test (no consumer regressed)
CONSTRAINTS: ESM .js imports; no any; no console.log; productId on every doc; large logs in blob never Cosmos; conventional commits (feat(platform-service): ...); do not touch the files reserved for the other Devins; do not edit the agent-queue repo.
FINAL OUTPUT — report in EXACTLY this format: