Phase 2: core domain, policy engine, packet API, Clerical screen

Migration 0003: projects, aliases, renumbers, units, packets and every child table,
change orders, assets, documents, ITPs, station limits, department weld flag.
Policy package: Principal, PacketState, Action rules, custody, preconditions,
CO hold, order of checks, can/blocked/holder on reads. docs/POLICY.md with the
tightenings table for Seth. Write pipeline: FOR UPDATE, CAS on status and dept,
If-Match row versions, server-assigned numbers, field CAS, version bump, packet
log, audit, NOTIFY, signatures, IT reasons, filed lock and HMAC seal.
API: /api/packets (header, transitions, work orders, pages, docs, move, remove,
BOM, shorts, welds, heat tags, heat table, stage, checklist, clock, warehouse
stage, Q.C., change orders, log, seal), /api/projects, /api/units, /api/assets,
/_blob. Frontend: Clerical home, projects and units, packet page with pdf.js
and QR codes, hand draft, heat map, send to warehouse, department or Q.C.
Tests: policy matrix, API, concurrency, schema, projects; Playwright Clerical
draft scenario. Verified on docker-1 with the CI stack and the Samba DC.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
2026-10-16 09:31:45 -06:00
co-authored by Claude Fable 5.1
parent 97b0973130
commit 37d9a0cb50
83 changed files with 16490 additions and 55 deletions
+5 -3
View File
@@ -158,12 +158,14 @@ def test_departments(pg_client: TestClient) -> None:
deps = pg_client.get("/api/departments").json()
assert [d["code"] for d in deps][:5] == ["CL", "WH", "QC", "PM", "01"]
weld = next(d for d in deps if d["code"] == "03")
assert weld == {
assert {k: v for k, v in weld.items() if k != "stations"} == {
"code": "03",
"slug": "WeldParts",
"name": "Weld Parts",
"kind": "shop",
"stations": [f"Stall {i}" for i in range(1, 7)],
"weld": True,
}
assert [s["name"] for s in weld["stations"]] == [f"Stall {i}" for i in range(1, 7)]
assert all(isinstance(s["id"], int) for s in weld["stations"])
hydro = next(d for d in deps if d["code"] == "09")
assert hydro["stations"] == ["Hydro Bay 1", "Hydro Bay 2"]
assert [s["name"] for s in hydro["stations"]] == ["Hydro Bay 1", "Hydro Bay 2"] and hydro["weld"] is False