Files
PacketStation/README.md
T
spencermandClaude Fable 5.1 904437153d
ci / frontend (push) Successful in 40s
ci / server (push) Successful in 10m56s
ci / image (push) Successful in 48s
ci / e2e (push) Successful in 2m44s
Phase 7: close, file, PDFs and prints
Clerical close and file: the VISUAL observed state beside the close confirm, a 409 with a second confirm when the
feed still shows work orders open, filing with a signature and the HMAC seal, the data book built on the server
and stored on the seal in the filing transaction, admin reopen keeping the broken seal with its data book.

Server PDFs with reportlab, pypdf and pypdfium2: the manufacturing data book page for page after the old build
(cover, index, drawings with VOID stamps, traceability and heat map rasters, weld maps and welding records, Q.C.
inspections, Q.C. and test documents, MTRs, record history), the job traveler with work order QR codes, the ITP
PDF filed automatically at sign-off, every print kind with the PRINTED COPY stamp, the controlled-copy stamp
signed with the seal key, PDF metadata, the traceability CSV with the formula guard, and the append-only
print_log with an audit row for every print and export (migration 0008).

Frontend: the close and file panel, the print menu and its entry points, the printed copies list on the History
tab, the ITP PDF buttons. Tests: server (close, file, reopen, seal, the builders, prints, CSV, stamps), frontend,
and the Playwright close and print scenarios. Docs updated; SECURITY closes M2, S6, S7 and S8.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-17 23:49:14 -06:00

12 KiB

Packet Station

Digital job packets for the PESCO shop floor. A packet moves through each department on screen instead of on paper. VISUAL releases the work and Packet Station builds the packet with the drawing from M-Files at the rev the job pull calls. Clerical checks anything flagged. Warehouse pulls parts and records heat numbers, MTRs and shorts. A supervisor assigns a station and welder. The station logs welds on the weld map, works the checklist and runs the timer. The supervisor sends it to Q.C. Q.C. inspects, accepts or rejects, and adds reports. Clerical closes the job in VISUAL, exports the manufacturing data book PDF and files it. A change in VISUAL to a packet already in the shop goes to Clerical as a change order before it reaches the shop.

This repo is the rebuild of Packet Station as a server application: Docker Compose on docker-1, PostgreSQL 16, a Python server that enforces every rule, a worker for the VISUAL feed and M-Files drawing lookups, and a React frontend as a pure client. Sign-in is PESCO's Active Directory. VISUAL is read through VisualKit and M-Files through MFilesKit, read-only.

Status

Rebuild in progress. Phase 7 done: close in VISUAL, file with the HMAC seal and the data book, reopen, the server-built PDFs (data book, traveler, ITP), the traceability CSV, and stamped prints with the print log.

People can sign in, set up projects and units, make hand drafts, attach a drawing, and send a packet to the warehouse, a department or Q.C. The worker reads released work orders from VISUAL on a schedule, makes and updates drafts, opens change orders on packets already in the shop, looks drawings up in M-Files and attaches them at the rev VISUAL calls. Clerical sees it all on the From VISUAL panel and in the Flagged and Changes to approve columns; Admin sets the feed up on the Feed tab. Warehouse works its task board (waiting, being pulled, on hold, pulled, released), pulls parts line by line with heat numbers, shorts, receipts and MTRs, and releases to the supervisor once every line is pulled or short and every pulled line has a heat. A supervisor assigns the packet to a station and a welder, the welder starts the clock, marks welds on the drawing, places the heat table, finishes the checklist and submits with a PIN signature, and the supervisor sends it to Q.C. or routes it to another department with the marks carried. Department supervisors verify change orders with a signature. Q.C. inspects the packet on its own tab (the check items, a visual result per weld, NDE, hardness, notes), accepts it to the data book, to Shipping or on to another department with a PIN signature, or rejects it back to the supervisor with a reason or an NCR number. Q.C. keeps project folders of documents per project and unit (ITP, WPS / PQR, procedures, certificates) where a new revision supersedes the old one and nothing is deleted, adds reports to a packet for the data book and takes them out with a reason, and works each unit's digital ITP from the Q.C. template through line initials, N/A, rejects with NCR numbers, section block signatures and a sign-off. Open hold and witness points show as a warning on the unit's packets. Clerical confirms the job closed in VISUAL (the feed's closed state and any open work orders shown beside it) and files the packet with a signature. Filing seals the packet with an HMAC and builds the manufacturing data book on the server, stored on the seal; filing past open work orders needs a second confirmation. IT can reopen a filed packet with a reason and a signature, which keeps the broken seal and its data book. Anyone who can open a packet can view or download the data book, the job traveler with the work order QR codes, the ITP PDF and the traceability CSV, and print a stamped copy of the traveler, the drawings with the heat or weld map, the drawings without markup, the VOID sheets, the data book or any document. Every copy carries a stamp signed with the seal key, and every print and export is logged. The ITP sign-off files the signed ITP PDF. Every packet write goes through the server policy. The old build on M:\Production\Packet Station stays the live system until go-live. The new system starts empty; nothing is migrated from M:.

Area Exists yet?
Repo, docs, CLAUDE.md Yes (phase 0)
Image, compose, CI, doctor, migration runner, security headers, build version endpoint Yes (phase 0, image and stack verified on docker-1)
Sign-in (AD password, PIN on registered devices), sessions, lock screen, Account settings, Admin shell, audit, SSE Yes (phase 1, verified against the Samba DC in the CI stack on docker-1)
Schema, policy engine, packet API, projects and units, assets, Clerical screen, packet page Yes (phase 2, verified against PostgreSQL and the Samba DC in the CI stack on docker-1)
VISUAL feed, M-Files drawings, change orders from the feed, From VISUAL panel, Admin Feed tab and resource map Yes (phase 3, run once against VISUAL DEV and the vault from a developer machine; fixture-driven in CI)
Warehouse screen, pull table, shorts and receipts, MTRs, release gate, upload kinds, optional ClamAV, storage alert Yes (phase 4, verified in the CI stack on docker-1)
Supervisor and Stall screens, weld map, heat table, station clock, change-order verification Yes (phase 5, verified in the CI stack on docker-1)
Q.C. screen, inspection, Q.C. folders, packet documents, digital ITP, hold-point warnings Yes (phase 6, verified in the CI stack on docker-1)
Close and file, HMAC seal with the data book, reopen, data book, traveler and ITP PDFs, traceability CSV, prints and the print log Yes (phase 7)
Project Management, Admin, notifications, backups No (phases 8 and 9)
Regression bench and go-live No (phase 10)

Phases

The full plan is in docs/PLAN.md.

Phase What it delivers
0 Skeleton: repo, docs, Dockerfile, compose, CI, packetstation doctor, migration runner, headers and CSP.
1 Identity: AD sign-in, sessions, optional PIN, devices, signatures, audit, SSE, frontend shell and theme.
2 Core domain: schema, policy engine in Python, packet API, Clerical screen, packet page.
3 VISUAL feed and M-Files drawings in the worker, change orders, Clerical "From VISUAL" panel.
4 Warehouse: task board, pull table, heats, MTRs, shorts, upload pipeline.
5 Shop: supervisor and stall screens, weld map, heat table, timer, change-order verification.
6 Q.C.: inspection, accept and reject, Q.C. documents, digital ITP.
7 Close and file, HMAC seals, server-side PDFs (data book, traveler, ITP, prints, stamps).
8 Project Management screen, find bar, list view, presence.
9 Admin completion, AD reconcile, integrity job, notifications, backups and restore.
10 Regression bench, hardening, go-live and paper-fallback docs.

Folder map

CLAUDE.md  README.md  CHANGELOG.md  pyproject.toml  Dockerfile  .env.example
docs/                  the brief, the plan, security, deploy, feed, policy, schema, go-live, paper fallback
server/packetstation/  the Python package: app, worker, CLI, migrations, policy, domain, feed, drawings, PDFs
frontend/              Vite + React + TypeScript client
tests/                 server tests (pytest), e2e scenarios (Playwright), synthetic fixture generator
deploy/                compose files (base, NPM overlay, CI overlay), PostgreSQL init, Samba AD for CI
docker/                the image entrypoint
scripts/               host backup and restore scripts, systemd timer
.gitea/workflows/      CI

Not in git: .env, tests/fixtures/local/, reference/, recordings/. Real job data stays out of git and CI.

How to run

Developer machine:

python -m venv .venv
.venv\Scripts\python -m pip install -e ".[dev]"
.venv\Scripts\python -m pytest
cd frontend && npm ci && npm run build
packetstation doctor

visualkit and mfileskit install from PESCO's Gitea index with --index-url. Everything else installs from public PyPI in a separate step. See docs/DEPLOY.md.

Test stack on docker-1:

docker compose -p packetstation-test --env-file /etc/packetstation/test/stack.env \
  -f deploy/compose.yaml -f deploy/compose.proxy.yaml up -d

Phase 2 adds /api/projects, /api/units, /api/packets (header, transitions, work orders, pages, documents, BOM, shorts, welds, heat tags, heat table, stage, checklist, clock, warehouse stage, Q.C., change orders, log, seal), /api/assets and /_blob/{id}. Every packet read carries can, blocked and holder from the policy. See docs/POLICY.md and docs/SCHEMA.md.

The packetstation command has doctor, migrate, app, worker, job run <name> (one job in the foreground), fixtures use N (switch the fixture state, never on prod), ad-groups --list (the 50 AD group names the app expects) and ad-refresh (create or refresh the users from the groups' members).

Phase 3 adds the worker (packetstation worker: APScheduler, the visual-feed, drawing-lookup and housekeeping jobs, settings re-read on every fire, run now through job_requests), the VISUAL and drawing cache tables (migration 0004), /api/feed/*, /api/jobs/*, /api/admin/feed/*, rev approval and hand uploads under /api/packets/{id}, and the synthetic fixture generator (python -m tests.fixtures.generator --out DIR) that CI feeds the worker with. See docs/FEED.md.

Phase 6 adds the Q.C. screen (/qc: numbers, boards, project folders), GET /api/qc/home, GET /api/qc/folders with the project and unit folder reads, POST /api/qc/docs (a new revision supersedes the old row), the per-key Q.C. endpoints under /api/packets/{id}/qc, document kinds as a closed set with take-out reasons, and the digital ITP under /api/units/{id}/itp and /api/itps/{id} (start, line sign and unsign, N/A, reject with NCR, block sign, sign-off, reopen, log). The ITP PDF filed on sign-off is a hook for phase 7. See docs/POLICY.md "Q.C. (phase 6)".

Phase 7 adds the close and file panel, confirm_open_wos on the file transition (409 open_work_orders without it), the data book built and stored on the seal at filing, GET /api/packets/{id}/pdf/databook, GET /api/packets/{id}/pdf/traveler, GET /api/packets/{id}/export/traceability.csv, GET /api/packets/{id}/print/{kind} (traveler, map-h, map-w, clean, void, databook, doc), GET /api/packets/{id}/prints, GET /api/itps/{id}/pdf and GET /api/itps/{id}/print, and the print_log table (migration 0008). The PDFs are built on the server with reportlab 5.0.1, pypdf and pypdfium2; the heat and weld map rasters use Pillow 13.0.0. Both are pinned in pyproject.toml and server/requirements.txt, and need no system package or font in the image. See docs/POLICY.md "Phase 7: close, file, PDFs and prints".

CI stack with the Samba domain controller and the Playwright scenario, on a Docker host:

deploy/ci/make-secrets.sh
docker compose -p packetstation-ci --env-file deploy/ci/ci.env -f deploy/compose.yaml -f deploy/compose.ci.yaml up -d --build --wait
docker compose -p packetstation-ci --env-file deploy/ci/ci.env -f deploy/compose.yaml -f deploy/compose.ci.yaml --profile e2e run --rm playwright
docker compose -p packetstation-ci --env-file deploy/ci/ci.env -f deploy/compose.yaml -f deploy/compose.ci.yaml down -v

Server tests that need PostgreSQL run when TEST_PG_SUPERUSER_URL is set; the ones that need the domain controller run when the TEST_LDAP_* variables and TEST_DC_USERS_FILE are set. See deploy/samba/README.md.

Docs

  • docs/BRIEF.md: the brief this rebuild follows.
  • docs/PLAN.md: the approved phased plan and open questions.
  • docs/SECURITY.md: old layers and where they live now, the new controls, the requirement ID table.
  • docs/DEPLOY.md: host, stacks, secrets, NPM proxy host, doctor, backups.
  • docs/FEED.md: the worker, the VISUAL feed, the packet rules, the fingerprint, the drawing decision table, the flags and the feed settings.
  • docs/POLICY.md: who may do what, the preconditions, the order of checks, concurrency, and the tightenings against the old build.
  • docs/SCHEMA.md: the database schema (phases 1 to 7).
  • docs/GO-LIVE.md: go-live procedure (phase 10).
  • docs/PAPER-FALLBACK.md: what the shop does when the server is down (phase 10).
  • CHANGELOG.md: what changed.
  • CLAUDE.md: rules for Claude Code sessions in this repo.