Skip to content

feat: scope file-event triggers to a specific oCIS space#31

Open
LukasHirt wants to merge 10 commits into
mainfrom
feature/event-trigger-space-scope
Open

feat: scope file-event triggers to a specific oCIS space#31
LukasHirt wants to merge 10 commits into
mainfrom
feature/event-trigger-space-scope

Conversation

@LukasHirt

Copy link
Copy Markdown
Collaborator

Summary

Lets a user optionally restrict a file-event trigger (upload/move/share/lock) to fire only for events originating in one specific oCIS space, instead of matching across every space they have access to.

This closes a real pre-existing bug: event.filters.spaceId was already declared in both the frontend type and the backend's EventFilters model, but was silently dropped before persistence and never matched — setting it via the raw API looked like it worked while doing nothing.

  • Backend: ocisclient.ListDrives proxies oCIS's Graph API (GET /graph/v1.0/me/drives), exposed through a new GET /me/spaces endpoint that filters out driveType == "virtual" (the aggregate "Shares" pseudo-space). SpaceID now correctly persists through the trigger-index storage and is matched in the SSE handler alongside the existing path-prefix/extension filters.
  • Frontend: the event-trigger config panel gets a "Space (optional)" dropdown, populated from the real endpoint, defaulting to "Any space."

Full design rationale: docs/superpowers/specs/2026-07-24-event-trigger-space-scope-design.md
Implementation plan: docs/superpowers/plans/2026-07-24-event-trigger-space-scope.md

Note for anyone with an existing workflow that already had spaceId set via the raw API: it was previously silently ignored (matching all spaces); after this merges, it will start being enforced the next time that workflow is saved. This is the intended fix, not a regression.

Test plan

  • Backend: go build ./... && go vet ./... && go test ./... (from backend/) — all green, including new unit tests for the trigger-index persistence fix and the SSE space-matching logic.
  • Backend e2e (go test -tags=e2e ./tests/e2e/..., real oCIS instance): GET /me/spaces returns real space data, and a real upload correctly fires a workflow scoped to the exact space it landed in — proving the Graph API's drive id and the SSE event's spaceid are the same value in practice, not just in theory.
  • Frontend: pnpm test:unit && pnpm check:types && pnpm lint — all green.
  • Frontend e2e (pnpm test:e2e) — all 4 specs green, including an extended event-trigger.spec.ts that picks a space, saves, reloads, and confirms it persisted.

🤖 Generated with Claude Code

@LukasHirt
LukasHirt requested a review from a team as a code owner July 24, 2026 16:50
LukasHirt and others added 10 commits July 24, 2026 23:03
Wires up the existing but dead event.filters.spaceId field end to
end: a new /me/spaces endpoint backed by oCIS's Graph API, persisting
SpaceID through the trigger index, matching it in the SSE handler,
and a space picker in the trigger config UI.

Signed-off-by: Lukas Hirt <info@hirt.cz>
Eight-task plan: oCIS client + API model, the /me/spaces endpoint,
persisting SpaceID through the trigger index (closing an existing
bug where it's silently dropped), SSE-handler matching, backend and
frontend e2e coverage, and the space picker UI, per the approved
design spec.

Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
… triggers

Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
@LukasHirt
LukasHirt force-pushed the feature/event-trigger-space-scope branch from 8721660 to 6b07942 Compare July 24, 2026 21:06
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