Skip to content

feat(server): add sessions and terminals REST endpoints - #14

Closed
facyndev wants to merge 2 commits into
feature/api-rest-crud-01-workspacesfrom
feature/api-rest-crud-02-sessions-terminals
Closed

facyndev wants to merge 2 commits into
feature/api-rest-crud-01-workspacesfrom
feature/api-rest-crud-02-sessions-terminals

Conversation

@facyndev

@facyndev facyndev commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds SessionsController: POST /workspaces/:workspaceId/sessions (owner-only create; 404 for missing workspace and strangers alike — no existence leak), GET /workspaces/:workspaceId/sessions (owner/member listing with terminals in position order), GET /sessions/:id (detail viewable by owner, member or guest via session.canView; 403 without view access).
  • Adds TerminalsController: POST /sessions/:id/terminals (owner-only append; strict zod rejects env — secrets are never accepted nor persisted) and DELETE /sessions/:id/terminals/:terminalId (204; 403 before terminal-existence check so strangers can't probe terminal ids).
  • SessionService centralizes access classification; SessionView/TerminalView projections in views.ts (cwd nullable, env never projected).

Changes

File Change
apps/api/src/collab/sessions.controller.ts 3 nested/detail routes (S4–S6)
apps/api/src/collab/terminals.controller.ts add/remove terminal routes (S7–S8)
apps/api/src/collab/session.service.ts access classification + ownedSession helper (owner check before terminal-existence check)
apps/api/src/collab/dto.ts, views.ts createSessionSchema, addTerminalSchema (strict; env rejected, blank command blocked); session/terminal views
apps/api/src/collab/sessions.controller.int.spec.ts 9 integration tests (RED→GREEN)
apps/api/src/collab/terminals.controller.int.spec.ts 8 integration tests (RED→GREEN)

Test evidence

  • Integration: 124/124 (17 new) · Unit: 166/166 · typecheck exit 0 · gitleaks clean
  • Guest/member/terminal seeding in tests goes straight through the repositories (T4/T3 endpoints not used to seed), documented in the feature doc (L7, L9).

Chain Context

Field Value
Chain api-rest-crud (REST CRUD: workspaces / sessions / terminals / invitations)
Tracker PR Draft PR feature/api-rest-crud → develop (created after the slice PRs)
Position 2 of 3 slices
Base feature/api-rest-crud-01-workspaces (retarget to develop once #13 merges)
Depends on #13 (workspaces slice — controllers/module scaffolding)
Follow-up #15 (invitations + wiring, T4+T5)
Review budget 789 / 400 — size:exception: user-decided slice (feature doc L8) of two cohesive work units (T2, T3); each commit keeps its tests with its code
Starts at #13 (2e3e113)
Ends with Sessions and terminals REST surface available behind auth

Chain Overview

develop
  └── #13 workspaces (T1) — merged first
       └── � #<this> sessions + terminals (T2+T3)
            └── invitations + AppModule wiring (T4+T5)
                 └── draft tracker PR: feature/api-rest-crud → develop (full feature)

Scope

  • Includes: sessions create/list/detail, terminals add/remove, access classification, views
  • Excludes: invitations endpoints and AppModule wiring (next slice), desktop dual storage mode (separate feature)

Autonomy

  • CI is expected to pass for this PR branch
  • This PR has one deliverable scope
  • This PR can be rolled back without unrelated changes
  • Tests cover this unit (17 integration tests)

@facyndev

Copy link
Copy Markdown
Owner Author

Landed via tracker PR #16 (feature-branch-chain): this slice's commits are on develop as of 0dd8d1c. Closing the review slice — full feature merged.

@facyndev facyndev closed this Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant