Skip to content

feat(routes)!: createMailboxRoutes(deps) replaces mountMailbox - #37

Merged
TheGreatAxios merged 1 commit into
cl-9229-mailbox-remove-schema-and-internal-constants-from-barrelfrom
cl-9067-mailbox-replace-mountmailbox-with-createmailboxroutesdeps
Sep 27, 2026
Merged

TheGreatAxios merged 1 commit into
cl-9229-mailbox-remove-schema-and-internal-constants-from-barrelfrom
cl-9067-mailbox-replace-mountmailbox-with-createmailboxroutesdeps

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Stacked on refactor(index)!: drop schema objects and internals from the barrel #36. Merge together with docs(readme): quickstart that migrates, mounts and closes; route table #38, which updates the README.
  • createMailboxRoutes(deps): Hono<TenantEnv> returns a sub-app the host mounts with app.route; mountMailbox is deleted with no alias. MountMailboxOpts is now CreateMailboxRoutesDeps.
  • Every route goes through deps.requireGrant: reads mailbox:* read, send create, flag and move manage.
  • The principal is the tenant and principal the host's tenant middleware sets, the same one requireGrant authorizes; the resolvePrincipal option is removed. Every route returns 403 when the context carries no principal.
  • @intx/hub-api ^0.4.0 is a new peer (types only).

Verification

New tests cover the grant resource and action per route and principal resolution behind a TenantEnv middleware. CI is green on this branch: install --frozen-lockfile, build, typecheck, tests against Postgres, and the Node consumer smoke test.

Closes CL-9067
Closes CL-9070

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: the branch went through two independent review passes, and every finding is fixed. Two findings were waived after a senior ruling: the README stays stale on #37 until #38 lands, and the default resolver has no null guard because TenantEnv guarantees tenant and principal. Build, typecheck and 171 tests pass against real Postgres.

@TheGreatAxios
TheGreatAxios force-pushed the cl-9067-mailbox-replace-mountmailbox-with-createmailboxroutesdeps branch from abb20e4 to 826be3d Compare September 25, 2026 17:52
@TheGreatAxios
TheGreatAxios force-pushed the cl-9067-mailbox-replace-mountmailbox-with-createmailboxroutesdeps branch from 826be3d to 111e81b Compare September 26, 2026 01:28
@TheGreatAxios TheGreatAxios changed the title feat(routes): createMailboxRoutes(deps) replaces mountMailbox feat(routes)!: createMailboxRoutes(deps) replaces mountMailbox Sep 26, 2026
@TheGreatAxios
TheGreatAxios added this pull request to stack #47 September 26, 2026 01:58
The routes are now a Hono<TenantEnv> sub-app the host mounts with
app.route, the shape Interchange's own route factories use. Every route
is gated through deps.requireGrant on mailbox:* (read, create for send,
manage for flag and move). The principal comes only from the tenant and
principal the host's tenant middleware set, the same one requireGrant
authorizes; every route returns 403 when the context carries none.

Closes CL-9067, CL-9070.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9067-mailbox-replace-mountmailbox-with-createmailboxroutesdeps branch from 111e81b to eafd2ea Compare September 26, 2026 02:40
@TheGreatAxios
TheGreatAxios removed this pull request from stack #47 September 26, 2026 02:40
@TheGreatAxios
TheGreatAxios added this pull request to stack #50 September 26, 2026 02:40
@TheGreatAxios
TheGreatAxios merged commit d27de68 into main Sep 27, 2026
2 checks passed
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