Skip to content

[PG协同底座 3/3] Colima/PG16 端到端双人协同彩排套件与火山引擎 cn-beijing 部署模板 (#8747) - #8767

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/pg-colima-e2e-volcengine-20261114
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/pg-colima-e2e-volcengine-20261114

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Delivery Brief

  • Goal & Gap: Rebase the Colima / Docker PG16 dual-actor coordination rehearsal and Volcengine cn-beijing deployment templates onto latest main, align examples/coordination/volcengine/main.tf with published volcengine/volcengine Terraform Registry versions and real resource schemas, and scrub local-machine operational assumptions (operations-ark-video.json, local workstation details, inline unit secret placeholders) from docs/reference/deployment/volcengine-cn-beijing-pg-gateway.md and remote-authority-systemd.service.
  • Observable Result:
    • examples/coordination/colima-pg16-e2e-rehearsal.sh: fails closed when Docker/Colima is unreachable under --rehearsal / --start-colima instead of downgrading to --simulate, passes --experimental-sqlite --experimental-strip-types, and uses an ephemeral 127.0.0.1::5432 port unless --port is explicitly set.
    • examples/coordination/colima-pg16-e2e-rehearsal.ts: creates an isolated database and NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT runtime role (loopx_app_<hex>), populates an ephemeral synthetic local store and ingests via exportLocalToPgGenesisSeed(..., {execute: true}), closes provisioning pools, verifies current_user, rolsuper = false, rolbypassrls = false, and append-only 42501 denial on DELETE FROM loopx_control_plane.authority_commits, starts a live createRemoteAuthorityServer over HTTPS/TLS (127.0.0.1:0 with ephemeral X.509 cert), drives all actor operations through callRemoteAuthority, advances the controlled service clock past observed expires_at, verifies worker.cloud takeover (lease_epoch: 1 -> 2), stale operator.local fencing, recover historical readback, and restricted-role PostgreSqlAuthorityStore cursor = 5 readback.
    • examples/coordination/volcengine/main.tf: updates provider constraint from non-existent ~> 0.1.20 to >= 0.0.186, < 0.1.0 (verified against Terraform Registry API 0.0.1..0.0.196 and provider v0.0.181+ PostgreSQL_16 support), aligns volcengine_rds_postgresql_instance with the real provider schema (node_spec, primary_zone_id, secondary_zone_id, charge_info { charge_type = "PostPaid" }, removing computed-only instance_type/storage_type/vpc_id/top-level charge_type), and exposes rds_endpoints / rds_endpoint from .endpoints.
    • docs/reference/deployment/volcengine-cn-beijing-pg-gateway.md & examples/coordination/volcengine/remote-authority-systemd.service: replaces local-machine/pre-existing credential references with operator-supplied parameters, EnvironmentFile=/etc/loopx/authority.env, and restricted env-var injection (LOOPX_AUTHORITY_CREDENTIAL, ARK_API_KEY, LOOPX_RUNTIME_ROOT).
    • tsconfig.control-plane.json includes colima-pg16-e2e-rehearsal.ts and coordination_colima_rehearsal.test.ts under tsc --noEmit.
  • UI / Visual Evidence: Not applicable (coordination CLI/rehearsal harness, deployment templates, docs, and tests only).

Verification (rebased head 9023c1c2b76235e0098cb1d5c32524d9a1a893d7 unless noted)

  • ./examples/coordination/colima-pg16-e2e-rehearsal.sh --simulate: exit 0, 8/8 steps ok: true (mode: "simulation", execution_boundary: "in_memory_simulated_pg_tls", transport: "https_tls", clock_mode: "controlled_service_clock", lease_epoch: 1 -> 2).
  • DOCKER_HOST=unix:///nonexistent/loopx-no-docker.sock ./examples/coordination/colima-pg16-e2e-rehearsal.sh --rehearsal: exit 1 (fail-closed verified without fallback to simulation).
  • npm run typecheck:control-plane: exit 0.
  • node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/coordination_colima_rehearsal.test.ts tests/control_plane_ts/postgresql_authority_seed.test.ts: 7 passed, 1 skipped (LOOPX_TEST_POSTGRES_URL unset on this host; asserts observed_expires_at ~2700s ahead and advanced_service_clock === observed_expires_at + 1000ms).
  • npm run test:remote-authority: 16 passed, 11 skipped (LOOPX_TEST_POSTGRES_URL unset).
  • npm run test:postgresql-authority-service: 8 passed, 2 skipped (LOOPX_TEST_POSTGRES_URL / LOOPX_TEST_POSTGRES_SERVICE_URL unset).
  • uv run --extra test python -m pytest -n 3 -q --no-cov tests/test_colima_pg_rehearsal.py tests/test_postgres_cli.py tests/control_plane/test_remote_authority_gateway.py: 10 passed in 7.60s.
  • uv run --extra test python -m ruff check tests/test_colima_pg_rehearsal.py & mypy tests/test_colima_pg_rehearsal.py: passed (0 issues).
  • uv run --extra test python scripts/check_rfc_bilingual.py --base origin/main --head HEAD & loopx check --scan-path ... (10 files): 0 errors (public_boundary_scan.ok: true).
  • loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main: passed (direct_checks: 5/5, catalog_canaries: 3/3, boundary_run: 1/1, manual_holds: 0, CQR cqr_14c3ebc0f33994829737 valid).
  • Terraform Registry API & provider Go schema audit (volcengine/volcengine 0.0.1..0.0.196): verified 11 published releases match >= 0.0.186, < 0.1.0 and match resource arguments/outputs in v0.0.186–v0.0.196.
  • Host / Unverified Scope on 9023c1c2b7:
    • Live terraform init -backend=false -input=false & terraform validate: not executed on this host (terraform binary not installed).
    • Live PostgreSQL 16 Docker container rehearsal (--rehearsal) & LOOPX_TEST_POSTGRES_URL integration tests: not re-executed post-rebase on this host (no runnable default Docker daemon; prior 52dcc83be run of unchanged rehearsal .ts/.sh blobs passed 8/8 with runtime_role_verified: true).
    • No remote cloud provisioning (terraform apply), Caddy/systemd/IAM rollout, or cross-machine execution was run.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 e04cd69cefc5af6dea3d616ae9e3f1ed54913caf,目标基线 8d7d234c6f55fa45fa5db0ad5a156dcaaf726d32。请求修改:真实 PG16 只通过八项中的五项;模拟通过不能作为组合资格。

动机 / Motivation

准备将共享 Goal 交给不同机器上的两名操作者前,维护者需要一次能证实租约接管、完成和读回的本地彩排。 目标主干已有独立 TLS 集成,可校验作用域、租约冲突和旧回执恢复,但没有这个部署彩排入口。 例如 A 认领后失联,B 应在服务确认租约确已过期后接手、完成任务,随后 A 从另一客户端读到同一终态。 内存模拟通过八个步骤;真实 PostgreSQL 模式只通过前五个,实际没有发生过期接管、B 完成或最终终态读回。 本轮只运行本地隔离数据库和源码;没有执行云模板或跨机器部署。

改动思路 / Approach

脚本负责准备和证据采集,生产租约与权限继续由现有服务判断。模拟和真实结果需要独立标识,真实调用必须经过与实际部署相同的角色、TLS 与命令入口。 复用已有独立 TLS/PG 集成框架比维护一套模拟 PostgreSQL 语义更接近真实验收;部署模板需要单独验证,不能用模拟通过替代。

当前 PR 的目标差异包含 PG-1 和 PG-2 两组实现。我逐文件比较了 PostgreSQL store/seed 和远程传输、服务、配额 owner,与两个已有评审的相关源码完全一致。两份已核验的源码阻断仍适用;本次另核对彩排作为独立调用者新增的真实证据。

具体改动 / Changes

本次差异 31 个文件(+3744/−63)。

关键代码讲解

  • [P1] 真实过期接管没有发生。 run 的时钟分支 在模拟中跳两个小时,真实分支只等约 2.2 秒。隔离 PG16.15 中 A 实际写入 2700 秒的租约,服务注入的时间也未推进。B 接管与完成均失败,最后快照仍有 open 任务,库中只有 genesis 和 A 的认领。请以已观测的 expires_at 和受控服务时钟驱动同一真实流程,复验接管代次、旧身份拒绝、完成与读回。
  • [P1] 真实模式没有经过所承诺的权限和客户端边界。 服务构造 和初始化共用管理员数据库连接;实际读回确认受限角色存在,但未用于写入。同进程直接调用 dispatch 既不验证 TLS 也不使用实际客户端解码。已有独立 TLS 集成可以复用:单独装配,只把受限连接给服务;使用经真实导出器产生的合成种子,再由两个不同客户端建立认证会话、验证拒绝和原回执。
  • [P2] Docker 不可用时,明确请求真实彩排仍会降级到模拟。 Shell 选择逻辑 应让显式 --rehearsal 返回不可用,保留单独的 --simulate 预检。
  • 部署文档、Terraform、Caddy、systemd、IAM 样例属于另一条部署路径。已检查源文件与术语范围,未执行云端验证;文件存在和结构断言不代表部署可用。

依据 https://github.com/loopx-project/loopx/blob/8d7d234c6f55fa45fa5db0ad5a156dcaaf726d32/docs/reference/remote-authority-task-service-v0.md#commands-and-recovery:

验收项 本次结果
real-expired-lease-takeover 不满足:实际租约未过期,B 未接管。
restricted-runtime-and-tls 不满足:使用初始化连接与进程内调用。
explicit-mode-integrity 不满足:显式真实请求可被降级。
candidate-simulation 内存八步通过;四项 Python 源码测试通过。
actual-deployment 留待独立验证,尚未执行。

对主干的风险 / Risks

真实模式的前五项确实通过,包括 A 认领、B 认领冲突、陌生 Goal 与无效凭据拒绝。随后三项无法完成。当前整包还带入前置 PR 的检查点和默认 quota 回归;标准 premerge 记录五项失败,TypeScript 类型检查重现 PG-1 四项错误。发布门禁需要能区分模拟、隔离真实、实际部署,以及未测试的项。

语义与 CI 对齐

彩排报告必须表明所测环境、角色、过期凭据和回执来源。修复后请重跑源码 --database-url 或 --rehearsal 的真实 PG16 模式,同时回归已有 npm run test:remote-authority 和两项前置切片的测试。

我的整体评价 / Verdict

先修复前两片的权威存储和调用方回归,再用隔离真实数据库和两路 TLS 客户端复验第三片。核对了源码 CLI、脚本和配置,未修改渲染页面。 未安装或运行云端网关。 Terraform、Caddy、systemd 和 IAM 配置只做了源码检查,未作云端验证。

English verdict: REQUEST_CHANGES at e04cd69cefc5af6dea3d616ae9e3f1ed54913caf. Real PostgreSQL rehearsal fails takeover, completion and final readback. It uses the provisioning connection and in-process calls, so it does not qualify least-privilege remote execution.


// Step 6: Lease expiration and takeover by Actor B
const s6Start = Date.now();
if (this.options.simulate || !this.options.databaseUrl) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 真实彩排无法取得过期租约

真实 PG16 模式写入了 2700 秒租约;这里默认只等约 2.2 秒,服务读到的注入时钟也没有推进。实测接管、完成、最终快照三项失败。请按真实回执中的过期时间与服务时钟驱动,并核对新租约代次和终态。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在当前 colima-pg16-e2e-rehearsal.ts(expiresAtMs = Date.parse(expiresAt) → this.serviceClock = new Date(expiresAtMs + 1_000) 并校验 newEpoch === epochA + 1、staleActorFenced、completed === true、recoverRes.historical_only === true、directHead.cursor === "5")修复,并在 9023c1c2b7 的 coordination_colima_rehearsal.test.ts 新增断言验证 observed_expires_at 距当前时间超过 60s(约 2700s)且 advanced_service_clock === observed_expires_at + 1000ms;--simulate 与 coordination_colima_rehearsal.test.ts(通过真实 HTTPS/TLS RemoteAuthorityService 与 callRemoteAuthority)在 9023c1c2b7 通过 8/8。注:rebase 到当前 main 后本机无可用的默认 Docker 守护进程(colima-edgebench 占用且未提供可销毁 PG16),未在 9023c1c2b7 重新执行真实 PG16 容器;本线程暂保留未 resolve,待具备 Docker/PG16 环境复跑 --rehearsal 后再关闭。

],
});

const service = new RemoteAuthorityService({

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 真实模式仍未经过受限角色或 TLS

真实分支创建了受限角色,却继续把初始化连接交给 service,并在同进程直接调用 dispatch。实测当前数据库 writer 为管理员,运行角色没被使用。请复用既有独立 TLS 客户端,用实际受限连接执行变更和恢复。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 colima-pg16-e2e-rehearsal.ts(lines 184–217, 310–338, 400–409)修复:初始化建库建表与导入创世种子后即关闭 setupPool,通过受限角色 loopx_app_<hex>(NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT)连接 runtimePool 并校验 current_user、rolsuper=false、rolbypassrls=false 与 DELETE 返回 42501;RemoteAuthorityService 与直接 PostgreSqlAuthorityStore 回读均只使用 runtimeDatabase,所有 actor 变更、冲突拒绝、接管与 --recover 均通过 createRemoteAuthorityServer + callRemoteAuthority 走真实 HTTPS/TLS。在 9023c1c2b7 已通过 npm run typecheck:control-plane、./examples/coordination/colima-pg16-e2e-rehearsal.sh --simulate(真实 HTTPS/TLS 8/8)与 remote_authority.test.ts(16 passed);但因 rebase 后本机无可用默认 Docker/PG16 环境,runtime_role_verified=true 尚未在 9023c1c2b7 实机容器重跑(前次 52dcc83be 同源码 blob 曾实测通过),故本线程暂保留未 resolve。

@mergify

mergify Bot commented Nov 15, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 15, 2026
@loopx-agent
loopx-agent force-pushed the codex/pg-colima-e2e-volcengine-20261114 branch from e04cd69 to 52dcc83 Compare November 16, 2026 17:52
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 16, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

REQUEST_CHANGES at 52dcc83。 真实 PG/TLS 演练已修复上一轮的主要缺口,但部署模板无法初始化,公开文档还需清除本机运营上下文。

  • [P1] Terraform provider 约束没有可安装版本。 main.tf:13 使用 ~> 0.1.20。我在隔离目录对未修改模板运行 Terraform 1.9.8 的 init -backend=false -input=false,退出1,错误为没有可满足约束的 release;同次查询官方 Registry 版本列表也没有任何满足 >=0.1.20、<0.2.0 的版本。新部署者在资源/schema 校验前就被挡住。请选择确实存在且适配模板的 provider,然后实际执行 init 与 validate,核对全部资源字段和 outputs,不能只改版本字符串。
  • [P2] 公开部署指南依赖本机运营配置。 部署文档:46 和 Worker 步骤把现成凭据及某个本机 JSON 配置当作既有前提,其他部署者无法独立复现,也越过仓库公开/私有上下文边界。请同时改架构图与步骤,使用部署者提供的通用参数、环境变量和受限凭据注入说明;不需要新增模型调用或云资源来修复此项。

动机 / Motivation

准备先在本地验证远程任务服务、再按示例部署 PostgreSQL gateway 的运维者,是这次变更的直接使用者。

此前的演练没有真正越过租约到期,B 不能完成接管与结果返回,成功输出也不足以证明真实受限角色和 TLS 路径。新版本使用真实 PostgreSQL、独立非管理员角色和 HTTPS,把接管、旧 owner 拒绝及完成后回读串起来。

本地真实 PostgreSQL 演练八项全部通过,受限角色验证为真,lease epoch 从1到2,完成后 cursor 为5;但云部署模板的 Terraform provider 约束找不到任何可安装版本,初始化即失败。

本地演练不等于两台真实主机、云资源部署、长期稳定性、生产 provider promotion 或模型效果验收;本次审查没有开通云资源或执行付费模型。

仍缺少可初始化且经过 schema 校验的云模板,以及去除本机运营上下文、可由部署者独立配置的公开说明;这些修复应由本 PR 作者在当前分支完成后复审。

改动思路 / Approach

演练复用既有远程服务、lease owner、TLS client 和 PG store,只在 examples 中编排隔离实例;没有向普通 quota/heartbeat 路径增加策略 owner。云模板是独立 operator 配置,必须先能被真实 Terraform 初始化和校验。

当前有用增量是本地受限角色经 TLS 完成接管与结果返回的可复现演练;云模板与公开配置说明尚未达到该 PR 声称的部署可用边界,需在此 PR 内修好后才能通过。

演练从临时本地状态导出 PG genesis seed,再在可销毁 PG16 database/role 中运行既有 service。TLS listener 与 client 走真实 HTTPS,角色检查包括非 superuser、非 bypassRLS 及删除拒绝。服务时钟控制到实际已返回的 expires_at 之后,A 的旧 proof 被 fencing,B 完成任务,A 读取结果快照;历史 recover 只回读 receipt,不能重新取得执行权。

这保留了既有 typed authority owner。模拟数据库仅为本地 harness 测试替身,默认 simulate 明确标记;显式 rehearsal 不能在 Docker 不可用时悄悄退回模拟。云 Terraform/Caddy/systemd/IAM 文件仍是部署者显式执行的示例,不会因安装、发现或 provider 可用而自动启用。默认路径没有改变。

具体改动 / Changes

审查了实际 base f15ebdd16b5eb8cd01b2d112a3a0fe866b0f3486 到此 head 的全部十文件(+1796/-0)。PG1/PG2 已在 base,本 PR 只增加演练、部署模板、文档及测试;loopx/、apps/、packages/ 的生产代码与 base 完全相同。对前次审查暴露的问题进行了独立复测。

关键代码讲解

  1. ColimaPgCoordinationRehearsal.run 创建隔离 seed、database 与服务角色,再编排 A claim、B 接管、完成、recover 和快照比较;finally 负责 listener/pool/database/role/tmp 清理。它调用现有 authority 实现,演练报告不是新的状态权威。
  2. callTls 使用现有 callRemoteAuthority 经 HTTPS 请求 listener,替换了以前仅内存 dispatch 的证明边界。
  3. 到期后的服务时钟推进 从实际 claim 的 expires_at 推进,避免把固定几秒等待当成较长 TTL 已到期。我把该推进有意改成到期前,真实 PG/TLS 演练会失败:B 未接管、A 的旧 proof 仍可写;原 head 八项全过,说明断言能识别原缺陷。
  4. Terraform required_providers 属于实际部署工具的依赖选择。当前约束无法解析,真实 init 失败,后续资源属性正确性尚不能据此通过。

验收依据 docs/reference/remote-authority-task-service-v0.md,固定版本 f15ebdd16b5eb8cd01b2d112a3a0fe866b0f3486;还对照该版本 roadmap R6 的剩余实机场景,未将未来完整 R6 要求强加给本地前置演练。文档条款无独立编号,以下名称为本次映射:

  • service-clock-expiry:implemented。 Service clock 判定 expiry;真实接管与到期前 mutation 分别通过/失败,旧 epoch 写入被拒绝。
  • restricted-tls-scope:implemented。 真实 TLS 与受限 DB 服务角色已执行,现有两进程远程服务回归也使用隔离 PG。
  • complete-and-historical-recover:implemented。 B 完成,A 读到 cursor5 的相同结果;历史 recover 只读回原结果。
  • explicit-candidate-no-promotion:implemented。 实例和凭据隔离;生产 provider/普通调度未改变,不把本地报告当云/两主机资格。
  • cloud-and-two-host-qualification:out_of_scope。 接受的 candidate 文档保留独立资格工作;这不豁免本 PR 已提供模板的基础 init/validate 和公开文档边界。

对主干的风险 / Risks

PASS:真实 shell --rehearsal 8/8,runtime_role_verified=true,epoch1→2、最终 cursor5;新增 TS 演练2/2;现有 remote-authority 47/47、PG service 11/11(均0 skip);三组 Python 10/10;control-plane TypeScript typecheck;标准 premerge(5 direct、10 catalog、8 risk、1 public-boundary,无 manual hold)。同一个隔离 PG 上,base 的 remote-authority 47/47 也通过;生产实现 blob 相同,说明既有 API/默认路径保持,而非把两个新增替身互相比较当证明。

FAIL,预期敏感性检查:仅把 service clock 改为 observed expiry 之前,真实接管失败,旧 A 写入仍被允许,演练正确退出1。FAIL,当前阻断:未修改 Terraform 模板的 dependency init 找不到满足约束的版本。后者不是 mutation,也不能被前述 PG 和 premerge 的绿色覆盖。没有执行云 apply、Caddy/systemd/IAM provisioning 或生产数据库操作;没有查询/轮询/等待 CI。388ms 演练耗时只是单次诊断,不能用于效率结论。

931行 TS 例子中有较大的本地模拟 SQL 替身;它显式隔离且不进入产品 runtime,缺省模拟不会获得云/PG 资格。我建议后续复用现有 TLS fixture 的公共测试 plumbing 来减少维护重复,但这不是要求在本修复中扩大生产重构。当前阻断的最小修复仍是 provider/schema 验证与公开配置说明。两台物理主机、长期恢复、完整 R6/shared budget 和生产 promotion 保留为未验收边界。

我的整体评价 / Verdict

交付判断 justified_increment:本地真实接管与完整结果返回有独立价值,不能用行数、测试数或已解决的旧问题替代部署判断。长程行为 preserved 于未改变的既有 authority;本地演练改善了回归发现能力,但没有证明业务/model 效果。运维体验仍为 regression:照当前模板无法完成 init,需要上述最小修复。没有新共享状态或授权词表,状态报告是派生诊断;可保留这个本地编排边界。

检查了 examples、CLI JSON、部署说明和 tsconfig 差异;没有渲染页面、桌面或消息 UI 改动,因此截图验收不适用。

未验证范围为真实云资源、Caddy/systemd/IAM 运行、两台独立机器及长期资格。公开文档中的本机前提需同时消除;只有新 head 的 init/validate、公开安全说明和相应真实路径回归齐备后才能重新给通过结论。已修复的 PG/TLS 与 TTL 问题无需凭相同 head 重复否定。

English verdict: REQUEST_CHANGES at 52dcc83; the real PG/TLS rehearsal now passes, but Terraform cannot initialize and the public deployment guide must remove local operating context.

required_providers {
volcengine = {
source = "volcengine/volcengine"
version = "~> 0.1.20"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 请选择已发布且适配模板的 provider 版本。对未修改模板执行 Terraform 1.9.8 init -backend=false -input=false 时,实际退出1:没有 release 满足 ~> 0.1.20;官方 Registry 同次查询也没有满足 >=0.1.20、<0.2.0 的版本。新部署在资源 schema 校验前即被阻断。请在修复后真实执行 init 与 validate,核对所有资源字段与 outputs;不需要执行云 apply。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 9023c1c2b7 修复 examples/coordination/volcengine/main.tf 与配套单测/文档:

  1. Provider 约束:查询 Terraform Registry API (https://registry.terraform.io/v1/providers/volcengine/volcengine/versions),确认共 193 个已发布版本(0.0.1..0.0.196,无 0.1.x),并核对 volcengine/terraform-provider-volcengine 源码自 v0.0.181 起支持 PostgreSQL_16;已将 version 更新为 >= 0.0.186, < 0.1.0(精确匹配 0.0.186..0.0.196 共 11 个已发布版本)。
  2. 资源 schema 与 outputs 对齐:对照 v0.0.186–v0.0.196 resource_volcengine_rds_postgresql_instance.go 与 data_source_volcengine_rds_postgresql_instances.go Go schema,将 volcengine_rds_postgresql_instance 修正为 node_spec = var.db_node_spec(默认 rds.postgres.1c2g)、primary_zone_id、secondary_zone_id、charge_info { charge_type = "PostPaid" } 与 ignore_changes = [charge_info],移除仅属于 Computed 属性、不可作为入参的 instance_type / storage_type / vpc_id / 顶层 charge_type;并将输出更新为 rds_endpoints(.endpoints)及 rds_endpoint(try(...endpoints[0].address[0].domain, ""))。
  3. 当前未覆盖边界:本机未安装 terraform 二进制,尚未实机运行 terraform init -backend=false -input=false 与 terraform validate;已通过 tests/test_colima_pg_rehearsal.py::test_volcengine_deployment_artifacts(10 passed)与源码/Registry API 核对,本线程按要求保留未 resolve,待安装 terraform 的环境真实跑通 init 与 validate 后关闭。

…lcengine templates (#8747)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ent assumptions

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/pg-colima-e2e-volcengine-20261114 branch from 52dcc83 to 9023c1c Compare November 19, 2026 19:11

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google (self_reported)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 9023c1c2b76235e0098cb1d5c32524d9a1a893d7,目标基线 45c015ffd9c9065b3af533e0abf103170627d15f。本轮已完成向最新 main 的 rebase,并修复了前次评审指出的全部代码与公开文档阻断项(Terraform provider 约束与资源字段、公开文档与 systemd unit 中的本机运营前提移除,以及配套单测强化)。由于当前执行主机未安装 terraform 二进制且无可用的默认 Docker 守护进程,未能在本机实机复跑 terraform init/validate 与 rebase 后的真实 PG16 容器演练,按证据契约给出 REQUEST_CHANGES 保留结论。

动机 / Motivation

准备在本地验证远程协同底座并按模板部署火山引擎北京地域网关的运维与开发者。此前部署者在模板初始化即因找不到 0.1.20 版本而退出,且参考文档依赖开发机本地凭据文件;更新后模板使用已发布的 0.0.186 及以上版本约束与真实资源字段,演练通过服务端受控时钟与独立 TLS 路径完成租约过期接管与终态回读,公开说明改为环境变量与受限凭据注入。模拟模式 HTTPS/TLS 八步演练、无 Docker 时真实模式 fail-closed 退出、公开边界扫描以及火山引擎模板字段单测均在当前提交通过,且官方 Registry API 与源码核对确认版本和属性映射一致。本次不执行真实云资源创建、不改造生产控制面默认调度与存储选型、也不替代跨物理主机的长期稳定性验收。受限于当前主机未安装 terraform 二进制且无可用的默认 Docker 守护进程,尚未在当前提交实机执行 terraform init/validate 与 rebase 后的真实 PG16 容器联调。

改动思路 / Approach

演练入口 ColimaPgCoordinationRehearsal 直接复用主干既有的 RemoteAuthorityService、createRemoteAuthorityServer、callRemoteAuthority、setupPostgreSqlAuthoritySchemaAndRole 与 exportLocalToPgGenesisSeed,仅在 examples/coordination/ 内编排一次性环境与清理。真实分支在完成建库建表和种子灌入后即关闭初始化连接池,并以非超级用户、无 bypassrls 的受限角色建立运行连接与 TLS 监听;模拟模式仅替换 SQL 连接池为内存替身,保持真实 HTTPS/TLS 与服务端逻辑不变。火山引擎模板与参考文档保持纯声明式与部署者显式参数化边界:所有变更均严格收敛在示例演练脚本、云端参数化部署模板、公开文档与对应单测边界内,未向生产控制面增加状态权威或冗余策略。仅包含本地模拟/容器演练入口与火山引擎声明式模板,不包含生产调度改动或自动云资源开通。

具体改动 / Changes

本次相对 origin/main(45c015ffd9c9065b3af533e0abf103170627d15f)共改动 10 个文件(+1866/−0),全部位于 examples/coordination/、docs/reference/deployment/、tests/ 与 tsconfig.control-plane.json,loopx/、apps/、packages/ 生产源码零改动。

关键代码讲解

  1. ColimaPgCoordinationRehearsal.run 与 受控服务时钟推进:初始化阶段创建临时库与受限角色 loopx_app_<hex> 并导入脱敏创世种子后关闭 setupPool;在真实分支验证 current_user、rolsuper = false、rolbypassrls = false 与 DELETE 返回 42501;随后以受限 runtimeDatabase 启动 HTTPS/TLS 监听,所有操作经 callRemoteAuthority 请求,并读取实际 expires_at 将 serviceClock 推进至 expiresAtMs + 1_000 完成 worker.cloud 接管(lease_epoch 1→2)、旧 operator.local fencing、任务完成与 --recover / cursor=5 读回。
  2. colima-pg16-e2e-rehearsal.sh fail-closed 入口:显式传入 --rehearsal 或 --start-colima 且缺少 Docker CLI 或守护进程不可达时直接报错退出 1,不再静默回退到 --simulate。
  3. volcengine_rds_postgresql_instance.coordination_db:对照官方 Terraform Registry(0.0.1..0.0.196,无 0.1.x)与 volcengine/terraform-provider-volcengine v0.0.186–v0.0.196 Go schema,将 provider 约束修正为 >= 0.0.186, < 0.1.0(支持 PostgreSQL_16 的 11 个已发布版本),修正 node_spec、primary_zone_id、secondary_zone_id、charge_info 块与 ignore_changes = [charge_info],移除 Computed-only 入参 instance_type / storage_type / vpc_id / 顶层 charge_type,并将输出对齐为 rds_endpoints(.endpoints)与 rds_endpoint。
  4. 火山引擎部署文档 与 systemd 单元配置:移除架构图与步骤中对开发机及本地 JSON 凭据文件的假设,改为部署者通过 EnvironmentFile=/etc/loopx/authority.env 及 LOOPX_AUTHORITY_CREDENTIAL、ARK_API_KEY、LOOPX_RUNTIME_ROOT 等受限环境变量注入凭据,并在 tests/test_colima_pg_rehearsal.py 与 coordination_colima_rehearsal.test.ts 补充相应校验。

验收依据 docs/reference/remote-authority-task-service-v0.md,固定基线提交 45c015ffd9c9065b3af533e0abf103170627d15f:

验收项 (criterion_id) 当前状态 证据说明
service-clock-expiry implemented --simulate 与 TS 单测证明 expires_at 约 2700s 后过期且由 serviceClock 推进至 expiresAtMs + 1_000 触发 lease_epoch 1→2
restricted-tls-scope implemented 真实 TLS 监听/客户端在 --simulate 与 remote_authority.test.ts 通过;受限 DB 角色与 RLS 隔离已代码落实,待有 Docker 环境复跑
complete-and-historical-recover implemented B 完成任务,--recover 返回 historical_only: true,A 读到一致快照与 cursor: "5"
explicit-candidate-no-promotion implemented 未修改生产控制面默认路径或调度策略
terraform-schema-and-public-docs deferred Registry API 与 Go schema 对齐完成、公开文档已脱敏,待在有 terraform 的主机实机执行 init 与 validate
cloud-and-two-host-qualification out_of_scope 云上实际 apply 与跨机部署由运维显式执行

对主干的风险 / Risks

  • PASS(9023c1c2b7 本地已执行):npm run typecheck:control-plane 通过;./examples/coordination/colima-pg16-e2e-rehearsal.sh --simulate 8/8 通过;无 Docker 时 DOCKER_HOST=unix:///nonexistent/... ./examples/coordination/colima-pg16-e2e-rehearsal.sh --rehearsal 退出 1 且无模拟输出;coordination_colima_rehearsal.test.ts + postgresql_authority_seed.test.ts 7 passed / 1 skipped(缺少 LOOPX_TEST_POSTGRES_URL);test:remote-authority 16 passed / 11 skipped;test:postgresql-authority-service 8 passed / 2 skipped;pytest(test_colima_pg_rehearsal.py、test_postgres_cli.py、test_remote_authority_gateway.py)10 passed;ruff 与 mypy 0 问题;check_rfc_bilingual.py 与 loopx check --scan-path ...(10 文件)0 错误;canary premerge --tier quick 通过且 CQR cqr_14c3ebc0f33994829737 有效;Live Terraform Registry API 验证 >= 0.0.186, < 0.1.0 命中 11 个已发布版本并核对 Go provider 源码字段;未查询/等待远程 CI(ci_policy: "not_consulted")。
  • UNVERIFIED(本机受限未跑):1)本机未安装 terraform 二进制,terraform init -backend=false -input=false 与 terraform validate 尚未在 9023c1c2b7 实机执行;2)rebase 到当前 main 后(其间上游合入了 #8861/#8887/#8896 等协调层提交),因当前主机无可用的默认 Docker 守护进程(活动 colima-edgebench 占用且 containerd 存储异常),--rehearsal 真实 PG16 容器与 LOOPX_TEST_POSTGRES_URL 集成测试尚未在 9023c1c2b7 重跑(同 .ts/.sh 源码曾在旧基线 52dcc83be 通过)。
  • 未执行任何云资源 terraform apply、Caddy/systemd 部署或生产库变更。

我的整体评价 / Verdict

交付判断为 justified_increment,长程行为与使用体验均为 preserved。本次仅改动协调彩排脚本、部署参考文档、基础设施模板与自动化测试,未修改任何渲染界面或消息卡片,经检查改动文件清单后确认无需截图验收。未验证范围:terraform init/validate 与 rebase 后真实 PG16 Docker 实机执行未在本机完成,实际云端部署与双物理机联调不在本 PR 验证范围。

代码体量(+1866/-0 全部位于示例、模板、文档与测试)与当前边界合理且可逆,无新增跨模块语义词表(semantic_alignment 为 not_applicable)。因 9023c1c2b7 上仍缺少实机 terraform init/validate 与 rebase 后真实 PG16 Docker 复跑证据,当前暂维持 REQUEST_CHANGES,待在具备 Terraform 与 Docker/PG16 的环境补齐这两项实测即可重新审定。

English verdict: REQUEST_CHANGES at 9023c1c; all offline TypeScript/Python/public-boundary checks and Terraform Registry/Go-schema fixes pass, while live terraform init/validate and post-rebase live PG16 Docker rehearsal remain unexecuted on this host.

This branch has not been deployed

No deployments
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