Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add the Simulation Entrypoint's own Postgres schema, persistence library and migration chain

已关闭
#844 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #847 来自 @anth-volk —— 已关闭,未合并

评估

难度
5/5
预计耗时
一周以上
新手友好度
15/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
github-actions, google-cloud, postgresql, python

调研方向

Start by reading the repository rule sim.stage12.no-migration-chain and the existing migration and deploy workflows. The issue names libs/policyengine-simulation-persistence, migrations/, and GET /ready as the main entry points; map their existing conventions before changing them. Done means the migration chain passes upgrade, check, downgrade, and upgrade on fresh PostgreSQL, deploy applies it before the candidate, and the existing pass-through routes and Stage 12 comparison still behave as before.

由索引模型根据 Issue 内容生成。

描述

Context

Step 1 of the API v2 migration (item 1A-2) gives the Simulation Entrypoint its own durable state in the v2 Postgres database. Today the repository rule sim.stage12.no-migration-chain forbids any Alembic chain here: the only tables the simulation services touch are the temporary Stage 12 comparison tables, which the Public API owns and migrates.

Scope

  • Replace sim.stage12.no-migration-chain with ownership rules for the Simulation Entrypoint's own schema:
    • one Alembic chain at migrations/, schema simulation, version table simulation.alembic_version;
    • the Modal executor and gateway never depend on the persistence library;
    • no Modal secret or deployment receives a simulation database URL (the Stage 12 secret stays the only database credential in Modal until Stage 12 is removed).
  • Add libs/policyengine-simulation-persistence with an initial revision, and a CI job that runs the chain's upgrade, alembic check, downgrade and upgrade on a fresh PostgreSQL.
  • Add a deploy job that applies the migrations before the Simulation Entrypoint candidate deploys, using a migrator URL that only that job receives.
  • Give the Simulation Entrypoint SIMULATION_DATABASE_URL (runtime role) from Secret Manager, and report the database's migration revision in GET /ready.

The old-gateway pass-through routes and the Stage 12 comparison must behave exactly as before; nothing in production reads or writes the new schema yet.

Operator prerequisites (both environments, before merge)

Merging to main deploys staging and then production, and the deploy requires these:

  • Create the simulation_migrator and simulation_runtime database roles in the staging and production v2 databases. simulation_migrator must be able to create the simulation schema (or the schema must be created in advance and owned by it).
  • Store the migrator URL as the SIMULATION_MIGRATION_DATABASE_URL secret in this repository's beta and prod GitHub environments.
  • Store the runtime URL in Secret Manager in the Simulation Entrypoint's Google Cloud project, readable only by sim-entry-beta-runtime and sim-entry-prod-runtime (and listable by the deploy service account), and set its name as the SIMULATION_DATABASE_URL_SECRET_NAME variable in beta and prod.
主要语言
Python
星标
1
派生
1
平均合并
1 天 21 小时
30 天内合并 PR
57

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PolicyEngine/policyengine-sim-api 的其他 Issue

查看 PolicyEngine/policyengine-sim-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。