Phase 4: Warehouse screen, pull table, shorts, MTRs and the upload pipeline
The Warehouse home with the numbers, the Open shorts table, the find bar and the five-column task board (waiting, being pulled, on hold, pulled, released in the last 3 days) with buttons, hold reasons and drag. Every role sees the warehouse stage on a packet as the WH pill and the line under it. The pull table on the Materials tab: Pulled with auto-start, issued, location, heat with Enter to the next line, shorts with receipts, N/A, MTR per line with a viewer. Send back to Clerical with a reason. Release to supervisor stays blocked until every line is pulled or short and every pulled line has a heat. Server: the heats_recorded precondition on WH_RELEASE, receive by custody, server-validated hold and short reasons, the old packet history texts, GET /api/warehouse/board, cards with the warehouse stage and pull counts. Uploads typed by content per kind (drawing, mtr, document, bom with XLSX and CSV), limits per kind, optional ClamAV behind the clamav compose profile, a storage quota alert on the new notification_events table (migration 0005) shown on the Admin Storage tab. Tests: every warehouse action as every role, the release gate, the short-receive exception, the heat pattern, upload sniffing and limits, the ClamAV path with a fake scanner, the quota alert; frontend board and pull table tests; Playwright scenarios for the board and the pull flow. Verified on docker-1 in the CI stack: 3557 server tests, 106 frontend tests, 17 Playwright scenarios. Docs updated; D5 closed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -465,3 +465,35 @@ def test_two_operations_of_one_work_order_on_one_packet(pg_settings: Settings) -
|
||||
"INSERT INTO packet_work_orders (packet_id, wo_base, lot, split, sub) VALUES (%s, 'H1', '1', '0', '0')",
|
||||
(ids["packet"],),
|
||||
)
|
||||
|
||||
|
||||
def test_notification_events(pg_settings: Settings) -> None:
|
||||
"""0005: the notification placeholder. One open row per kind and subject; the app may write it."""
|
||||
with db.connect_as("migrate", pg_settings, autocommit=True) as conn:
|
||||
names = [r[0] for r in conn.execute("SELECT name FROM schema_migrations ORDER BY name").fetchall()]
|
||||
assert "0005_warehouse.sql" in names
|
||||
with app_conn(pg_settings) as conn:
|
||||
for priv in ("SELECT", "INSERT", "UPDATE", "DELETE"):
|
||||
assert one(conn, "SELECT has_table_privilege('ps_app', 'notification_events', %s)", (priv,)) is True
|
||||
ids = seed(conn)
|
||||
first = one(
|
||||
conn,
|
||||
"INSERT INTO notification_events (kind, subject, detail) VALUES ('t_kind', 'assets', '{\"pct\": 90}')"
|
||||
" RETURNING id",
|
||||
)
|
||||
assert one(conn, "SELECT severity FROM notification_events WHERE id = %s", (first,)) == "warning"
|
||||
with pytest.raises(psycopg.errors.UniqueViolation), conn.transaction():
|
||||
conn.execute("INSERT INTO notification_events (kind, subject) VALUES ('t_kind', 'assets')")
|
||||
with pytest.raises(psycopg.errors.CheckViolation), conn.transaction():
|
||||
conn.execute("INSERT INTO notification_events (kind, severity) VALUES ('t_other', 'loud')")
|
||||
# A null subject is one subject: a second open row for it is refused too.
|
||||
conn.execute("INSERT INTO notification_events (kind) VALUES ('t_null')")
|
||||
with pytest.raises(psycopg.errors.UniqueViolation), conn.transaction():
|
||||
conn.execute("INSERT INTO notification_events (kind) VALUES ('t_null')")
|
||||
conn.execute(
|
||||
"UPDATE notification_events SET resolved_at = now(), acknowledged_at = now(), acknowledged_by = %s"
|
||||
" WHERE id = %s",
|
||||
(ids["user"], first),
|
||||
)
|
||||
conn.execute("INSERT INTO notification_events (kind, subject) VALUES ('t_kind', 'assets')")
|
||||
assert one(conn, "SELECT count(*) FROM notification_events WHERE kind = 't_kind'") == 2
|
||||
|
||||
Reference in New Issue
Block a user