Managing Endpoint Versions

作者 PostHog469d1773e9cb无许可证收录于 2026年10月8日更新于 2026年10月8日

Work safely with endpoint versions — preview a draft in the playground, roll back to an older version, update settings on one version without bumping query history, deactivate a specific version. Use when the user asks "how do I roll back my endpoint", "preview my changes before publishing", "I want to fix v5 without bumping the version", or anything involving the version history. Calls out today's limitations honestly: there is no pointer flip; "rollback" means forking the old query into a new top version.

仅含说明DevOps & Cloud
AI 生成的概览

指导如何安全处理端点版本:预览、回滚、单版本设置与停用。

功能
该技能是一份仅含说明的端点版本管理指南,介绍版本模型与操作流程。它说明查询修改会自动生成新版本,而设置修改只就地更新指定版本,且模型只能向前推进,没有指针切换。内容涵盖预览变更、通过把旧查询派生为新顶层版本实现回滚、更新单个版本的设置、停用单个版本以及清理未使用版本,并列出相关工具与限制,例如没有真正的草稿或预发布环境概念。
适用场景
当用户询问如何回滚端点、发布前预览变更、在不提升版本号的情况下修改某个版本的设置,或停用某个版本而不影响其他版本时使用。也适用于版本历史、将调用方固定到某个版本,或清理陈旧版本的问题。
运行要求
不附带脚本,仅为说明文档。假定可访问端点相关工具,如 endpoint-versions、endpoint-get、endpoint-update、endpoint-run 和 execute-sql,并提到 posthog-cli 的 endpoints 命令。

Managing endpoint versions

This skill is the practical guide to endpoint versioning. It covers the today-workflow, which has some sharp edges worth being explicit about.

When to use this skill

  • "How do I roll back to v3?"
  • "I want to test changes before they go live"
  • "How do I update the description / data_freshness_seconds on a specific version?"
  • "Can I disable v4 without affecting v5?"
  • The user is uncertain whether a query change will cut a new version

Versioning model — what to know

BehaviourReality
Query changeAuto-cuts a new version. Saving any edit to the query creates a new version and bumps the current version number
Settings change (description, data_freshness_seconds, materialisation)Does not cut a new version. Updates the targeted version in place
The "current" versionAlways the highest version number — it's not a pointer you can move backwards
Calling without ?version=NRuns the latest version. So unpinned callers always hit the newest
Disabling the whole endpointendpoint-update with is_active: false (no version) takes every version offline at once
Disabling a single versionendpoint-update with version + is_active: false retires one version without affecting the others

The model is forward-only. There is no "make v3 the default again" operation today. Practically this means "rollback" requires either creating a new top version that re-uses the old query, or pinning callers to ?version=N.

Available tools

ToolPurpose
endpoint-versionsList all versions for an endpoint, latest first
endpoint-getFull config; supports ?version=N to fetch a specific version
endpoint-updateThe workhorse — supports version body param to target a specific version
endpoint-runExecute a version directly via ?version=N (without affecting which version other callers hit)

Workflows

Previewing a draft before publishing

There is no "draft" concept in the model. Editing the query commits it as a new version immediately. To preview safely:

  1. Test the new query first with the execute-sql tool (or the SQL editor) — not on the live endpoint
  2. When ready, update the endpoint — this creates the new version automatically
  3. Use endpoint-run with ?version=N to confirm the new version returns what you expect
  4. Old callers still hit the latest version (which is now your new version) — there is no "soft launch"

If the user needs a true staging endpoint, the only workaround today is a sibling endpoint with a _v2 or _staging suffix. Document this honestly — there is no in-product staging path.

Rolling back to an older version

The forward-only model means "rollback" requires forking:

  1. endpoint-versions to find the version with the good query (say v3)
  2. endpoint-get with ?version=3 to retrieve that version's query JSON
  3. endpoint-update with the v3 query as the new query — this creates a new version (e.g. v6) with the same query as v3
  4. All callers without ?version=N now hit v6 (== v3's query)

The old version (v5, the broken one) still exists and is still callable via ?version=5 until explicitly deactivated.

Faster mitigation if you can change every caller: have them pin to ?version=3 until a real fix is ready. Lower-impact than cutting a new version.

Updating settings on a specific version

endpoint-update accepts a version field in the body. When set, settings updates apply to that version only — they do not cut a new version. Useful when:

  • Bumping data_freshness_seconds on an old version that some callers still pin to
  • Adjusting description on a historical version for clarity
  • Changing materialisation state per version (the materialisation is per-version anyway)

Important: passing query together with version is rejected — query changes always cut a new top version, never modify history. The version arg only affects settings.

Deactivating a single version

To take v3 out of service while keeping v4 and v5 callable:

text
endpoint-update {name: "...", version: 3, is_active: false}

This sets is_active: false on v3 only. Callers pinned to ?version=3 start getting an error; other callers are unaffected.

To re-enable: same call with is_active: true.

The whole-endpoint is_active field (without version) is a separate switch — it disables every version at once. Use the version-scoped form for surgical takedowns.

Pruning unused versions

Old versions accumulate over time. To find which are dead, call endpoint-versions and read each version's last_executed_at: a version that's null or long stale hasn't been called recently. Materialised dead versions are the costly ones — disable their materialisation with endpoint-update + version + is_materialized: false, and deactivate with is_active: false to signal they're retired.

Confirm with the user before retiring a version: last_executed_at counts only personal-API-key calls and is recorded only for runs since that tracking was added (so a used version can still read null), and a caller may be pinned to ?version=N. The full audit flow lives in auditing-endpoints.

Example interaction

text
User: "I shipped a broken query last night, v5. How do I roll back?"
Agent:- endpoint-versions <name> → v5 (latest), v4, v3, v2, v1- endpoint-get <name> ?version=4 → query JSON for v4- "Rolling back means creating v6 with v4's query. v5 stays as a   historical version but nobody hits it unless they explicitly   pass ?version=5. Sound right?"- User confirms- endpoint-update <name> {query: <v4 query>} → creates v6- endpoint-run <name> ?version=6 to confirm shape- "Done. v6 is live with v4's query. Want me to also deactivate v5   so it's clear it's defunct?"- User: "Yes"- endpoint-update <name> {version: 5, is_active: false}

Important notes

  • There is no pointer flip. "Rolling back" creates a new version. The version number is always going up. If the user is uncomfortable with the resulting history noise, that's a fair concern — surface it honestly.
  • A query change always creates a new version. Updating settings on the side does not. If the user wants to fix a typo in v5's description without bumping to v6, use the version param.
  • Disabling a single version only blocks that version. It doesn't change which version runs by default — that's always the highest version number.
  • Materialisation is per-version. Each version has its own materialised view named {endpoint_name}_v{version}. Disabling materialisation on one version doesn't affect others.
  • Pinning is the safety net — push callers to use it. Callers that pin to ?version=N are insulated from query edits; unpinned callers always hit the latest and can be surprised by a new version. Encourage consumers to pin, validate a new version, then bump the pin deliberately.
  • The CLI manages versions too. posthog-cli exp endpoints {pull,push,diff} lets the user keep endpoint definitions as YAML in version control and review changes before pushing — a cleaner workflow than editing live when query changes need review.
  • Activating an older version is not yet a product feature. If the user repeatedly wants this — flip a pointer rather than fork — surface it as a feature gap (and nudge the team via agent-feedback). Don't pretend endpoint-update does it.

来源与署名

来源:PostHog/ai-plugin位于skills/managing-endpoint-versions提交469d177

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架

更多来自 PostHog/ai-plugin 的技能

Writing Simplified Technical English

PostHog

应用 ASD-STE100 简化技术英语规则,让智能体撰写的文字含义明确、便于执行。

Writing & Content2026年10月8日

Working With Task Comments

PostHog

通过 PostHog MCP exec 调度器读取并解读 PostHog 任务、产物和画布上的评论。

Productivity & Workflow2026年10月8日

Working With Skills

PostHog

指导智能体使用 PostHog 的 skill-* MCP 工具来发现、读取、创建、更新和重构技能。

AI & Agents2026年10月8日

Working With Scouts

PostHog

关于如何把监控任务委派给 PostHog Signals 侦察代理、处理其报告并长期调校整个代理集群的操作手册。

AI & Agents2026年10月8日

Validating And Publishing Canvases

PostHog

Validate and publish a canvas source project safely: the source-project shape, declared capabilities, reading the current version pointer, iterating on validation diagnostics, guarded publishing with expected_current_version_id, staging a draft build and promoting it, waiting out the queued build, and recovering from a 409 version_conflict or a 429 capacity limit without overwriting concurrent work. Use whenever a canvas edit is ready to save, a draft build is wanted, a canvas publish or build returns diagnostics or a conflict, or a task needs to understand canvas version history.

待分类2026年10月8日

Understanding Billing Usage

PostHog

Explains PostHog billing usage and spend from the customer's visible Billing MCP tools. Use when the user asks why usage or spend is high, which product or project is driving usage, what a usage type means, how to reduce usage, what changed over time, why they got a usage change alert, or whether a spike/drop alert was real or noisy. Also use before product-specific analytics skills when the user names a billable PostHog product metric such as events, recordings, feature flag requests, exceptions, survey responses, synced rows, logs, AI events, AI credits, or Inbox credits. Starts from Billing usage/spend tools, then routes to customer-visible product MCP surfaces for deeper investigation.

待分类2026年10月8日