multica/server/internal/handler
Naiyuan Qing 9ede795c5b feat(api): strict workspace isolation + agent parity fixes
Enforce workspace isolation at every layer:

- Router: move RequireWorkspaceMember middleware to group level so ALL
  workspace-scoped routes (issues, agents, skills, runtimes, inbox,
  comments) require workspace context
- SQL: add GetXxxInWorkspace queries that filter by workspace_id,
  eliminating cross-workspace data access at the query level
- Handlers: loadXForUser functions use workspace-scoped queries,
  no fallback to unscoped queries
- Migration 025: add workspace_id column to comment table with backfill
- ListComments: add workspace_id filter for defense-in-depth

Fix daemon workspace mapping:
- Server returns workspace_id in task claim response (from issue)
- Daemon uses task.WorkspaceID directly instead of unreliable
  workspaceIDForRuntime() local map lookup
- Remove workspaceIDForRuntime function

Fix agent/human parity:
- Comment update/delete: use resolveActor for isAuthor check so agents
  can edit/delete their own comments
- Event attribution: replace hardcoded "member" with resolveActor in
  agent, skill, and subscriber publish calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 16:49:13 +08:00
..
activity.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
activity_test.go feat(activity): unified activity timeline with comment reply support 2026-03-28 21:53:08 +08:00
agent.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
auth.go fix(handler): set issue_prefix when auto-creating workspace on first login 2026-03-30 13:26:42 +08:00
comment.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
daemon.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
daemon_pairing.go feat(runtime): add local codex daemon pairing 2026-03-24 12:03:14 +08:00
handler.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
handler_test.go feat(server): distinguish agent vs human CLI actions (#181) 2026-03-30 13:12:59 +08:00
inbox.go feat(inbox): scope all inbox queries by workspace_id 2026-03-29 17:42:45 +08:00
issue.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
personal_access_token.go feat(auth): email verification login and personal access tokens 2026-03-26 14:32:30 +08:00
runtime.go refactor(server): consolidate workspace permission checks into middleware 2026-03-30 03:40:20 +08:00
runtime_ping.go feat(runtimes): add Runtimes tab with usage tracking and connection test 2026-03-26 18:28:36 +08:00
skill.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
subscriber.go feat(api): strict workspace isolation + agent parity fixes 2026-03-30 16:49:13 +08:00
subscriber_test.go feat(notifications): replace hardcoded inbox notifications with subscriber-driven model 2026-03-28 19:33:20 +08:00
workspace.go refactor(server): consolidate workspace permission checks into middleware 2026-03-30 03:40:20 +08:00