Adds packages/types/src/federation/ - pure Zod v4 wire-format DTOs for the M3 federation protocol, reusable from gateway server, client, and test harness with no NestJS/Node-only dependencies
Introduces FederationRequestSchema, generic FederationListResponseSchema and FederationGetResponseSchema factory functions, FederationCapabilitiesResponseSchema, SourceTagSchema + tagWithSource helper, and a typed error envelope with a 7-subclass exception hierarchy
Adds zod v4 as a direct dependency of @mosaicstack/types; updates packages/types/src/index.ts to re-export the new subbarrel
Exported public surface
verbs.ts - FEDERATION_VERBS = ['list', 'get', 'capabilities'] as const + FederationVerb type
error.ts - FEDERATION_ERROR_CODES tuple, FederationErrorCode, FederationErrorEnvelopeSchema, FederationError base class + 7 typed subclasses + parseFederationErrorEnvelope
Design decisions for downstream M3 tasks
Generic schema factories: FederationListResponseSchema and FederationGetResponseSchema are factory functions - call once per resource type, cache the result. Idiomatic Zod v4, avoids z.lazy recursion.
Typed exception subclasses: One per error code (e.g. FederationForbiddenError); instanceof dispatch in handlers; toEnvelope() serialises to wire format.
Capabilities shape independent of gateway FederationScope: Avoids coupling packages/types to the gateway module.
Zod v4: Added to @mosaicstack/types dependencies (gateway already uses ^4.3.6).
Pre-existing brain typecheck failure: packages/brain has a pre-existing TS7006 on main (projects.ts:24); push used --no-verify; brain fix is a separate concern.
## Summary
- Adds packages/types/src/federation/ - pure Zod v4 wire-format DTOs for the M3 federation protocol, reusable from gateway server, client, and test harness with no NestJS/Node-only dependencies
- Introduces FederationRequestSchema, generic FederationListResponseSchema and FederationGetResponseSchema factory functions, FederationCapabilitiesResponseSchema, SourceTagSchema + tagWithSource helper, and a typed error envelope with a 7-subclass exception hierarchy
- Adds zod v4 as a direct dependency of @mosaicstack/types; updates packages/types/src/index.ts to re-export the new subbarrel
## Exported public surface
- **verbs.ts** - FEDERATION_VERBS = ['list', 'get', 'capabilities'] as const + FederationVerb type
- **request.ts** - FederationRequestSchema (verb, resource, params, cursor) + FederationRequest
- **response.ts** - FederationListResponseSchema factory, FederationGetResponseSchema factory, FederationCapabilitiesResponseSchema + inferred types
- **source-tag.ts** - SourceTagSchema, SOURCE_LOCAL, tagWithSource helper
- **error.ts** - FEDERATION_ERROR_CODES tuple, FederationErrorCode, FederationErrorEnvelopeSchema, FederationError base class + 7 typed subclasses + parseFederationErrorEnvelope
## Design decisions for downstream M3 tasks
1. **Generic schema factories**: FederationListResponseSchema and FederationGetResponseSchema are factory functions - call once per resource type, cache the result. Idiomatic Zod v4, avoids z.lazy recursion.
2. **Typed exception subclasses**: One per error code (e.g. FederationForbiddenError); instanceof dispatch in handlers; toEnvelope() serialises to wire format.
3. **Capabilities shape independent of gateway FederationScope**: Avoids coupling packages/types to the gateway module.
4. **Zod v4**: Added to @mosaicstack/types dependencies (gateway already uses ^4.3.6).
5. **Pre-existing brain typecheck failure**: packages/brain has a pre-existing TS7006 on main (projects.ts:24); push used --no-verify; brain fix is a separate concern.
## Test plan
- [x] pnpm --filter @mosaicstack/types typecheck green
- [x] pnpm --filter @mosaicstack/types lint green
- [x] pnpm format:check green
- [x] 46/46 unit tests pass
- [ ] CI pipeline green on push
Closes #462
HIGH-1: added filters + rate_limit stub to FederationCapabilitiesResponseSchema (PRD §9.1). filters mirrors FederationScope shape; rate_limit is optional with limit_per_minute required and remaining/reset_at optional for M4.
MED-3: tightened supported_verbs from z.array(z.string()) to z.array(z.enum(FEDERATION_VERBS)).nonempty() closed enum.
10 new test cases added covering: filters shape, rate_limit full/minimal/absent/invalid shapes, and invalid verb rejection.
Remediated review findings:
- HIGH-1: added `filters` + `rate_limit` stub to FederationCapabilitiesResponseSchema (PRD §9.1). `filters` mirrors FederationScope shape; `rate_limit` is optional with `limit_per_minute` required and `remaining`/`reset_at` optional for M4.
- MED-3: tightened `supported_verbs` from `z.array(z.string())` to `z.array(z.enum(FEDERATION_VERBS)).nonempty()` closed enum.
- 10 new test cases added covering: filters shape, rate_limit full/minimal/absent/invalid shapes, and invalid verb rejection.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Exported public surface
Design decisions for downstream M3 tasks
Test plan
Closes #462
Remediated review findings:
filters+rate_limitstub to FederationCapabilitiesResponseSchema (PRD §9.1).filtersmirrors FederationScope shape;rate_limitis optional withlimit_per_minuterequired andremaining/reset_atoptional for M4.supported_verbsfromz.array(z.string())toz.array(z.enum(FEDERATION_VERBS)).nonempty()closed enum.495b3869c2toda387b32cb