Skip to content

Handoff: SVC-011-object-delete-archive-lifecycle file-service object delete/archive lifecycle

Scope

  • Service/area: file-service domain alias, implemented by document-service
  • Task pack: docs/agents/service-tasks/file-service.md
  • Goal: complete the bounded SVC-011 object 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.md
  • go-platform/docs/architecture/legacy-api-map.md
  • go-platform/docs/agents/service-agent-execution-queue.json
  • go-platform/docs/agents/service-agent-closeout-ledger.json
  • go-platform/docs/agents/service-tasks/file-service.md
  • go-platform/docs/agents/agent-handoff-format.md
  • go-platform/docs/api/document-service.md
  • go-platform/docs/qa/storage-media-parity-smoke.md
  • go-platform/docs/qa/service-agent-goal-completion-audit.md
  • go-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.go
  • go-platform/services/document-service/internal/objectstore/memory.go
  • go-platform/services/document-service/internal/objectstore/s3.go
  • go-platform/services/document-service/internal/repository/memory.go
  • go-platform/services/document-service/internal/repository/postgres.go
  • go-platform/services/document-service/internal/usecase/storage.go
  • go-platform/services/document-service/internal/usecase/storage_test.go
  • go-platform/services/document-service/internal/usecase/teaching_document_search_projection.go
  • go-platform/services/document-service/internal/usecase/teaching_document_search_projection_test.go
  • go-platform/services/document-service/internal/http/server.go
  • go-platform/services/document-service/internal/http/server_test.go
  • go-platform/contracts/openapi/services/document-service.yaml
  • go-platform/services/document-service/api/openapi.yaml
  • go-platform/docs/api/document-service.md
  • go-platform/docs/agents/service-tasks/file-service.md
  • go-platform/docs/agents/handoffs/SVC-011-object-delete-archive-lifecycle.md
  • go-platform/docs/agents/service-agent-closeout-ledger.json
  • go-platform/docs/agents/service-agent-closeout-ledger.md

Behavior Implemented

  • Added objectstore.Store.Delete and implemented it for memory and S3 object stores.
  • Added StorageService.DeleteObject, requiring X-Organization-Id scope and rejecting storage keys outside the caller's organization prefix.
  • Added DELETE /v1/storage/objects?storageKey=... with 403 for missing/wrong organization scope and 404 for missing objects in the memory-backed path.
  • Added TeachingDocumentService.Archive, requiring organization scope plus actor identity. Owners may archive their own documents; ADMIN and STAFF actors may archive documents in the same organization.
  • Added POST /v1/admin/documents/{id}/archive; it sets status=ARCHIVED, clears published_at and featured_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/objects delete and /v1/admin/documents/{id}/archive are 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.json as 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 DeleteObject semantics 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.

Go-platform documentation is generated from repository Markdown.