Skip to content

Commit b5d9ce0

Browse files
committed
docs(p2-6): Phase 0 inventory + enqueue lease unit pin
Record wheel baseline (top-level src/), entrypoint blast radius, and release defaults. No package move. Pin Postgres enqueue lease SQL for hosts without live PG.
1 parent 4a5d524 commit b5d9ce0

4 files changed

Lines changed: 106 additions & 10 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to AgentFlow are documented in this file.
44

55
## [Unreleased]
66

7+
### Docs — P2-6 Phase 0 inventory (no package move)
8+
9+
- Baseline wheel still ships top-level `src/` (~540 in-repo `from src` lines).
10+
- Defaults recorded: `src/agentflow_runtime/` layout, one-minor shim, warnings
11+
off until Phase 2. Plan:
12+
`docs/plans/p2-6-runtime-namespace-migration.md`. Unit pin:
13+
`tests/unit/test_postgres_enqueue_lease_contract.py` (enqueue lease SQL).
14+
715
### Perf — paced 10 min @ 100 eps produce (apply ~96.5)
816

917
- Mac compose (1 Flink TM): 60 000 events at `--pace-eps 100` → produce 100.0,

‎docs/STATUS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ at 100 eps held hop/apply near 96–97 with lag → 0 after a bounded peak
7575
1. **≥ 100 eps multi-hour sustained** — 10 min paced @ 100 produce is measured
7676
(~96–97 apply/hop); multi-hour still open. Evidence:
7777
[perf/throughput-realpath-paced100-2026-07-17.md](perf/throughput-realpath-paced100-2026-07-17.md).
78-
2. **P2-6 packaging** (breaking) — rename wheel package `src` →
79-
`agentflow_runtime` with deprecation shim; plan only until a release
80-
window: [plans/p2-6-runtime-namespace-migration.md](plans/p2-6-runtime-namespace-migration.md).
78+
2. **P2-6 packaging** (breaking) — Phase 0 inventory + defaults done; Phase 1
79+
(tree/`agentflow_runtime` + shim) waits for a release branch:
80+
[plans/p2-6-runtime-namespace-migration.md](plans/p2-6-runtime-namespace-migration.md).
8181

8282
External gates remain unchanged and are listed in the README scope note:
8383
production CDC onboarding, a benchmark on production-grade hardware, and a

‎docs/plans/p2-6-runtime-namespace-migration.md‎

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# P2-6 — Runtime namespace: `src` → `agentflow_runtime`
22

3-
> Plan only. **Do not implement** until a breaking release window is
4-
> scheduled. Source of the finding: `audit_gpt_11_07_26.md` §P2-6.
3+
> Plan + **Phase 0 inventory (done 2026-07-17)**. Do **not** start Phase 1
4+
> (tree move / dual import) until a breaking release window is scheduled.
5+
> Source of the finding: `audit_gpt_11_07_26.md` §P2-6.
56
67
## Problem
78

@@ -92,10 +93,70 @@ Do not block the namespace rename on integrations publish.
9293
- [ ] bridge: `python -m agentflow_runtime.processing.bridge_consumer` (or shim module path)
9394
- [ ] CI unit + contract green; no accidental `packages = ["src"]` only
9495

95-
## Decision needed before coding
96+
## Decisions (defaults for the release window)
9697

97-
1. **Layout:** `src/agentflow_runtime/` (src-layout) vs rename tree root.
98-
2. **Shim lifetime:** one minor vs one major.
99-
3. **Warning default:** on vs off until phase 2 complete.
98+
Recorded 2026-07-17 so implementation is not blocked on recap — still **do not
99+
code Phase 1** until the release branch is opened.
100100

101-
Until those three are answered in a release ticket, leave code as-is.
101+
| Decision | Choice | Rationale |
102+
|----------|--------|-----------|
103+
| Layout | **`src/agentflow_runtime/`** (src-layout) | Keeps `src/` as the container dir; hatch packages `agentflow_runtime`; matches modern packaging without dumping the whole monorepo root. |
104+
| Shim lifetime | **One minor line** (e.g. 2.1 ships dual import; 2.2 drops `src` top-level) | Enough for first-party cutover + external consumers; not forever. |
105+
| DeprecationWarning on `import src` | **Off until Phase 2 complete**, then on by default (env `AGENTFLOW_SRC_SHIM_SILENT=1` to mute) | Avoids CI noise during mass codemod. |
106+
107+
## Phase 0 inventory — done 2026-07-17 (`main` @ `4a5d524`)
108+
109+
### Wheel today
110+
111+
```text
112+
python -m build --wheel
113+
→ agentflow_runtime-2.0.0-py3-none-any.whl (~342 KB, 145 files)
114+
top-level package dir in wheel: src/ (141 files under src/)
115+
```
116+
117+
Distribution name is already `agentflow-runtime`; only the **import package**
118+
is the generic `src`.
119+
120+
### Hatch
121+
122+
```toml
123+
[tool.hatch.build.targets.wheel]
124+
packages = ["src"]
125+
```
126+
127+
CI mypy: `mypy src/ --ignore-missing-imports` (`.github/workflows/ci.yml`).
128+
129+
### Runtime entrypoints hardcoding `src.`
130+
131+
| Kind | Hits (repo scan, excl. .venv/.git) | Examples |
132+
|------|-----------------------------------:|----------|
133+
| `python -m src.…` | 47 | bridge_consumer, local_pipeline, provision docs |
134+
| `uvicorn src.…` | 12 | `Dockerfile.api`, `docker-compose.prod.yml`, `k8s_staging_up.sh`, load/perf workflows |
135+
| `src.serving.api.main` | 100 | helm deployment + worker, benchmarks, chaos/e2e |
136+
| `src.serving.provision` | 27 | helm provision Job, tests, main lifespan notes |
137+
| `src.processing.bridge_consumer` | 11 | bridge tests, main |
138+
| `packages = ["src"]` | 6 | pyproject (+ mutants / plan / audit) |
139+
| `from src.` / `import src.` lines in `src/`+`tests/`+`scripts/` | **~540** | primary codemod surface |
140+
141+
### Helm / image (must change in Phase 1–2 with shim)
142+
143+
- `helm/agentflow/templates/deployment.yaml` → `uvicorn` `src.serving.api.main:app`
144+
- `helm/agentflow/templates/deployment-worker.yaml` → same
145+
- `helm/agentflow/templates/provision-job.yaml` → `src.serving.provision`
146+
- `Dockerfile.api` CMD → `src.serving.api.main:app`
147+
- `scripts/k8s_staging_up.sh` patch args → same
148+
149+
### Blast radius (honest)
150+
151+
- **~540** first-party import lines + **~100** `main:app` string references +
152+
helm/docker/compose.
153+
- Shim Phase 1 is mandatory; big-bang rename without shim will break every
154+
image and local `python -m` habit the same day.
155+
156+
### Phase 0 exit criteria
157+
158+
- [x] Entrypoint inventory
159+
- [x] Hatch pin confirmed
160+
- [x] Baseline wheel tree recorded (`src/` top-level only)
161+
- [x] Default decisions written (layout / shim / warnings)
162+
- [ ] Phase 1 on a release branch (not started)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Static contract: Postgres enqueue stamps claim lease (multi-pod race).
2+
3+
Live exclusivity is covered by
4+
``tests/integration/test_control_plane_postgres_live.py`` when a DSN is present.
5+
This pin keeps the INSERT shape from regressing on hosts without PostgreSQL.
6+
"""
7+
8+
from pathlib import Path
9+
10+
POSTGRES = (
11+
Path(__file__).resolve().parents[2] / "src" / "serving" / "control_plane" / "postgres.py"
12+
)
13+
14+
15+
def test_enqueue_webhook_delivery_stamps_lease_on_insert() -> None:
16+
text = POSTGRES.read_text(encoding="utf-8")
17+
assert POSTGRES.is_file()
18+
19+
start = text.index("def enqueue_webhook_delivery")
20+
chunk = text[start : start + 1400]
21+
22+
assert "lease_expires_at" in chunk
23+
assert "now() + make_interval(secs => %s)" in chunk
24+
assert "_claim_lease_seconds" in chunk
25+
assert "ON CONFLICT (webhook_id, event_id) DO NOTHING" in chunk
26+
# Winner-only inline delivery still depends on rowcount.
27+
assert "rowcount" in chunk

0 commit comments

Comments
 (0)