Skip to content

docs(server): canonicalize cross-specialism dispatch (DecisioningPlatform + holdco skill) - #1412

Merged
bokelley merged 1 commit into
mainfrom
bokelley/cross-specialism-docs
May 3, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/cross-specialism-docs

Conversation

@bokelley

@bokelley bokelley commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

The ctx.platform.<specialism> accessor item from #1387 was a documentation gap, not a missing API — the canonical patterns (class instance + `this`, or closure capture for functional adopters) already work, they just weren't explicit anywhere an adopter would look.

Changes

  • `src/lib/server/decisioning/platform.ts`

    • Adds a `### Cross-specialism dispatch` section to the `DecisioningPlatform` interface JSDoc (renders on IDE hover of the interface). Shows both patterns with code, calls out that in-process calls bypass wire-side validation / idempotency dedup / mutating-tool annotations.
    • Adds `@see` JSDoc pointers on `campaignGovernance?:` and `brandRights?:` fields — the two symbols an adopter is most likely to hover when stuck on the canonical case (`acquireRights` consulting `checkGovernance`).
  • `skills/build-holdco-agent/SKILL.md`

    • Expanded `§ Cross-specialism dispatch` section. Pattern A (class + `this`) shown with the multi-tenant adapter as the reference. Pattern B (closure capture) shown with explicit "no runnable example ships; Pattern A is canonical" note so functional adopters know where to look.
  • `.changeset/cross-specialism-dispatch-docs.md` — patch.

Path-1 vs Path-2

`ctx.platform` as a typed accessor (Path 2) was considered. Rejected because:

  • An in-process cross-specialism call bypasses wire validation regardless of how you reach it (`this` or `ctx.platform`) — the new accessor wouldn't change the safety surface, just shorten the call site.
  • Threading a runtime platform handle onto every `RequestContext` conflates build-time platform composition with per-request context; existing `this` / closure patterns are idiomatic TypeScript and already work.
  • The original complaint was "feels undocumented," which reads as a docs gap, not a missing API.

If adopter feedback later signals docs aren't enough, Path 2 remains available — this PR doesn't lock anything out.

Expert review

  • dx-expert: confirmed the body content is good; placement was the gap (initial draft had the JSDoc as a //-style comment inside the interface body, which doesn't render on TS hover). Fixed in this PR: lifted to interface-level `/** */`, added `@see` on the two field declarations adopters will hover.

Test plan

  • `npm run typecheck` — clean
  • `npm run format:check` — clean
  • CI passes

Tracking: #1387 (item: `ctx.platform.` accessor for cross-specialism dispatch).

🤖 Generated with Claude Code

…form + holdco skill)

The `ctx.platform.<specialism>` accessor item from #1387 was a documentation
gap, not a missing API — the canonical patterns (class instance + `this`,
or closure capture for functional adopters) already work, they just weren't
explicit anywhere an adopter would look.

This adds:

- A `### Cross-specialism dispatch` section to the `DecisioningPlatform`
  interface JSDoc (renders on IDE hover of the interface). Shows both
  patterns with code, calls out that in-process calls bypass wire-side
  validation / idempotency dedup / mutating-tool annotations.
- `@see` JSDoc pointers on `campaignGovernance?:` and `brandRights?:`
  fields — the two symbols an adopter is most likely to hover when stuck
  on the canonical case.
- Expanded `skills/build-holdco-agent/SKILL.md § Cross-specialism dispatch`
  section with both patterns, same-tenant invariant, single-specialism
  copy warning, and explicit "no runnable Pattern B example ships;
  Pattern A is canonical" note.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit 3c87198 into main May 3, 2026
10 checks passed
@bokelley
bokelley deleted the bokelley/cross-specialism-docs branch May 3, 2026 03:10
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