Files
PacketStation/docs/FEED.md
T
spencermandClaude Fable 5.1 0b663bb2b2 Phase 0: repo skeleton, image, compose stacks, doctor, migration runner, frontend shell
New repo for the Packet Station rebuild (Python 3.12, FastAPI, PostgreSQL 16,
React, VisualKit, MFilesKit, Docker Compose on docker-1). Nothing is migrated
from the M: install.

- CLAUDE.md with the safety rules, README, CHANGELOG, docs (BRIEF, PLAN,
  SECURITY rewritten for the server with the requirement ID table, DEPLOY,
  stubs for FEED, POLICY, SCHEMA, GO-LIVE, PAPER-FALLBACK).
- packetstation CLI: app, worker (heartbeat stub), migrate, doctor, version,
  healthcheck. Settings from the environment with secret files. Stack guard
  (test never points at VISUAL production). Security headers and CSP.
  Trusted proxy resolved by name. JSON logs with redaction.
- Migration runner and 0001_base: settings, append-only audit_events with
  hash chain, ps_notify, grants for ps_app.
- Multi-stage Dockerfile (ODBC Driver 18, PESCO libraries from the Gitea
  index only), compose base, proxy overlay for npm_default, CI overlay,
  postgres initdb roles, env examples, NPM proxy host notes, Gitea Actions.
- Frontend: Vite, React, TypeScript, the PESCO dark theme ported with
  self-hosted fonts, placeholder sign-in and home.
- Verified on docker-1: image builds, CI stack comes up healthy, doctor
  database checks pass, 77 server tests pass against PostgreSQL.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-15 23:08:47 -06:00

44 lines
2.7 KiB
Markdown

# Packet Station feed and drawings
Status: planned, phase 3. This is a stub. It lists what the approved plan says this document will contain. See [PLAN.md](PLAN.md), "Worker, feed and drawings".
## Purpose
The worker reads VISUAL through VisualKit and M-Files through MFilesKit on a schedule. It caches the rows, applies the packet rules and works the drawing queue. Screens read PostgreSQL only.
## Worker process
`packetstation worker` runs APScheduler. One run per job at a time, guarded by a PostgreSQL advisory lock per job. Settings are re-read on every tick, so an Admin change applies without a restart. The pause switch stops scheduled feed and drawing runs. "Run now" still works.
## Jobs and cadence
visual-feed (default every 5 minutes inside shop hours, 30 outside), drawing-lookup (after every feed run, plus its own cadence), session-refresh (15 minutes), ad-reconcile (nightly), integrity, backup-check, notify-send, notify-digest and housekeeping. Each run is recorded in `job_runs` with its counts and errors.
## Feed reads
Five reads per run: released work orders in the window (firmed only, `until` always passed), every unfiled packet's work orders by key, materials for both sets, order links, and labor tickets if the timer decision keeps them. A work order that leaves the window is not a removal.
## Packet rules
One packet is drawing + lot + operation. The project comes from the work order prefix. The unit is project + 3-digit lot. New drafts are created, drafts are updated in place, packets past draft get change orders, removed packets are never recreated, and untouched drafts whose legs all moved are retired. A work order gone from VISUAL is flagged, not removed.
## Fingerprint
A canonical hash over the fields a packet is built from. Major parts (legs, qty, rev, drawing, BOM) open a change order. Minor parts (tgt, want) need Clerical approval only. Tests show what each field does.
## Go-live boundary
Work orders released before the go-live date are ignored and listed. Clerical can pull one in by hand.
## Drawings
Drawing lookups go through MFilesKit with the matching rules in MFilesKit's `docs/packet-station.md`. Those docs are stale in two lines (drafting rev precedence and the project-folder rule). The code is the rule, and this document will state the code's behaviour.
## Flags
What each flag means and what Clerical does about it: rev mismatch, not released, not found, lookup failed, non-numeric rev, work order gone, cancelled, closed in VISUAL.
## Several open orders
Open question 5 in the plan. Proposed: the open order whose top job is the packet's work order base, else the newest open order, with the source shown and a Clerical override.