Appearance
Handoff: SVC-011-object-delete-archive-lifecycle file-service object delete/archive lifecycle
Scope
- Service/area:
file-servicedomain alias, implemented bydocument-service - Task pack:
docs/agents/service-tasks/file-service.md - Goal: complete the bounded
SVC-011object delete/archive lifecycle slice with organization-scoped object deletion and owner/admin teaching-document archive behavior. - Non-goals: public
/api/storage*or/api/documents*route promotion, hard teaching-document purge, share/purchase/entitlement/quota/wallet decisions, parser ownership, browser route proof, or changes to legacy source under/Users/velikho/Desktop/WORKING/HOCTAPAZ/.
Docs Read
go-platform/docs/architecture/service-responsibility-matrix.mdgo-platform/docs/architecture/legacy-api-map.mdgo-platform/docs/agents/service-agent-execution-queue.jsongo-platform/docs/agents/service-agent-closeout-ledger.jsongo-platform/docs/agents/service-tasks/file-service.mdgo-platform/docs/agents/agent-handoff-format.mdgo-platform/docs/api/document-service.mdgo-platform/docs/qa/storage-media-parity-smoke.mdgo-platform/docs/qa/service-agent-goal-completion-audit.mdgo-platform/docs/qa/service-agent-readiness-smoke.md
Legacy Evidence Read
/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/storage/storage.service.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/admin/content-admin.service.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/documents/documents.controller.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/documents/documents.service.ts- Legacy source was read-only evidence only; no legacy files were changed.
Files Changed
go-platform/services/document-service/internal/objectstore/store.gogo-platform/services/document-service/internal/objectstore/memory.gogo-platform/services/document-service/internal/objectstore/s3.gogo-platform/services/document-service/internal/repository/memory.gogo-platform/services/document-service/internal/repository/postgres.gogo-platform/services/document-service/internal/usecase/storage.gogo-platform/services/document-service/internal/usecase/storage_test.gogo-platform/services/document-service/internal/usecase/teaching_document_search_projection.gogo-platform/services/document-service/internal/usecase/teaching_document_search_projection_test.gogo-platform/services/document-service/internal/http/server.gogo-platform/services/document-service/internal/http/server_test.gogo-platform/contracts/openapi/services/document-service.yamlgo-platform/services/document-service/api/openapi.yamlgo-platform/docs/api/document-service.mdgo-platform/docs/agents/service-tasks/file-service.mdgo-platform/docs/agents/handoffs/SVC-011-object-delete-archive-lifecycle.mdgo-platform/docs/agents/service-agent-closeout-ledger.jsongo-platform/docs/agents/service-agent-closeout-ledger.md
Behavior Implemented
- Added
objectstore.Store.Deleteand implemented it for memory and S3 object stores. - Added
StorageService.DeleteObject, requiringX-Organization-Idscope and rejecting storage keys outside the caller's organization prefix. - Added
DELETE /v1/storage/objects?storageKey=...with403for missing/wrong organization scope and404for missing objects in the memory-backed path. - Added
TeachingDocumentService.Archive, requiring organization scope plus actor identity. Owners may archive their own documents;ADMINandSTAFFactors may archive documents in the same organization. - Added
POST /v1/admin/documents/{id}/archive; it setsstatus=ARCHIVED, clearspublished_atandfeatured_at, and preserves default search projection behavior by excluding archived rows unless requested. - Updated OpenAPI and API docs to document that destructive deletes do not accept the internal object-read token and that purchase/entitlement/wallet/quota/public marketplace behavior remains outside this slice.
Tests And Verification
- Command:
GOTOOLCHAIN=go1.25.11 go test ./services/document-service/... -count=1 - Result: passed.
- Evidence: all document-service packages passed, including focused object delete, archive, projection, and HTTP route tests.
- Command:
STORAGE_PARITY_SELF_TEST=1 make test-storage-media-parity - Result: passed.
- Evidence: storage/media parity smoke self-test passed after lifecycle route additions.
- Command:
cmp -s services/document-service/api/openapi.yaml contracts/openapi/services/document-service.yaml && echo openapi-mirror-ok - Result: passed.
- Evidence: service-local and contract OpenAPI artifacts match.
- Command:
ruby -e 'require "yaml"; ARGV.each { |f| YAML.load_file(f); puts "yaml-ok #{f}" }' services/document-service/api/openapi.yaml contracts/openapi/services/document-service.yaml - Result: passed.
- Evidence: both document-service OpenAPI YAML files parsed successfully.
Route State
- Legacy route: default storage/media/document public routes remain legacy-proxied; no default gateway route was promoted.
- Native route: service-local
/v1/storage/objectsdelete and/v1/admin/documents/{id}/archiveare available for bounded native rehearsal only. - Gateway state: no default route table was changed. Storage/media promotion still requires parity proof plus browser evidence for touched upload/read flows.
- Rollback: keep
deploy/gateway/routes.jsonas the active route table. If lifecycle regressions appear, revert the new document-service delete/archive handlers and store methods without promoting public gateway routes.
Data Notes
- Tables touched: none in this handoff run; package tests used memory stores.
- Migration run: none.
- Validation report: not applicable because no live data was migrated or backfilled.
Risks / Blockers
- Hard teaching-document purge, share lifecycle, public marketplace behavior, purchase/entitlement, wallet, billing, and usage/quota workflows remain future slices.
- Real MinIO/S3 delete behavior was not live-tested; S3 deletion uses provider
DeleteObjectsemantics and still needs environment-specific runtime proof before promotion. - Browser/default route evidence is still missing, so public storage/document routes remain blocked.
Next Step
- Add a non-default gateway rehearsal and live object-store proof for the exact storage/document route under consideration before any public/default route change.