Publish contribution API and pull invalidation - #86
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3bfeb34b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Reviewed against the PR 3 contract from #82, independently verified on Contract conformance — this closes out the #82 PR 1–3 sequence properly:
One substantive follow-up (not merge-blocking, but it will bite the first real notepad user):
Notes for the record (non-blocking):
Verdict: merge after deciding how to track #1. With this, the RFC's core is delivered end-to-end — kernel (#83), unified transport + panel/fab (#84), public API + invalidation + exemplar (#86) — and the remaining roadmap items are exactly the two gated ones: assets (blocked on the #85 auth decision for the public surface) and webviews (threat-model review). |
|
Follow-up to my earlier review — four additions requested before merge. Context: a live incident on the dev instance (extension calling a bridge method the running server didn't have) exposed platform gaps that this PR — as the debut of the public API — is the right and cheapest place to close. Full mechanics below each ask. 1. Durable runtime-error surface for extension event handlersToday an error thrown in an extension's event handler (e.g. Ask: per-session ring buffer (last ~20) of (Full atomic/transactional registration — rolling back a handler's contributions on throw — is deliberately not asked here: it requires extension attribution in the registry, which is the extension-identity work already gating assets. Observability now, atomicity with identity.) 2.
|
|
Addressed the complete follow-up review in
Also documented extension-prefixed contribution keys and clarified which policy fields are executable versus structural contract metadata. Validation:
|
|
Re-verified on
Also unasked-for but correct: the git-tab host gained the same request-generation guard as the panel host, fixing a latent pre-existing bug where a slow stale tab response could clobber the current view. Two nano-notes for the record, neither blocking:
Ready to merge. With this, the #82 PR 1–3 sequence closes with the public API born self-describing and observable — the two properties the live incident proved matter most. |
|
Follow-up (post-merge, separate small PR): make the new API discoverable to agents. While validating this PR I checked what an agent session actually knows when a user asks it to build a pi-web extension. Findings:
Proposed follow-up (deliberately not this PR): extend the proven mechanism rather than invent a parallel one.
Cheap validation once it lands: spawn a fresh session with "build me a pi-web extension that adds a panel" and check it produces a Filing this as a comment rather than an ask on this PR to keep #86's scope closed — it's ready to merge as-is per the review above. |
Summary
Completes PR 3 from #82 on top of the unified contribution transport in #84.
Public contribution API
ctx.ui.web.contribute(key, spec)with explicitslotandkindcontribute(key, undefined)clears itset*API as a typed compatibility wrapper through the same normalization pathPull invalidation
ctx.ui.web.update(key)web_contribution_updated { sessionId, key }only for registered keysExecutable policies
Exemplar
Adds the recovered global notepad as a public-API exemplar. It uses:
panelcontributionfablauncherupdate()fan-out so writes refresh every live open notepad panelThe exemplar accounts for most of the line count and is intentionally included now: unlike PR 2, invalidation is present, so it proves the live cross-session contract rather than distracting from transport review.
Assets and webviews remain deferred behind their separate security/design gates.
Testing
web_contribution_updatedValidation:
npm run typecheck✅npm run test:unit✅ — 327 testsnpm run build✅npm test✅ — build, auth, unit, desktop, tablet, and mobile suitesCloses the initial public API + invalidation sequence in #82.