feat(staging-check): ORCH-048 B6 reads registry via GET /projects, not local import
B6 built the project registry by importing src.projects locally (host-path hack
+ importlib.reload), so it evaluated ORCH_PROJECTS_JSON from the launcher's
process-env. On the deployer's canonical host run that var is unset → built-in
default (ET+ORCH) → false FAIL even when staging isolation is healthy.
- Add read-only additive endpoint GET /projects (src/main.py) returning
known_plane_project_ids + {plane_project_id, repo, work_item_prefix, name}
of the live process; no secrets. Existing routes unchanged.
- Rewrite B6 to fetch GET {base}/projects via the same stdlib _get helper as
A/B4/B5/C; drop the host-path hack and importlib.reload (launch-invariant).
- Isolate the verdict in pure _evaluate_b6(known) -> (passed, detail); contract
unchanged (PASS iff SANDBOX in known and prod ET/ORCH absent). Endpoint
degradation (non-200 / missing key / bad body / network) → deterministic FAIL.
- src/projects.py and .env* untouched.
Docs (golden source): API table + staging-gate B6 mechanic in
docs/architecture/README.md; B6 description + isolation row in
docs/operations/STAGING_CHECK.md; CHANGELOG entry.
Tests: tests/test_staging_check_b6.py (TC-01..TC-07), tests/test_projects_endpoint.py.
Refs: ORCH-048
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
| Блок | Название | Что проверяет |
|
||||
|------|----------|---------------|
|
||||
| A | SMOKE | `/health`, `/queue`, `ORCH_STAGING=true` |
|
||||
| B | ACCESS | Plane sandbox (R), Gitea sandbox (R+push), реестр проектов |
|
||||
| B | ACCESS | Plane sandbox (R), Gitea sandbox (R+push), реестр проектов (B6 — по HTTP `GET /projects`) |
|
||||
| C | E2E | Создать задачу → триггер конвейера → ветка + коммент → cleanup |
|
||||
|
||||
Exit code: **0** = все PASS, **non-zero** = есть FAIL.
|
||||
@@ -64,6 +64,13 @@ docker exec orchestrator-staging \
|
||||
--mode stub
|
||||
```
|
||||
|
||||
> **B6 инвариантен к способу запуска (ORCH-048).** Чек реестра больше не импортирует
|
||||
> `src.projects` локально (раньше: host-path хак `/repos/orchestrator` + reload, который
|
||||
> читал env *процесса-запускателя* — на host-запуске без `ORCH_PROJECTS_JSON` это давало
|
||||
> ложный FAIL). Теперь B6 запрашивает `GET {base}/projects` у работающего инстанса, поэтому
|
||||
> одинаково корректен и с хоста, и из `docker exec`. ADR:
|
||||
> `docs/work-items/ORCH-048/06-adr/ADR-001-b6-registry-via-http-endpoint.md`.
|
||||
|
||||
---
|
||||
|
||||
## Режимы (`--mode`)
|
||||
@@ -116,7 +123,7 @@ hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
|
||||
| Проверка | Гарантия |
|
||||
|---------|---------|
|
||||
| A3 `ORCH_STAGING=true` | При false — abort до деструктивных блоков |
|
||||
| B6 Реестр без боевых | ET/ORCH project_id absent в `known_plane_project_ids()` |
|
||||
| B6 Реестр без боевых | ET/ORCH project_id absent в `known_plane_project_ids` живого инстанса (читается по HTTP `GET /projects`, не локальным импортом) |
|
||||
| C: only SANDBOX project_id | Webhook payload указывает только `8c5a3025-...` |
|
||||
| C: only orchestrator-sandbox repo | Gitea operations на `admin/orchestrator-sandbox` |
|
||||
| C: cleanup в finally | Артефакты удаляются даже при ошибке |
|
||||
|
||||
Reference in New Issue
Block a user