S030T010: Controller endpoints + DTOs for collaborative class instances #535

Merged
chris merged 8 commits from spec/030-collaborative-lifecycle into main 2026-07-09 10:58:27 +02:00
Owner

S030T010 — Controller endpoints + DTOs

Changes

  • 12 endpoints in DiscoveryController for collaborative class instance lifecycle:
    • CRUD: create/PATCH/archive/dissolve
    • Shares: create/revoke
    • Roles: grant/revoke
    • Contributions: contribute/approve/reject/bulk-decision
  • 7 request DTOs: CreateCollaborativeClassInstanceRequest, UpdateCollaborativeClassInstanceRequest, CreateShareRequest, GrantRoleRequest, RevokeRoleRequest, ContributeOccurrencesRequest, BulkContributionDecisionRequest
  • Integration tests for all endpoints (happy path + unauthorized)

Dependencies

  • Service layer + response DTOs from T001-T009 (included in this branch)

Version

  • 0.80 → 0.81

Verification

  • compileJava ✓
  • compileTestJava ✓
  • DiscoveryControllerTest ✓
  • All discovery tests ✓
## S030T010 — Controller endpoints + DTOs ### Changes - **12 endpoints** in DiscoveryController for collaborative class instance lifecycle: - CRUD: create/PATCH/archive/dissolve - Shares: create/revoke - Roles: grant/revoke - Contributions: contribute/approve/reject/bulk-decision - **7 request DTOs**: CreateCollaborativeClassInstanceRequest, UpdateCollaborativeClassInstanceRequest, CreateShareRequest, GrantRoleRequest, RevokeRoleRequest, ContributeOccurrencesRequest, BulkContributionDecisionRequest - **Integration tests** for all endpoints (happy path + unauthorized) ### Dependencies - Service layer + response DTOs from T001-T009 (included in this branch) ### Version - 0.80 → 0.81 ### Verification - `compileJava` ✓ - `compileTestJava` ✓ - `DiscoveryControllerTest` ✓ - All discovery tests ✓
feat: add generic helper methods for collaborative class instance ops
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 47s
Build and Deploy / Run scoped PR tests (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
9efc181cea
Extract domain/class-agnostic helpers into CollaborativeClassInstanceService:

- requireActiveRole: check user has non-revoked role on instance
- requireRoleAtLeast: verify role hierarchy minimum
- resolveInstance: fetch CollaborativeClassInstanceView by id
- assertSourceOwnership: validate class_instances owner/domain
- toView: Map row to CollaborativeClassInstanceView
- parseSharePolicy: validate/normalize share policy string

Add unit tests for all 6 helper methods (21 tests total).
feat(discovery): implement createCollaborativeClassInstance with auto-seed contributions
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 48s
Build and Deploy / Run scoped PR tests (push) Successful in 3m37s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
885f192abb
- Add createCollaborativeClassInstance method to CollaborativeClassInstanceService
- Assert source ownership before creation
- Insert collaborative_class_instances row with domain/class agnostic pattern
- Auto-seed accepted occurrences from source class instance as contributions
- Grant instance_owner role to the actor user
- Return view of the new instance via resolveInstance
- Add 5 tests: seeding, empty contributions, wrong domain, role grant, view validity
- Add safeJson helper and fixture helpers (occurrence inserts, count queries)
- updateInstanceWithBlankDisplayNameClearsName
- updateInstanceWithEmptyAliasesList
- updateInstanceFiltersNullFromAliases
- updateInstanceDeduplicatesAliases
- updateInstanceByHigherRolePasses
- updateInstanceReplacesExistingAliases
- archiveInstance: sets lifecycle_state to archived, requires instance_admin
- dissolveInstance: revokes shares, forks non-owner contributions, archives
- forkNonOwnerContributions: creates local class_instances + forked
  collaborative instances with lifecycle=archived, grants owner role
- Tests: archiveInstanceAlreadyArchivedThrows,
  dissolveInstanceNonexistentThrows,
  dissolveInstanceNoNonOwnerContributions,
  strengthened dissolveInstanceWithNonOwnerContributorsForks
  (verify forked lifecycle=archived, local instance owner=contributor)
feat(api): add collaborative class instance controller endpoints + DTOs
All checks were successful
Build and Deploy / Detect changed services and test scopes (push) Successful in 42s
Build and Deploy / Run scoped PR tests (push) Successful in 2m1s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
4b61d85f9c
S030T010 — Controller endpoints + DTOs for Spec 030 collaborative lifecycle.

Added 12 endpoints to DiscoveryController:
- POST /discovery/collaborative-class-instances (create)
- PATCH .../{id} (update)
- POST .../{id}/archive
- DELETE .../{id} (dissolve)
- POST .../{id}/shares (create share)
- DELETE .../{id}/shares/{shareId} (revoke share)
- POST .../{id}/roles (grant role)
- DELETE .../{id}/roles (revoke role)
- POST .../{id}/contributions (contribute)
- POST .../{id}/contributions/{cid}/approve
- POST .../{id}/contributions/{cid}/reject
- POST .../{id}/contributions/bulk-decision

Added 7 request DTOs: CreateCollaborativeClassInstanceRequest,
UpdateCollaborativeClassInstanceRequest, CreateShareRequest,
GrantRoleRequest, RevokeRoleRequest, ContributeOccurrencesRequest,
BulkContributionDecisionRequest.

Response DTOs and service implementation (T001-T009) by prior work.
Integration tests for all new endpoints.

Version bump: 0.80 -> 0.81
chris merged commit 458a5531ed into main 2026-07-09 10:58:27 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!535
No description provided.