validating-and-publishing-canvases

Validate, publish, and promote versioned PostHog canvas projects with guarded conflict handling.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill validating-and-publishing-canvases
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: validating-and-publishing-canvases
Source: https://github.com/PostHog/posthog-foss/tree/main/products/canvas/skills/validating-and-publishing-canvases
Command: npx skills add https://github.com/PostHog/posthog-foss --skill validating-and-publishing-canvases

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Publishing a PostHog canvas involves version guards, capability declarations, queued server-side builds, and conflict recovery; doing it wrong can silently overwrite concurrent work or leave a stale canvas after a failed build. This Skill walks through the full lifecycle so every publish is safe and verified.

Core Features & Use Cases

  • Capability declaration and validation: Inventory every insight, capture event, inline query, agent request, and network origin, then iterate on canvas-validate-create diagnostics until clean.
  • Guarded publishing and drafts: Publish with expected_current_version_id, or stage a draft build and promote it only after user approval, with capability_widening surfaced before promotion.
  • Build monitoring and conflict recovery: Poll canvas-builds-retrieve until the build is terminal, retry 429 capacity limits, and recover from 409 version conflicts by re-reading and re-applying edits.
  • Use Case: After editing a canvas that already has a live version, stage a draft, wait for its build to become ready, show the user the widened capabilities, and promote only on approval.

Quick Start

Validate my canvas project, stage it as a draft build, and tell me when the build is ready to promote.

Frequently Asked Questions about validating-and-publishing-canvases

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I publish a PostHog canvas without overwriting concurrent edits?

Pass expected_current_version_id from canvas-source-retrieve with every canvas-publish-create call. The server rejects the publish with a 409 if the head moved, so your edit can never silently clobber another publish or revert.

How do I stage a canvas change without making it live?

Use canvas-draft-create with the complete project to stage a draft build that never becomes the head. After its build is ready and the user approves, call canvas-promote-create with the live expected_current_version_id to make it live.

Why does my canvas fail validation with capability_missing errors?

The host enforces declared capabilities, so every insight id, capture event, inline query, agent request, and network origin in your code must be listed in project.capabilities. Inventory all literal URLs and ph calls, declare them, and re-run canvas-validate-create.

What network origins are allowed in canvas capabilities?

Only exact public HTTPS origins with scheme, host, and optional port are accepted. Loopback, private IPs, single-label names, and .local, .localhost, .internal, and .home.arpa suffixes are rejected with an invalid_network_origin error.

What should I do when a canvas publish returns 409 version_conflict?

A 409 means the canvas head moved past your base. Re-read the source with canvas-source-retrieve, re-apply your edits onto the fresh head while preserving others' changes, and publish again with the new current_version_id.

Why is my canvas still showing the old version after publishing?

A publish only queues a server-side build; the canvas updates when that build reaches ready. Poll canvas-builds-retrieve until terminal, and if the build failed, fix the diagnostics and publish again since a failed build never replaces the last good one.