learning_ai_notes/backend/src/modules
saravanakumardb1 1258d49488 feat(backend): emit task.created + workspace.created events; add share revocation regression test
Sprint B — closes audit items B6 (event-bus completeness) and B3
(public-share revocation regression).

Event bus:
- note-tasks/repository.ts createNoteTask now emits task.created with
  taskId, noteId, workspaceId, userId, title
- workspaces/repository.ts createWorkspace now emits workspace.created
  with workspaceId, userId, name

The event-bus already declared these event types (event-bus.ts) and
webhook subscribers can target them, but they were never emitted —
making the contract dead. Emissions follow the same .catch(() => {})
pattern used by note.created/updated/deleted in notes/repository.ts so
a subscriber failure cannot break the create flow.

Regression tests:
- note-tasks/repository.test.ts and workspaces/repository.test.ts
  exercise the emission paths end-to-end through the in-memory
  datastore.
- note-shares/repository.integration.test.ts adds a 5-test integration
  suite for the public-share revocation path: token resolves before
  revocation; token returns null after deleteShare (hard delete);
  expired token returns null; cross-product token rejected;
  listSharesForNote does not include revoked shares.

Verified:
- pnpm --filter @notelett/backend run test: 380/380 (was 373, +7 new)
- pnpm run verify end-to-end green
2026-05-22 23:23:08 -07:00
..
ecosystem-phase1 fix(notes): preserve phase1 transcript event lineage 2026-04-03 17:40:59 -07:00
ecosystem-phase3 feat(phase3): wire notelett trail import route 2026-04-04 00:33:38 -07:00
intake feat(data): add seed bootstrap strategy 2026-05-05 13:45:43 -07:00
note-agent-actions fix(security): encrypt sensitive note metadata 2026-05-05 10:12:40 -07:00
note-artifacts fix(security): encrypt sensitive note metadata 2026-05-05 10:12:40 -07:00
note-collaborators fix(sharing): harden note share revocation flows 2026-05-05 12:25:16 -07:00
note-prompts feat(data): add seed bootstrap strategy 2026-05-05 13:45:43 -07:00
note-relationships fix(backend): fix trackEvent call signature and route registration tests 2026-03-31 01:00:32 -07:00
note-shares feat(backend): emit task.created + workspace.created events; add share revocation regression test 2026-05-22 23:23:08 -07:00
note-tasks feat(backend): emit task.created + workspace.created events; add share revocation regression test 2026-05-22 23:23:08 -07:00
note-versions feat: implement WEB_AI_FAST_ROADMAP (web + backend + docs) 2026-03-31 13:00:36 -07:00
notes fix(sharing): harden note share revocation flows 2026-05-05 12:25:16 -07:00
palace fix(lint): clear production lint blockers 2026-05-05 14:04:49 -07:00
saved-views feat: add DELETE endpoints, role enforcement, telemetry and feature flags 2026-03-29 20:47:12 -07:00
workspaces feat(backend): emit task.created + workspace.created events; add share revocation regression test 2026-05-22 23:23:08 -07:00
repository-scope.test.ts test(backend): document cosmos query scope 2026-05-05 11:17:27 -07:00