Skip to content

add experimental permission HttpApi slice#22385

Merged
kitlangton merged 21 commits intodevfrom
kit/permission-httpapi-spike
Apr 15, 2026
Merged

add experimental permission HttpApi slice#22385
kitlangton merged 21 commits intodevfrom
kit/permission-httpapi-spike

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented Apr 14, 2026

Summary

  • move the shared permission route DTOs to Effect Schema with derived .zod compatibility where existing Hono boundaries still need it
  • add a parallel experimental permission HttpApi slice for list and reply under the existing instance-scoped experimental surface
  • cover the new permission HttpApi list/reply/docs flow with a server test and verify the touched permission and agent tests still pass

Verification

  • bun typecheck
  • bun run test test/server/permission-httpapi.test.ts
  • bun run test test/permission/next.test.ts
  • bun run test test/agent/agent.test.ts

@kitlangton kitlangton marked this pull request as draft April 14, 2026 03:44
Base automatically changed from kit/question-httpapi-spike to dev April 14, 2026 19:43
@kitlangton kitlangton force-pushed the kit/permission-httpapi-spike branch 2 times, most recently from 1347327 to a91eba5 Compare April 15, 2026 00:44
Move the shared permission route DTOs to Effect Schema, mount a parallel permission HttpApi surface, and cover the new list/reply/docs flow with a server test.
Share the permission reply field definition between the transport body and service input schemas and align the list contract with the readonly response style used by the question slice.
Build the permission HttpApi handlers with an effectful group callback so the permission service is resolved once at layer construction time and the endpoint handlers close over the resulting service methods.
Move the permission slice onto the parallel Effect-native experimental HttpApi server, stop extending the Hono mount path for this PR, and keep the question and permission groups served through the direct Effect server boundary.
Keep the experimental Effect-native HttpApi server as an internal implementation detail for now instead of exposing it through the CLI serve command or a public env flag.
Replace the ad hoc URL and header parsing in the experimental Effect-native HttpApi server with HttpServerRequest schema decoders so the auth and instance middleware stay schema-driven and easier to reason about.
Keep only the auth_token normalization as custom router middleware and move the actual credential enforcement onto HttpApiSecurity.basic so the parallel experimental server follows the Effect-native auth pattern.
Expose the experimental permission and question HttpApi server as Effect layers and test it through NodeHttpServer.layerTest and HttpClient instead of an imperative listen API.
@kitlangton kitlangton force-pushed the kit/permission-httpapi-spike branch from 8a1796d to 94bd58f Compare April 15, 2026 02:25
…shape

- Detect string literal unions and emit z.enum() instead of z.union(z.literal())
  so JSON Schema produces { enum: [...] } not { anyOf: [{ const: ... }] }
- Add ZodOverride annotation for branded ID types so pattern constraints
  (e.g. startsWith) carry through when the walker encounters them in
  composite schemas
- Annotate all 9 ID schemas (SessionID, MessageID, PermissionID, etc.)
  with ZodOverride so patterns like ^per.* appear in OpenAPI output
- Inline Permission tool struct to avoid introducing a new named
- Remove unnecessary identifier annotation from PermissionReplied event
- Add comprehensive tests comparing bridge output to native Zod equivalents
@kitlangton kitlangton marked this pull request as ready for review April 15, 2026 21:19
@kitlangton kitlangton enabled auto-merge (squash) April 15, 2026 21:20
@kitlangton kitlangton merged commit 250e30b into dev Apr 15, 2026
10 checks passed
@kitlangton kitlangton deleted the kit/permission-httpapi-spike branch April 15, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant