pythia-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeploying a Release
部署发布版本
Announce at start: "Using pythia-deploy — previewing every statement in the release first."
Phase: Ask → Do — the whole ordered set is previewed and approved once, then run step by step
A release script run with has no snapshot, no
preview, no verify and no record of what landed before line 212 failed.
runs the same file through the write path, statement by
statement, so a failure stops cleanly with an exact list of what landed and
how to undo it.
sqlplus @release.sqlpythia deploy开始时声明: "正在使用 pythia-deploy —— 首先预览发布版本中的每条语句。"
阶段: Ask → Do —— 先对整个有序语句集完成一次预览和批准,再逐步运行
使用 运行发布脚本时,没有 snapshot、preview、verify,也不会记录第 212 行失败之前哪些内容已成功落地。 会让同一个文件通过写入路径逐条运行,因此一旦失败便可安全停止,并精确列出成功落地了哪些内容,以及如何撤销。
sqlplus @release.sqlpythia deployThe Iron Law
铁律
A RELEASE RUNS IN ORDER, AS PREVIEWED, AND STOPS AT THE FIRST BROKEN STEPA RELEASE RUNS IN ORDER, AS PREVIEWED, AND STOPS AT THE FIRST BROKEN STEPHow a script is read
脚本的读取方式
- One statement per for SQL; PL/SQL units (
;) end at a line holding onlyCREATE ... PROCEDURE / FUNCTION / PACKAGE / TRIGGER / TYPE. A/or;inside a literal or a comment is text./ - SQL*Plus directives (,
SET,PROMPT,SPOOL,SHOW ERRORS,WHENEVER, …) run nothing on the database: they are skipped and listed.DEFINE - /
@fileincludes are refused — list the files instead; deploy never runs a path nobody looked at.@@file - Refused, never skipped: anonymous blocks (as in
BEGIN ... END;),apply/EXEC/HOST, andCONNECT— it would silently change how every later statement runs, which no preview can show.ALTER SESSION - Files run in the order given. A directory runs in natural name order when
every file is numbered (,
1_,02_, Flyway's10_), otherwise by what each file creates — tables, indexes, comments, types, views, specs, procedures, bodies, triggers, grants, data. The preview says which.V3__
- 对于 SQL,每个 对应一条语句;PL/SQL 单元(
;)以一行中只有CREATE ... PROCEDURE / FUNCTION / PACKAGE / TRIGGER / TYPE的形式结束。 字面量或注释内的/或;视为文本。/ - SQL*Plus 指令(、
SET、PROMPT、SPOOL、SHOW ERRORS、WHENEVER、…)不会在数据库上执行任何操作:它们会被跳过并列入清单。DEFINE - /
@fileinclude 会被拒绝——应改为列出文件;deploy 绝不会运行任何未经查看的路径。@@file - 拒绝而非跳过:匿名 块(与
BEGIN ... END;中一样)、apply/EXEC/HOST和CONNECT——它们会静默改变后续每条语句的执行方式,而任何 preview 都无法呈现这种变化。ALTER SESSION - 文件按给定顺序运行。当目录中的每个文件都有编号(、
1_、02_、Flyway 的10_)时,目录按名称的自然顺序运行;否则按每个文件创建的对象排序——表、索引、注释、类型、视图、spec、procedure、body、trigger、grant、数据。preview 会说明采用了哪种顺序。V3__
The Workflow
工作流
- Assemble the files in the order they must run; impact
() for every existing object the release changes.
pythia-impact - Lint the set: — errors are fixed before the preview, not after.
pythia lint <files> - Preview: . Nothing is written. Relay it verbatim: each statement's group, object, lines changed, impact,
pythia deploy <files>and lint lines, the diffs. Policy refusals arrive before anything runs — relay them; the developer decides.! DESTRUCTIVE - Ask once — the preview prints a deploy token (10 hex). The developer
approves it through one door: the tool, an
pythia_approvewhose text isAskUserQuestionverbatim, orpythia approve --card <token>in their terminal.pythia approve <token> - Run: — the same file list. Each statement goes through snapshot → apply → verify with its own journal entry. Read the exit code, unpiped:
pythia deploy <files> --confirm <token>all landed ·0refused (nothing after it ran) ·1written but broken (stopped there).3 - Report every statement's result. On a stop: what landed stays landed
(DDL commits itself); the rest of the approval is withdrawn; the output
lists the undo commands newest first, which landed statements have no
undo, and the to resume with. Fixing forward or restoring is the developer's call.
--from N
Under an autopilot lease () that covers every
statement, step 3 lands the release directly; if any statement is not
covered the whole release falls back to preview, and the output says which
one and why.
pythia-autopilot- 组装:按必须运行的顺序整理文件;对发布版本所修改的每个现有对象执行 impact
()。
pythia-impact - Lint 这一组文件:——在 preview 之前修复错误,而不是之后。
pythia lint <files> - Preview:。不会写入任何内容。请逐字转述 preview:每条语句所属的 group、object、变更行数、impact、
pythia deploy <files>和 lint 行、diff。策略性拒绝会在任何内容运行之前返回——请转述这些拒绝;由开发者决定。! DESTRUCTIVE - 只询问一次——preview 会打印一个 deploy token(10 个十六进制字符)。开发者通过一个统一入口完成批准:
工具、一个文本逐字为
pythia_approve的pythia approve --card <token>,或者在终端中运行AskUserQuestion。pythia approve <token> - 运行:——使用同一个文件列表。 每条语句都会依次经过 snapshot → apply → verify,并各自生成一条 journal entry。读取退出码时不要使用管道:
pythia deploy <files> --confirm <token>全部执行成功 ·0已拒绝(其后没有任何内容运行) ·1已写入但损坏(已在此处停止)。3 - 报告每条语句的结果。发生停止时:已成功落地的内容会保留(DDL 会自动提交);
本次批准中其余语句的授权会被撤回;输出会按从新到旧的顺序列出 undo 命令、哪些已落地语句没有 undo,
以及恢复执行时使用的 。是向前修复还是恢复,由开发者决定。
--from N
在覆盖每一条语句的 autopilot lease()下,步骤 3 会直接执行该发布版本;如果有任何语句未被覆盖,整个发布版本都会回退到 preview,输出会说明是哪一条语句以及原因。
pythia-autopilotRe-running after a stop
停止后重新运行
The statements before the stop are in the database; ,
and inserts cannot run twice. Fix the failing statement,
then — a fresh preview and a fresh
approval for the rest. A backfill that needs a column added earlier in the
same release cannot be measured before the DDL exists: deploy the DDL, then
the data part with .
CREATE TABLEALTER TABLE ADDpythia deploy <files> --from <N>--from停止之前执行的语句已经进入数据库;、 和 insert 操作无法运行两次。修复失败的语句,然后运行 ——剩余语句需要一次全新的 preview 和新的批准。某个 backfill 如果依赖同一发布版本中更早添加的列,那么在 DDL 存在之前无法对其执行度量:先部署 DDL,再使用 部署数据部分。
CREATE TABLEALTER TABLE ADDpythia deploy <files> --from <N>--fromRed Flags — STOP if you catch yourself thinking
危险信号——如果你发现自己在想以下内容,请立即停止
| Thought | Reality |
|---|---|
| "Faster to run it in sqlplus" | And no snapshot, no verify, no record of where it stopped. The hook denies it anyway. |
| "Statement 7 failed, skip it and continue" | The rest was ordered on top of it. Stop, report, let the developer decide. |
| "The includes are fine, I wrote them" | Deploy runs what was listed and previewed. List them. |
| "One approval covered the release, so I can edit a file and re-run" | The token binds the previewed content. Edited → preview again. |
| "Exit 3 on the last statement, everything else is fine" | Written but broken. Report it as broken, with the undo list. |
| 想法 | 实际情况 |
|---|---|
| "用 sqlplus 运行会更快" | 而且没有 snapshot、没有 verify,也没有停止位置的记录。hook 无论如何都会拒绝它。 |
| "第 7 条语句失败了,跳过它继续执行" | 后续语句依赖它。停止并报告,由开发者决定。 |
| "include 没问题,是我写的" | Deploy 只运行已列出并预览过的内容。请将它们列出来。 |
| "一次批准覆盖了整个发布版本,所以我可以修改文件后重新运行" | token 与已预览的内容绑定。修改后必须重新 preview。 |
| "最后一条语句的退出码是 3,其他都没问题" | 已写入但损坏。按损坏状态报告,并附上 undo 列表。 |
When NOT to use this skill
不应使用此 skill 的情况
- One statement in one file → .
pythia-apply - Designing the tables or packages inside the release → ,
pythia-table; this skill only lands them.pythia-package
- 一个文件中只有一条语句 → 。
pythia-apply - 设计发布版本中要包含的表或 package → 、
pythia-table;此 skill 只负责将它们落地。pythia-package