Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7f3f1a3
chore(solo-transition): retire /ND and enable TRAE SOLO mode (#35)
jhackuy Aug 21, 2026
00cbcfd
Merge pull request #36 from jhackuy/milestone/1-org-scope-foundation
jhackuy Aug 21, 2026
82af6d3
feat(projection): add reopen_closed_projections reverse-path seam
Aug 22, 2026
7f58b2f
feat(expense): close 3 Truth gaps — reverse reopen task / claim fail …
Aug 22, 2026
d922810
feat(reports): migrate Deps to Membership role + 6 reports org_id fai…
Aug 22, 2026
aeecf7b
feat(operations): Deps -> Membership.role + tasks/quick/copilot full …
Aug 22, 2026
ae5ea57
feat(tasks): D2-B legacy write 405 deprecate + read fail-closed scope…
Aug 22, 2026
dd92168
test(m003): 9 targeted tests — expense 3 Truth gaps + Reports/Operati…
Aug 22, 2026
e41533e
ci(pasay-gate): add M003 tests to backend pytest; timeout 12m->15m
Aug 22, 2026
247066a
fix(expense): fail_payment_claim use membership.org_id + explicit ass…
Aug 22, 2026
d4440ea
chore(governance): establish single canonical constitution chain for …
Aug 22, 2026
39f6333
fix(expense): fully_paid never closes repair — create canonical verif…
Aug 22, 2026
ee3067f
fix(ci): pasay-gate AGENTS.md grep updated to Permanent Engineering T…
Aug 22, 2026
9469b14
fix(operations): quick views + digest org scope fail-closed via membe…
Aug 22, 2026
3680471
test(m003): T3 rewrite — fully_paid schedules followup, does not clos…
Aug 22, 2026
e2abc1e
fix(projection): reopen_closed_projections savepoint + dedupe conflic…
Aug 22, 2026
349f6ce
fix(m004,closeout): schedule_inspection savepoint inner tx boundary -…
Aug 24, 2026
a5cfd6c
test(m004,closeout): savepoint precise anti-tests: concurrent race no…
Aug 24, 2026
47e8692
fix(savepoint,closeout,return1): test_14/test_15 deterministic before…
Aug 24, 2026
ae1e68d
fix(worker,closeout,return1): explicit 7-key Container envVars + mask…
Aug 24, 2026
f3e8938
test(worker,closeout,return1): 14 RETURN-1 CLOSEOUT scenarios (31/31)…
Aug 24, 2026
268fb0b
test(closeout,return1,p019): thread-local dep override so /internal/i…
Aug 24, 2026
4af3285
test(worker,p019,closeout,return2): 6-key envVars assertions + p019 n…
Aug 24, 2026
66afd43
merge: no-ff origin/feature/telegram-ui-v2 into milestone/backend-fin…
Aug 24, 2026
180d3f8
merge(no-ff): origin/milestone/3-expense-scope-hardening into milesto…
Aug 24, 2026
42b10bd
feat(core): resolve_org_membership supports SystemReader
Aug 25, 2026
8b888c6
test: harden 27 files for P2b-3 convergence (r66 961 passed)
Aug 25, 2026
02672c3
ci(infra): add 13-gate backend-freeze-gate workflow
Aug 25, 2026
97f6e1b
ci(infra): fix backend-freeze-gate DOOR-02 runner missing _fresh script
Aug 25, 2026
411abed
ci(infra): fix backend-freeze-gate DOOR-04 container name interpolation
Aug 25, 2026
29501b0
fix(auth): fail closed on ambiguous SystemReader organization scope
Aug 25, 2026
7f6e795
fix(ci): freeze-gate NUM_TABLES EMPTY_STARTUP DOOR-12 Fail-Closed
Aug 25, 2026
1171b7f
fix(auth): fail-closed 4 endpoints + Assignee same-org ACTIVE members…
Aug 25, 2026
865ec61
fix(minor): 10 minor lint test docs + regression fixtures
Aug 25, 2026
4f478f8
test(org-boundary): 6 cross-org counterexamples + 4 fixture integrity…
Aug 25, 2026
97ad3fc
fix(ci): freeze-gate container_name github_expr docker-run diagnostic…
Aug 25, 2026
4c59cd4
fix(critical): use OperationalTaskPriority.medium instead of non-exis…
Aug 25, 2026
e3d454c
fix(org): fail-closed org scope for copilot/gen/quick/summary/reports…
Aug 25, 2026
2ee5669
test(conftest): DB-name fullmatch guard + org fixture idempotent sear…
Aug 25, 2026
0b93114
test(truth): Decimal-only monetary fields, tz-aware datetimes, remove…
Aug 25, 2026
fd7ed29
test(ret3): add 24 precise regression anti-tests for 28 C/M/m review …
Aug 25, 2026
870203b
fix(ci,worker): mask quoted JSON secrets in error logs + CI timeout r…
Aug 25, 2026
86491b3
fix(ret3,phase6): 10 second-pass CodeRabbit actionables (4M + 6m) on …
Aug 25, 2026
240ed93
fix(ret3,final-fix): CodeRabbit Review 5025626354 (2026-08-26) 16 ac…
Aug 26, 2026
5e238eb
ci(pr-ci, pasay-gate): align PASAY_TEST_DB_NAME (pasay_gate_001) wit…
Aug 26, 2026
f76d165
fix(ci): use isolated database name in pasay-gate
Aug 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
386 changes: 386 additions & 0 deletions .github/workflows/backend-freeze-gate.yml

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pasay-gate:
name: pasay-gate
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 45
env:
PYTHONPATH: ""
services:
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
grep -q "route:dev" GITHUB_DEV_WORKFLOW.md
grep -q "ready-for-owner" GITHUB_DEV_WORKFLOW.md
grep -q "CodeRabbit and \`pasay-gate\` run in parallel" GITHUB_DEV_WORKFLOW.md
grep -q "Long-Term Engineering Rules" AGENTS.md
grep -q "Permanent Engineering Truths" AGENTS.md
grep -q "GitHub Issue 是唯一任务 ID" README.md
grep -q "pasay-gate" README.md

Expand All @@ -109,21 +109,22 @@ jobs:
run: |
python -c "import app.main, fastapi, alembic, sqlalchemy; print('BACKEND_IMPORT_SMOKE_OK')"

- name: Run backend targeted pytest (Issue #18 + Issue #31 + M1 + M002 Rent/Repair)
- name: Run backend targeted pytest (Issue #18 + Issue #31 + M1 + M002 + M003)
if: steps.changed.outputs.backend == 'true' || steps.changed.outputs.cloudflare == 'true'
env:
DATABASE_URL: "postgresql+psycopg2://postgres:postgres@localhost:5432/postgres"
DATABASE_URL_UNPOOLED: "postgresql+psycopg2://postgres:postgres@localhost:5432/postgres"
PASAY_TEST_DB_NAME: "pasay_pm_test"
PASAY_TEST_DB_NAME: "pasay_pm_ci_${{ github.run_id }}_001"
TELEGRAM_BOT_TOKEN: "fake-token-for-ci-pass-12345"
TELEGRAM_WEBHOOK_SECRET: "fake-webhook-secret-for-ci"
PASAY_CONTAINER_INGEST_TOKEN: "fake-ingest-token-for-ci"
PASAY_RUNTIME_MODE: "ci"
timeout-minutes: 12
timeout-minutes: 40
run: |
# Legacy P0 gates: Issue #18 (telegram webhook) + Issue #31 (prod arch closeout)
# M1 org-scope P0 regression (milestone/1)
# M002: Rent closure + Repair closure + Expense payment truth + Repair AI employee
# M003: Expense Truth Closure + Reports/Operations/Legacy Scope Unified Hardening
python -m pytest \
tests/test_telegram_webhook_p018.py \
tests/test_prod_arch_closeout_p0_031.py \
Expand All @@ -133,6 +134,7 @@ jobs:
tests/test_rent_closure_m2.py \
tests/test_repair_closure_m2.py \
tests/test_fix3_blockers_m2.py \
tests/test_m003_expense_scope_hardening.py \
-v --tb=short -q

- name: Install bot dependencies
Expand Down
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,25 @@ pasay-telegram-bot/.pytest_tmp/
.audit/
.build/
.research/

# PASAY-BACKEND-FINAL-CLOSEOUT-001-RETURN-1: IDE agent state, Worker npm artifacts, local scratch
.agents/
node_modules/
**/node_modules/
*.bak
*.bak-*
*.swp
*.swo
*~

# PASAY-BACKEND-FINAL-CLOSEOUT-001-PHASE-2: local diagnostic / apply scripts + artifacts are
# local execution evidence, never part of the authoritative repository.
/_*.py
artifacts_*/
artifacts_*.log
artifacts_*.xml
g4_*.json
bagua.html
script.js
style.css
tests/_diag_*.py
Comment thread
jhackuy marked this conversation as resolved.
69 changes: 28 additions & 41 deletions .trae/rules/pasay-governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,31 @@
alwaysApply: true
---

# Pasay SOLO Governance

> 生效:PASAY-SOLO-TRANSITION-001 (Issue #34)
> 取代:历史 ND 微任务治理(已退役)

## Git Governance

- Use one dedicated task branch per Milestone or Issue slice (worktree 可选,不强制).
- Never force push, force-with-lease, rewrite shared history, overwrite remote-only commits, delete shared remote branches, bypass PR, or auto-merge.
- Never modify authority or base-branch business code directly; all delivery goes through PR.
- Treat Git CLI and GitHub results as authority, not IDE UI guesses.

## Task Discipline — SOLO Milestone Mode

- SOLO 先形成 Milestone 理解,合理组织交付节奏;不再机械 `1 Issue = 1 small branch = 1 PR = STOP`.
- 合理跨文件完成完整业务 Milestone(migrations / tests / reasonable refactor / bugfix)。
- 合理 Targeted tests 优先;不跑不必要的全量;真实失败不 skip/xfail 换绿。
- 如果 blocked、scope 存在真实歧义、或安全无法判定:停下并报告,不无休止探索或猜测 Owner 意图。
- 旧 Issue 的 `blocked` / `ready-for-dev` 等历史标签不驱动执行。

## Validation

- After changes, run only targeted tests and existing relevant gates for the touched scope.
- Distinguish real regression, stale test, and uncertain result explicitly.
- Never change confirmed business facts, delete tests, skip tests, or weaken behavior just to get green.

## Reporting

- Final owner-facing reports are in Chinese.
- Keep code, commands, paths, SHAs, branch names, PR URLs, and field names in English.
- Milestone / Handoff 报告给出变更摘要、Targeted tests 结果、影响文件、已知风险。

## Owner-Only Decisions

只有 Owner 决定以下事项(SOLO 不自行替代):

- 改变产品方向 / 核心业务模型
- 重新定义 Owner / Secretary / Tenant 权限边界
- 推翻冻结架构(`ARCHITECTURE_FROZEN=YES`)
- 删除现有已确认业务能力
- Merge PR、production deploy、Secrets 写入
# Pasay SOLO — Hard Safety Bans ONLY

本文件是 alwaysApply 硬安全禁令层。**只包含不可逾越的硬禁令**,不包含流程、规范、建议或任何非禁令内容。

违反以下任何一条 = 立即 FAIL CLOSED:

## 1. Git Safety
- 禁止 force push / force-with-lease / 改写共享历史
- 禁止 overwrite remote-only commits / 删除共享 remote 分支
- 禁止绕过 PR 直接修改 authority 或 base-branch 业务代码
- 禁止 auto-merge

## 2. Authority & Deployment
- 禁止 Merge PR(SOLO 不 merge;Owner 最终 merge)
- 禁止 Production deploy(SOLO 不部署)
- 禁止写入 Production secrets / credentials / 私钥到仓库

## 3. Business & Product Integrity
- 禁止自行改变产品方向 / 核心业务模型
- 禁止自行重定义 Owner / Secretary / Tenant 权限边界或角色语义
- 禁止自行推翻冻结架构(`ARCHITECTURE_FROZEN=YES`)
- 禁止删除现有已确认业务能力
- 禁止削弱已确认业务事实或核心产品规则
- 禁止 Operation ↔ Task 真值反转:Operation 永远是真值,Task 状态永远不能反向决定业务真值

## 4. Test & Validation Integrity
- 禁止删除、skip、xfail 真实失败测试来制造 PASS
- 禁止修改已确认业务事实、弱化约束或改变冻结行为来换取 green
74 changes: 53 additions & 21 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
# Pasay SOLO — AI Development Control
# Pasay — Project Constitution

TRAE SOLO 是 Pasay 的主工程执行者。本文件是 Pasay 仓库级开发控制入口。
TRAE SOLO 是 Pasay 项目的主工程执行者。本文件是 Pasay 仓库唯一的开发控制宪法(Canonical Project Constitution)。

## Canonical Rules Location
## 1. SOLO Identity

- Pasay 项目级工程规则:`project_rules.md`
- Pasay 项目完整上下文与接手合同:`SOLO_HANDOFF.md`
- 历史工作流(已退役,仅作记录):`AI_WORKFLOW_RULES.md`(HISTORICAL)、`GITHUB_DEV_WORKFLOW.md`
TRAE SOLO 是 Pasay 的主工程执行者,负责:
- 阅读代码、理解架构、制定 Milestone 技术实施计划
- 跨合理文件完成完整业务 Milestone(migrations / tests / reasonable refactor / bugfix)
- 修复普通代码、测试、类型、lint、migration 问题
- Git:branch / commit / push / PR

## Long-Term Engineering Rules(继续有效)
SOLO 不是:产品 Owner、部署运维、Code Review 最终决策者。

- Git authority and history safety are non-negotiable: no default-branch rewrite,
no force push, no shared-history rewrite, no overwriting remote-only commits.
## 2. Owner-Only Decision Boundary

只有 Owner 决定以下事项(SOLO 不自行替代):

1. 改变产品方向 / 核心业务模型
2. 重新定义 Owner / Secretary / Tenant 权限边界或角色语义
3. 推翻冻结架构(`ARCHITECTURE_FROZEN=YES`)
4. 删除现有已确认业务能力
5. Merge PR、production deploy、Secrets 写入
6. 财务/金额/核心业务规则变更

## 3. Context-Loading Chain(上下文加载顺序)

SOLO 会话启动时按以下顺序加载上下文(**本文件 = 最高权威,优先级递减**):

1. **`AGENTS.md`(本文件)** — 项目宪法:永久真相 + 身份 + 边界 + 加载指针
2. **`.trae/rules/pasay-governance.md`** — alwaysApply 硬安全禁令(Hard Bans ONLY)
3. **`project_rules.md`** — 工程执行细节参考(非宪法级,不与上两层冲突时有效)
4. **`SOLO_HANDOFF.md`** — 历史接手合同与项目快照(作背景参考,永久真相以本文件为准)
5. **`CURRENT_ARCHITECTURE.md`** — 架构冻结记录(`ARCHITECTURE_FROZEN` 条款服从 §2 Owner-Only)

旧 `.ai-control/` 目录、`AI_WORKFLOW_RULES.md`、`GITHUB_DEV_WORKFLOW.md` 全部已退役,不影响 SOLO。

## 4. Permanent Business Truths(永久产品真相,不可擅自改写)

- Operation 是真值(Truth),Task 是投影(Projection)。严禁 Task 状态反向决定业务真值。
- Business Truth First:
- Reminder / Reply / Notification ≠ Completion
- Task 只是真人动作投影;Operation CLOSED 只有现实问题真正解决才允许
- Quote(报价)≠ Expense(支出真实发生)
- Approval(审批通过)≠ Payment(钱真的付出去)
- Payment Claim(声称已付)≠ Verified Payment(到账凭证验证)
- Partial Rent(部分付款)≠ Paid(完全结清)
- 财务类型:DB `NUMERIC(14,2)`,Python `Decimal`,**禁止 float**
- 时间类型:DB `timestamptz`,Python `datetime with timezone.utc`
- 权限边界:Organization / Membership 是业务权限唯一边界(Fail-closed)
- 架构冻结拓扑:Telegram → Cloudflare Worker → Cloudflare Queue → Cloudflare Container → Neon PostgreSQL 16

## 5. Permanent Engineering Truths(永久工程真相)

- Git authority and history safety are non-negotiable: no default-branch rewrite, no force push, no shared-history rewrite, no overwriting remote-only commits.
- Never delete, skip, or xfail real failing tests just to manufacture a PASS.
- Agent self-report is never enough to claim success; independent GitHub checks,
reviews, and human acceptance remain authoritative.
- Final Owner-facing reports default to Chinese unless the task explicitly says
otherwise.

## Hard Bans(永远有效)

- No force push / force-with-lease
- No merge PR (TRAE SOLO 不 merge)
- No production deploy (TRAE SOLO 不负责部署)
- No secret write or credential commit
- No weakening confirmed business facts or core product rules
- Agent self-report is never enough to claim success; independent GitHub checks, reviews, and human acceptance remain authoritative.
- Final Owner-facing reports default to Chinese unless the task explicitly says otherwise.
- All delivery goes through PR; never modify authority or base-branch business code directly.
Loading
Loading