From 330f49cf215c74e9d87c7346e41e1802d667c0f6 Mon Sep 17 00:00:00 2001 From: gabalint <1663150+gabalint@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:20:22 -0500 Subject: [PATCH 1/4] Correct documentation that disagreed with the code Weekly documentation cleanup. Corrects statements in the specifications, operator guides, contributor documentation and one console help article that the code contradicts, replaces the developer guide's stale copy of the crate table with a link to architecture section 7, and states in the agent instructions that the code wins when documentation and code disagree. No behavior changes. Co-Authored-By: Claude Fable 5.2 --- AGENTS.md | 10 ++++--- CHANGELOG.md | 17 +++++++++++- .../2026-11-22-help-reconnect-timing.md | 19 ++++++++++++++ console/README.md | 14 +++++----- console/e2e/MANUAL.md | 4 +-- console/help/connection.json | 2 +- docs/architecture.md | 4 +-- docs/development/README.md | 26 +++---------------- docs/operations/configuration-reference.md | 18 ++++++------- docs/operations/install.md | 2 +- docs/operations/running-and-monitoring.md | 23 ++++++++-------- docs/spec/acceptance.md | 2 +- docs/spec/audit.md | 2 +- docs/spec/backup.md | 2 +- docs/spec/bridge-channels.md | 4 +-- docs/spec/configuration.md | 12 ++++----- docs/spec/diagnostics.md | 8 +++--- docs/spec/message-channels.md | 14 +++++----- docs/spec/operator-console.md | 11 ++++---- docs/testing.md | 4 +-- packaging/VERIFY.md | 4 +-- 21 files changed, 112 insertions(+), 90 deletions(-) create mode 100644 changelog.d/2026-11-22-help-reconnect-timing.md diff --git a/AGENTS.md b/AGENTS.md index 160f745..8009d48 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,10 +24,12 @@ store every message durably, transform it and deliver it to one or more destinat 3. **Dependencies:** prefer crates and packages already in the workspace. Add others deliberately, AGPL-3.0-compatible, maintained, no telemetry; name every new one in the pull request. Do not vendor code. -4. **Documentation describes the current state only.** When you change behavior, change the - doc that describes it in the same change (`docs/`, `docs/spec/`, console help text). No - plans, diaries, reports or screenshots in the repository; `.local/` is ignored for those. - `STATUS.md` is one page that is replaced, not appended to. +4. **Documentation describes the current state only.** When documentation and code disagree, + the code is right. Follow the code and correct or delete the documentation. When you + change behavior, change the doc that describes it in the same change (`docs/`, + `docs/spec/`, console help text). No plans, diaries, reports or screenshots in the + repository; `.local/` is ignored for those. `STATUS.md` is one page that is replaced, not + appended to. 5. **Testing is designed with the code, not sprinkled after every edit.** Each crate carries its tests; protocol crates carry a conformance corpus; integration goes through the simulator scenarios. Run scoped checks (`cargo test -p `, diff --git a/CHANGELOG.md b/CHANGELOG.md index 28a20f6..60bd1ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ What changed in OpenBGA Interface Engine, grouped by release with unreleased changes on top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). -## Unreleased (2026-11-12 to 2026-11-17) +## Unreleased (2026-11-12 to 2026-11-22) ### High impact @@ -254,6 +254,21 @@ top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/ ### Low impact +- **Fixed:** Help and guides corrected where they disagreed with the engine (2026-11-22) + + The Connection help article now gives the console's actual reconnection timing: a first retry + after about half a second, doubling to about 5 seconds. The operator guides were corrected in + the same way wherever they described something the engine does differently. + + Technical notes: + + Operator guide corrections: the macOS daemon's error log is + `/Library/Logs/Positive ACK/launchd.stderr.log`; the Messages text filter searches identifiers + and message type, never bodies; a truncated transmission CSV ends with a `# truncated:` line and + its totals cover the whole period; an export with `--bodies` stops with an error when an + original cannot be read; `max_frame_chars` accepts 64–64,000; an AU class A destination and an + HL7 destination with `ack_mode: none` reach `handed_off` at most. No behavior changed. + - **Fixed:** Configuration fixes (2026-11-12) Signing off a verification no longer crashes, a configuration with extra text after it is rejected, diff --git a/changelog.d/2026-11-22-help-reconnect-timing.md b/changelog.d/2026-11-22-help-reconnect-timing.md new file mode 100644 index 0000000..d745635 --- /dev/null +++ b/changelog.d/2026-11-22-help-reconnect-timing.md @@ -0,0 +1,19 @@ +--- +date: 2026-11-22 +type: fixed +impact: low +title: Help and guides corrected where they disagreed with the engine +area: Documentation +--- +The Connection help article now gives the console's actual reconnection timing: a first retry +after about half a second, doubling to about 5 seconds. The operator guides were corrected in +the same way wherever they described something the engine does differently. + +## Technical notes + +Operator guide corrections: the macOS daemon's error log is +`/Library/Logs/Positive ACK/launchd.stderr.log`; the Messages text filter searches identifiers +and message type, never bodies; a truncated transmission CSV ends with a `# truncated:` line and +its totals cover the whole period; an export with `--bodies` stops with an error when an +original cannot be read; `max_frame_chars` accepts 64–64,000; an AU class A destination and an +HL7 destination with `ack_mode: none` reach `handed_off` at most. No behavior changed. diff --git a/console/README.md b/console/README.md index 7977398..4762e85 100644 --- a/console/README.md +++ b/console/README.md @@ -13,9 +13,9 @@ npm run tauri dev # the desktop window, attached to the engine npm run dev # the same UI in a browser at http://localhost:5174, on mock data ``` -The window finds the engine like the `packie` CLI does: an override saved by the shell, then -`PACKIE_IPC` (socket path or pipe name), then the bootstrap file named by `PACKIE_BOOTSTRAP` or the -nearest `config/bootstrap.json` above the working directory. Start an engine first, from the +The window finds the engine in this order: an override saved by the shell, `PACKIE_IPC` (socket +path or pipe name), the bootstrap file named by `PACKIE_BOOTSTRAP`, the installed engine's +bootstrap file, then the nearest `config/bootstrap.json` at or above the working directory. Start an engine first, from the repository root: `cargo run -p packie -- run --bootstrap config/bootstrap.json`. Without one the console says so, keeps trying, and continues when the engine appears. @@ -32,8 +32,8 @@ cargo check --manifest-path src-tauri/Cargo.toml ``` Browser journeys (Playwright, chromium only) drive the pages against the mock engine and prove -the console acceptance rows H-01..H-09, D-08, D-12 and the console half of I-03 (docs/spec/acceptance.md §9). One -spec file per area in `e2e/`, each test named by its row: +the console acceptance rows H-01..H-09, D-08, D-12 and the console half of I-03 (docs/spec/acceptance.md §5, §9, §10). Spec +files are grouped by area in `e2e/`, each test named by its row: ```sh npx playwright install chromium # once @@ -77,10 +77,10 @@ PACKIE_LIVE_IPC=/path/to/state/packie.sock PACKIE_LIVE_HL7_PORT=5401 PACKIE_LIVE | --- | --- | | `src/api/` | `EngineApi` (the only way pages reach the engine), the console's DTO types, query hooks. `ipc/` implements it over the Tauri commands and maps the engine's generated types (`src/ipc/generated/`) onto the console's; `mock/` implements it with synthetic data. `createEngineApi()` in `index.ts` picks one. | | `src/components/` | UI kit: domain-free components with tests. | -| `src/features/` | One folder per area; features never import each other. | +| `src/features/` | One folder per area; `shared-operate/` holds what the operate screens share. | | `src/app/` | Shell, navigation, routes, help drawer. | | `src/lib/` | Formatting, error handling, state wording (`status.ts`), test helpers. | -| `help/` | One JSON file per page: the text of the help drawer. | +| `help/` | One JSON file per help article (a page or a topic): the text of the help drawer. | | `src-tauri/` | Tauri shell; its own Cargo workspace root, not part of the engine workspace. Holds the one engine connection (reconnects with backoff, resubscribes) and exposes it as `ipc_*` commands and `packie://event` / `packie://connection` events. It also shows the native save dialog and writes the file the operator chose: the engine's chunks of an audit export (`save_audit_export`) or a message export (`save_message_export`, with or without bodies), and a report the window built itself, such as the change report or a transmission CSV (`save_report_file`). Files are created exclusively and owner-only from the first byte: an existing file is never replaced or followed (the export goes to the first free `name-1.ext`, and the notice names it), and a failed export leaves no partial file. The window never names a path and has no file system permission. The change report is recorded in the engine's audit log (`record_client_export`) before it is written. | Generated IPC types go to `src/ipc/generated/` (owned by the engine's `packie-ipc` export). diff --git a/console/e2e/MANUAL.md b/console/e2e/MANUAL.md index c2bd69d..60142c8 100644 --- a/console/e2e/MANUAL.md +++ b/console/e2e/MANUAL.md @@ -17,7 +17,7 @@ peers; nothing else is installed. # 1. The engine, with its own state under console/e2e/manual/ (ignored by git) cargo run -p packie -- run --bootstrap console/e2e/manual/bootstrap.json # 2. Load the check configuration: a bridge (5301 <-> 5302) and an HL7 message channel (5401 -> 5402) -cargo run -p packie -- --bootstrap console/e2e/manual/bootstrap.json config apply console/e2e/manual/runtime.json +cargo run -p packie -- --bootstrap console/e2e/manual/bootstrap.json config apply console/e2e/manual/runtime.json --note "manual check" # 3. The peers (one terminal each) node console/e2e/manual/peers.mjs bridge # instrument and system around the bridge node console/e2e/manual/peers.mjs sink # the "LIS": answers AA to HL7 messages on 5402 @@ -52,7 +52,7 @@ from an installed build, start the app (it finds the installed engine itself; se | 19 | Look at the top bar. | **Signed in as** names your operating system account, as `whoami` prints it (`DOMAIN\name` on Windows). It is the account the audit log and the version history use. | ☐ | | 20 | Open **Audit** (under Diagnose). | What you did in steps 5 to 12 is listed newest first with your account and the origin **console**: the pause and resume (each recorded as requested, then its outcome), the identifier search, the body and fields views, the configuration apply with its note. Choose a row: the detail shows the note in full. | ☐ | | 21 | On **Audit**, press **Export…**, choose CSV, then **Export**. | The operating system's **Save** dialog opens named `interface-engine-audit-.csv`. Cancel: nothing is written and nothing is announced. Export again and save: a message names the number of events and the file; open it in a spreadsheet (a header row, the filtered events oldest first); on macOS and Linux its permissions are owner-only. Export again choosing the same file name and confirm the dialog's replace prompt: the first file stays exactly as it was and the new one is saved as `-1.csv`, which the message names (an export never replaces or follows a link). | ☐ | -| 22 | On **Audit**, press **Verify chain**. | **The chain is intact**, with the events, the first and last number and the head hash. `cargo run -p packie -- --bootstrap console/e2e/manual/bootstrap.json audit verify` prints the same head hash (it differs by the events these two checks added). | ☐ | +| 22 | On **Audit**, press **Verify chain**. | **Chain verified: OK**, with the files, the events, the first and last event and the head hash. `cargo run -p packie -- --bootstrap console/e2e/manual/bootstrap.json audit verify` prints the same head hash (it differs by the events these two checks added). | ☐ | | 23 | **Settings > Versions**, open version 2, then **Mark as verified…** with a reference such as `VR-1`. | Without a reference it is refused. After it, the row says **Verified** and the detail names your account, the time and `VR-1`. | ☐ | | 24 | **Settings > Backup**, then **Back up now** and confirm. | The status shows the directory `console/e2e/manual/backups`; after a few seconds a result lists the directory, files, size, messages and the configuration version. `cargo run -p packie -- --bootstrap console/e2e/manual/bootstrap.json backup verify ` reports no problem. The restore section has no button; it shows the commands naming the bootstrap file `console/e2e/manual/bootstrap.json` as an absolute path (the path the console found, not a default), then start, the health checks and the secrets reminder. | ☐ | | 25 | **Settings > Privacy**: set 1 minute and Save. Open a message, **Show original message**, then leave the window alone for 70 seconds. | The message detail closes and the **Messages** list is behind a cover saying content was hidden after 1 minute without activity, with a **Continue** button (it has focus). Continue shows the list; open the message again: no text is shown until **Show original message** is pressed. Set the time back to 15. | ☐ | diff --git a/console/help/connection.json b/console/help/connection.json index c7c3f3b..a39d723 100644 --- a/console/help/connection.json +++ b/console/help/connection.json @@ -7,7 +7,7 @@ { "title": "When the engine is not running", "paragraphs": [ - "The console shows The engine is not running, where it looked and why the last attempt failed. It keeps trying by itself, first after 1 second and then at doubling intervals up to 10 seconds, and carries on as soon as an engine answers. Start the service runs the installed service's start command. That needs administrator rights, so from a normal account it may be refused (on macOS it can start a per-user agent instead): the page shows the command to run in an administrator terminal." + "The console shows The engine is not running, where it looked and why the last attempt failed. It keeps trying by itself, first after about half a second and then at doubling intervals up to about 5 seconds, and carries on as soon as an engine answers. Start the service runs the installed service's start command. That needs administrator rights, so from a normal account it may be refused (on macOS it can start a per-user agent instead): the page shows the command to run in an administrator terminal." ] }, { diff --git a/docs/architecture.md b/docs/architecture.md index 276e16a..f50e55e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -101,7 +101,7 @@ How OpenBGA Interface Engine is built. Behavior details per area live in `docs/s | ASTM E1381 / E1394 (LIS01-A2 / LIS02-A2) | `packie-astm` | receive results, send orders/queries | Frame layer with checksum, ACK/NAK/EOT, retransmission, contention; record layer H/P/O/R/C/Q/L with field accessors. | | AU400 / AU640 | `packie-au` | receive results, send worklists | Fixed-width records. | | HL7 v2.x | `packie-hl7` | MLLP client and listener; ORU, ORM/OML, ORL, ACK, ADT as generic messages | Generic segment/field/component model with escaping; typed helpers; ACK generation in original and enhanced modes; MLLP streaming framer. Message version from MSH-12. | -| Delimited files | `packie-files` | read and write | Templates: delimiter, quoting, header row, column→field mapping, one record per line or grouped; completion detection (stable size + rename/lock heuristics). | +| Delimited files | `packie-files` | read and write | Templates: delimiter, quoting, header row, column→field mapping, one record per line or grouped. The folder and SFTP transports in `packie-transport` detect a complete file (stable size and ignored suffixes; the folder transport also checks that no writer holds the file open). | | Raw | `packie-routing` | bridges, taps | No parsing. | Transformation model (`packie-transform`): a message's parsed model is addressed by paths @@ -171,7 +171,7 @@ restricted secrets file; never stored in the documents. | `packie-diagnostics` | Tracing setup, ring buffer, snapshots, alerts, counters, traffic tap | core, config (alert thresholds) | | `packie-routing` | Channel supervisors, bridge sessions and buffers, message pipeline, retry policy, connectors, store opening with retry; implements `packie_engine::ChannelRegistry` | astm, au, config, core, diagnostics, engine (registry contract), files, hl7, ipc, store, transform, transport | | `packie-ipc` | IPC protocol DTOs (ts-rs), framing, server and client | core, config, diagnostics | -| `packie-engine` | Composition: loads config, starts diagnostics and IPC, opens audit through the host-supplied opener, schedules backups, publishes snapshots, applies config to the `ChannelRegistry` its host supplies | astm, backup, config, core, diagnostics, hl7, ipc, transform | +| `packie-engine` | Composition: loads config, starts diagnostics and IPC, opens audit through the host-supplied opener, schedules backups, publishes snapshots, applies config to the `ChannelRegistry` its host supplies | astm, backup, config, core, diagnostics, hl7, ipc, notify, transform | | `packie-sim` | Simulator: scripted TCP/serial/folder peers, scenario runner, benchmarks and soak runner with seeded faults, resource monitoring and message reconciliation; drives a real `packie` process over IPC | core, diagnostics, ipc | | `packie-host` | OS service definitions and control (launchd, systemd, Windows SCM) behind a `ServiceManager` trait, the Windows service entry point, the single-instance lock | core | | `packie` (bin) | Hosting (console or service) and CLI; chooses the channel registry | audit, backup, config, core, diagnostics, engine, host, ipc, routing | diff --git a/docs/development/README.md b/docs/development/README.md index ab0e340..f17a0b4 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -7,26 +7,8 @@ For installed systems, use the [operator guides](../operations/README.md). ## Repository layout -All engine workspace crates live under `crates/`. - -| Crate | Owns | -| --- | --- | -| `packie-core` | IDs, timestamps, state and kind enums, error and byte helpers. | -| `packie-config` | Bootstrap/runtime models, validation, versioning, persistence and secret references/providers. | -| `packie-transport` | Serial, TCP, folder and SFTP adapters, stream/file contracts and serial port leases. | -| `packie-astm` | ASTM framing, records and receive/send state machines. | -| `packie-au` | AU framing, fixed-width models, codecs and session driver. | -| `packie-hl7` | HL7 v2 model, paths, escaping, ACKs and MLLP framing. | -| `packie-files` | Delimited-file templates, parsing and encoding. | -| `packie-transform` | Protocol model adapters, paths, filters, mapping rules and code tables. | -| `packie-store` | SQLite single-writer store, message bodies, deliveries and migrations. | -| `packie-diagnostics` | Structured logging, snapshots, counters, alerts and traffic tap. | -| `packie-ipc` | Local IPC DTOs, framing, server/client and TypeScript export. | -| `packie-engine` | Engine composition, configuration apply, diagnostics and IPC lifecycle; channel registry contract. | -| `packie-routing` | Registry implementation, channel supervisors, bridges, protocol connectors and message pipeline. | -| `packie-host` | OS service control, Windows service entry point and single-instance lock. | -| `packie` | Foreground/service host and operator CLI. | -| `packie-sim` | Scripted peers, scenario validation/runner and performance benchmarks. | +All engine workspace crates live under `crates/`; [architecture §7](../architecture.md#7-crates) +lists each crate's purpose and dependencies. | Path | Owns | | --- | --- | @@ -159,8 +141,8 @@ root. [Testing](../testing.md) defines the integration gate. | [Scenarios](../../.github/workflows/scenarios.yml): `scenarios` | Ubuntu builds both binaries, runs all cases with `--jobs 4 --deny-skips --verbose`, publishes JUnit and retains failed state/log artifacts. | | [Publish presentation](../../.github/workflows/pages.yml): `deploy` | Uploads `website/` and deploys it to GitHub Pages; runs for website changes on `main`. | -CI and Scenarios run for pushes to `main` and pull requests; Scenarios also supports manual -dispatch. Performance targets are measured with `packie-sim bench` before a release; see +CI and Scenarios run for pull requests and pushes to `develop` and `main`; Scenarios also +supports manual dispatch. Performance targets are measured with `packie-sim bench` before a release; see [acceptance](../spec/acceptance.md#10-performance-security-packaging). Every observable change carries an entry in `changelog.d/` diff --git a/docs/operations/configuration-reference.md b/docs/operations/configuration-reference.md index 95f8560..1b710ae 100644 --- a/docs/operations/configuration-reference.md +++ b/docs/operations/configuration-reference.md @@ -37,7 +37,7 @@ object, rather than complete JSON paths. | `diagnostics.snapshot_interval_seconds` | `1` | Integer, 1–60. | | `diagnostics.retain_recent_errors` | `100` | Integer, 10–10,000 per channel. | | `secrets.provider` | `keystore` (macOS, Windows); `file` (Linux) | `keystore` or `file`. On Linux `keystore` needs a Secret Service (desktop session); without one the engine refuses to start and names `file`. The Linux package sets `file`. | -| `secrets.file` | `/secrets.json` with `provider=file` | Secret-store file path; created owner-only on the first secret write; on Unix, group and others must have no read access. | +| `secrets.file` | `/secrets.json` with `provider=file` | Secret-store file path; created owner-only on the first secret write; on Unix, group and others must have no permission bits. | | `audit.retention_days` | `2190` | Integer, 365–36,500. Removes whole sealed yearly audit files only after their newest event ages out; records the removal. Keep at least as long as the longest message retention and the lab's required calendar interval. | | `backup.directory` | Not set | Backup root; required with a schedule. Each default/scheduled backup uses a new `packie-backup-` directory. Use an encrypted volume writable by the service account. | | `backup.schedule` | `null` | No automatic backup; otherwise an object with `daily_at` and optional `keep` below. | @@ -116,7 +116,7 @@ that endpoint's `settings`. | `label` | Required | Display label. | | `enabled` | `true` | Boolean; `false` prevents opening the endpoint. | | `kind` | Required | `serial`, `tcp_client`, `tcp_listener`, `folder`, `sftp`. | -| `settings` | Required | Object for the chosen kind. | +| `settings` | `{}` | Object for the chosen kind; its required fields still apply. | | `tags` | `{}` | Up to 20 string-to-string metadata entries. | ### Serial settings @@ -267,8 +267,8 @@ produces an unbounded-retention warning. | Protocol | Allowed endpoint kinds | Default / highest `ack_required` | | --- | --- | --- | -| `astm`, `au` | `serial`, `tcp_client`, `tcp_listener` | `received` / `received` | -| `hl7_mllp` | `tcp_client`, `tcp_listener` | `accepted` / `accepted` | +| `astm`, `au` | `serial`, `tcp_client`, `tcp_listener` | `received` / `received`; `au` class `a`: `handed_off` | +| `hl7_mllp` | `tcp_client`, `tcp_listener` | `accepted` / `accepted`; `handed_off` with `ack_mode: none` | | `delimited_file` | `folder`, `sftp` | `handed_off` / `handed_off` | ### Delivery policy fields @@ -295,14 +295,14 @@ Fields belong to source or destination connector `settings`. | `ack_timeout_ms` | `15000` | Integer, 1000–120,000. | | `receive_timeout_ms` | `30000` | Integer, 1000–300,000. | | `max_frame_retries` | `6` | Integer, 0–20. | -| `max_frame_chars` | `240` | Integer, 64–240. | +| `max_frame_chars` | `240` | Integer, 64–64,000; 240 is the E1381 limit, larger values are long frames. | | `contention_wait_ms` | `20000` | Integer, 1000–60,000. | | `max_message_bytes` | `1048576` | Integer, 1024–67,108,864. | ### AU (`au`) Use the instrument's online parameter sheet. All fields are required except -`block_timeout_ms`. +`block_timeout_ms` and `format.test_code_digits` (`2` or `3`, default `2`). | Field | Default | Value or purpose | | --- | --- | --- | @@ -376,7 +376,7 @@ fields, components and subcomponents start at 1. AU fields are read-only. | ASTM | `R[occ].field[rep].component` (record letters `H P O R C Q M L`) | | AU | Header name or `test[occ].name` | | Delimited file | `col[occ].name` | -| Current loop occurrence | `$.` plus field/component or field name; only inside `for_each`. | +| Current loop occurrence | `$.` plus field/component or field name; only inside `for_each`, `append` or a `calculate` `find`. | ### Expression fields @@ -404,7 +404,7 @@ fields read as empty text. Non-decimal field text fails every numeric comparison | Field | Default | Value or purpose | | --- | --- | --- | | `tables` | `{}` | Named code tables, each mapping strings to strings. | -| `rules` | Required | Ordered rule array; output begins with generated protocol headers. | +| `rules` | Required | Ordered rule array; an HL7 or ASTM target of the same protocol starts as a copy of the source, otherwise output begins with generated protocol headers. | | Rule `op` | Required fields | Optional fields and defaults | | --- | --- | --- | @@ -415,7 +415,7 @@ fields read as empty text. Non-decimal field text fails every numeric comparison | `datetime` | `from`, `to`, `input`, `output` | `from_timezone`, `to_timezone`: IANA names; conversion requires both. | | `when` | `condition`, `then` | `else`; branches contain rule arrays. | | `for_each` | `over`, `into`, `rules` | Record names identify input/output occurrences; loops cannot nest. | -| `sequence` | `to` | `start=1`, integer 0–999,999,999; only inside `for_each`. | +| `sequence` | `to` | `start=1`, integer 0–999,999,999; only inside `for_each` or `append`. | Date/time tokens are `yyyy`, `yy` (1970–2069), `MM`, `dd`, `HH`, `mm`, `ss`. Tokens are fixed-width and may appear only once per format; quote literal letters with single quotes. diff --git a/docs/operations/install.md b/docs/operations/install.md index d274dd8..9e64d8a 100644 --- a/docs/operations/install.md +++ b/docs/operations/install.md @@ -67,7 +67,7 @@ Allow shutdown to finish: the service manager permits the configured drain time The service manager restarts the engine after a failure, but not after a configuration error (exit code 2: an invalid bootstrap or an unusable secret store), which would only repeat. On Linux the unit stays `failed` (`RestartPreventExitStatus=2`) and `journalctl -u packie` shows the -reason; on macOS the daemon stops and the reason is in `/var/log/packie/launchd.stderr.log`; on +reason; on macOS the daemon stops and the reason is in `/Library/Logs/Positive ACK/launchd.stderr.log`; on Windows the service stops with an Application event-log error (source `packie`, ID 3) naming the reason. Fix the bootstrap, then start the service again. diff --git a/docs/operations/running-and-monitoring.md b/docs/operations/running-and-monitoring.md index d3a6c53..98b4c04 100644 --- a/docs/operations/running-and-monitoring.md +++ b/docs/operations/running-and-monitoring.md @@ -15,9 +15,9 @@ deliveries needing attention, message-store state and free disk space. | Engine state | Meaning | | --- | --- | -| Healthy | The engine has an active configuration and usable store, disk is above the critical limit, and enabled channels are running or starting. | -| Degraded | A channel needs recovery, the store is unavailable, disk is critically low, or no valid configuration is active. Open the alerts and affected channel. | -| Stopped | Shutdown has completed. | +| Running (`healthy` in `packie status`) | The engine has an active configuration and usable store, disk is above the critical limit, and enabled channels are running or starting. | +| Needs attention (`degraded`) | A channel needs recovery, the store is unavailable, disk is critically low, or no valid configuration is active. Open the alerts and affected channel. | +| Stopping (`stopped`) | Shutdown has completed. | Paused and disabled channels do not by themselves make the engine degraded. A healthy engine can still have deliveries needing an operator's decision. @@ -53,12 +53,12 @@ minutes comes first, followed by the newest error, then the channel label A to Z | --- | --- | | 1 | Any channel with an open critical alert | | 2 | Retrying | -| 3 | Degraded, or stopped because of an error or invalid configuration | +| 3 | Degraded | | 4 | Running with a warning alert or deliveries needing attention | | 5 | Running with traffic in the last 60 seconds | | 6 | Running and idle | | 7 | Starting | -| 8 | Other stopped channels, including paused and disabled | +| 8 | Stopped, whatever the reason (paused, disabled, error or invalid configuration) | A critical alert adds red emphasis and a **Critical alert** label to the row. While the pointer is over the table or a row has keyboard focus, rows hold their positions; @@ -80,7 +80,7 @@ blue means work in progress, amber means a warning, and red means a failure. | Degraded | Triangle | Amber | The channel is running with an impairment, such as buffer pressure or a destination that is down. | | Paused by operator | Pause bars | Neutral | Intentionally stopped; no retry is scheduled. | | Disabled | Dash | Neutral | Disabled in the active configuration. | -| Stopped: configuration invalid / Stopped: error | Square | Red | Read the cause and correct it before restarting. | +| Stopped: configuration invalid / Stopped: error | Square | Neutral | Read the cause and correct it before restarting. | | Other Stopped labels | Square | Neutral | The reason names a replacement, shutdown or other stop. | | Endpoint label | Shape | Color | Meaning | @@ -200,7 +200,7 @@ message it was resent from. Filtering, sorting and paging happen in the engine. | Message state | Receiving, received, routed, filtered, duplicate, invalid, aborted or observed. | | Delivery state | Find messages with a delivery in the selected state. | | Identifier | Match a control, sample or patient ID exactly or by its beginning. | -| Text | At least three characters; searches identifiers, message type and stored bodies within the time range. | +| Text | At least three characters; searches identifiers and message type within the time range; bodies are not searched. | | Quick filters | Needs attention, Queued, Duplicates, Invalid or aborted, each with a count. These replace the state selections. | Identifier and text searches may contain patient data. They are kept out of the page @@ -318,8 +318,9 @@ A missing sent hash does not prove nothing was sent; pass-through deliveries can An ACK proves only its recorded level, not clinical correctness at the final destination. Reports cap delivery rows at 10,000. Check the text summary's warning or JSON `truncated` -before filing CSV evidence: CSV has no truncation marker. When truncated, the message count -covers the whole selection, but destination totals cover only processed pages. Split the +before filing CSV evidence; a truncated CSV ends with a `# truncated:` line. When truncated, +the message count and destination totals still cover the whole period; only the delivery +rows stop early. Split the period until reports are complete. `--csv` and `--json` conflict; `--output` implies CSV unless `--json` is present. The audit action is `transmission_verify`. @@ -329,7 +330,7 @@ oldest first, without list pagination or sort flags. CSV is the default; JSON Li `--format jsonl`. Metadata includes identifiers and each delivery's destination/state/ACK level (CSV joins these as `destination:state:ack_level`, separated by semicolons). `--bodies` adds original content as UTF-8 text with invalid byte sequences replaced; an -unreadable or incomplete original is exported as empty text. This is not a byte-exact body +unreadable or incomplete original stops the export with an error. This is not a byte-exact body archive. The first export chunk is audited as `message_export` with filters, format, content choice and matching count; `--bodies` makes the content access explicit. @@ -466,7 +467,7 @@ files remain in the configured log directory for retained history. | Starts, stops and operator actions | `node.started`, `node.stopped`, `channel.started`, `channel.stopped`, `channel.state_changed`, `operator.command` | | Connection failures and recovery | `endpoint.state_changed`, `endpoint.connected`, `endpoint.retry_scheduled`, `endpoint.retry_succeeded`, `endpoint.write_failed`, `listener.peer_rejected` | | Bridge sessions and pressure | `bridge.session_opened`, `bridge.session_closed`, `bridge.close_propagated`, `buffer.overflow_detected`, `buffer.overflow_cleared`, `tap.dropped` | -| Receipt, input problems and duplicates | `message.committed`, `message.invalid`, `message.aborted`, `message.duplicate`, `message.identity_reused`, `message.filtered`, `file.consume_failed` | +| Receipt, input problems and duplicates | `message.committed`, `message.invalid`, `message.aborted`, `message.duplicate`, `message.identity_reused`, `file.consume_failed` | | Delivery decisions | `delivery.attempt_started`, `delivery.state_changed`, `delivery.transform_failed`, `delivery.ack_unmatched`, `delivery.resend_requested` | | Store, configuration and alerts | `store.error`, `reconciliation.completed`, `retention.purged`, `config.applied`, `config.rejected`, `alert.raised`, `alert.cleared` | diff --git a/docs/spec/acceptance.md b/docs/spec/acceptance.md index 484026b..e7a15f3 100644 --- a/docs/spec/acceptance.md +++ b/docs/spec/acceptance.md @@ -7,7 +7,7 @@ backticks are files in [`tests/scenarios/`](../../tests/scenarios/) described in [scenarios.md](scenarios.md). **Verified by** values: a scenario name; `crate: ` (the crate's own tests, including -conformance corpora); `console smoke` (page smoke journey against a simulator-backed engine, +conformance corpora); `console smoke` (browser journeys on the mock engine, [testing.md](../testing.md)); `benchmark` (the `packie-sim` benchmark scenario, run at the gate); `install test` (per-OS installer check); `inspection` (a reviewed property such as a permission or an absent port). diff --git a/docs/spec/audit.md b/docs/spec/audit.md index a5cf3a7..7fffb2e 100644 --- a/docs/spec/audit.md +++ b/docs/spec/audit.md @@ -135,7 +135,7 @@ uses this retention setting, with background maintenance disabled for the short | Lost outcome | When the outcome event after an audited IPC request cannot be written, its result is still returned; the `requested` event shows that it was attempted, without a recorded outcome. `audit.write_failed` is logged. Offline backup creation likewise returns its result and prints a warning if its outcome cannot be recorded. | | Alert | A failed write on an opened log marks it unavailable: `audit_unavailable` (critical) is raised and `audit.unavailable` logged. The next successful write clears it; maintenance retries every minute, and every audited command tries again. | | Traffic | Message traffic never waits on the audit log. | -| Start | An audit log that cannot be opened at start does not stop the engine: it uses an unavailable fallback until restart; audited requests remain refused. | +| Start | An audit log that cannot be opened at start does not stop the engine: it starts unavailable, audited requests are refused, and every audited command and the minute maintenance try to open it again. | | Scheduled backups | A scheduled backup still runs when the audit log is unavailable; writing its single outcome is best effort. Engine start and stop records are also best effort. | ## 8. Review diff --git a/docs/spec/backup.md b/docs/spec/backup.md index bdf999d..f083e86 100644 --- a/docs/spec/backup.md +++ b/docs/spec/backup.md @@ -57,7 +57,7 @@ Endpoints that need a missing secret report it and connect once it is set. | Engine stopped | `packie backup create` takes the instance lock (so no engine can start meanwhile), opens the audit log itself and works offline. | | Durability | Configuration/reference files and the manifest are explicitly synced. On Unix, every copied file is synced before the manifest names it. | | Failure | After the target is accepted, a failed backup attempts to remove what it wrote (the whole directory when it created it) and records the failure in the status. Cleanup failures are logged. Target-validation failures do not update the status. | -| Audit | Manual creation records `backup_create`, `requested` before and the outcome after; refused when the request cannot be recorded ([audit.md §7](audit.md#7-availability-and-fail-closed-commands)). A lost outcome is logged without failing the backup. Scheduled creation records its outcome after the copy and proceeds even when the audit log cannot be written. | +| Audit | Manual creation records `backup_create`, `requested` before and the outcome after; refused when the request cannot be recorded ([audit.md §7](audit.md#7-availability-and-fail-closed-commands)). A lost outcome is logged (over IPC) or printed as a warning (offline CLI) without failing the backup. Scheduled creation records its outcome after the copy and proceeds even when the audit log cannot be written. | | Status | Accepted backup attempts update `/backup/status.json` (newest attempt and newest success, with the summary). A status-write failure is logged without failing the backup. | ## 3. Verifying diff --git a/docs/spec/bridge-channels.md b/docs/spec/bridge-channels.md index 53c4f24..fe58be9 100644 --- a/docs/spec/bridge-channels.md +++ b/docs/spec/bridge-channels.md @@ -84,7 +84,7 @@ Endpoint states are `disabled`, `connecting`, `listening`, `connected`, `retryin | `listening` | A listener socket is bound and accepting. | | `connected` | Ready for I/O (client connected, peer accepted, serial port open). | | `retrying` | The last attempt failed and a retry is scheduled. | -| `disconnected` | Intentionally idle: the channel is stopped, or the endpoint has no running channel. | +| `disconnected` | Intentionally idle: the channel is stopped, the endpoint has no running channel, or it is the sender-side listener under `receiver_then_sender`, unbound until the receiver attaches. | | `error` | A persistent attachment failure, such as permission denied, unsupported serial settings or a bind failure other than address in use. Retries continue at `max_delay_ms`. | Rules: @@ -200,7 +200,7 @@ already held by a writer and the reader's pending segment are outside those gaug | Rule | Statement | | --- | --- | | Single peer | A listener accepts at most one active peer session per channel. | -| Allowlist | A peer whose address does not match `allowed_peer_cidrs` is rejected at accept, before any byte is read, and `listener.peer_rejected` is logged (alert `peer_rejected`). A non-empty allowlist is enforced; an empty one accepts any peer. | +| Allowlist | A peer whose address does not match `allowed_peer_cidrs` is rejected at accept, before any byte is read, and `listener.peer_rejected` is logged (alert `peer_rejected`). A non-empty allowlist is enforced; an empty one accepts any peer only on a loopback bind or with `allow_any_peer: true` (validation refuses a non-loopback listener that has neither). | | Additional peer | A peer that connects while a session is active is reset, logged as a warning and counted as `listener.peer_rejected`. The active session is never replaced by the newcomer. A peer arriving as the previous connection closes waits up to 250 ms for that session to release the listener before it is refused, so a sender that reconnects at once is accepted. A rebooted instrument whose old connection is half-open is accepted once keepalive or `idle_timeout_seconds` has dropped the old connection. | | No state change | Rejecting a peer does not change channel state unless a pairing timeout or other failure is already in progress. | | Stays bound | The listening socket stays bound across peer read/write failures, pairing timeouts, failure of the other side and retry backoff. An allowed peer arriving between sessions can be accepted and held by the transport until the next attachment attempt. An error returned by the acceptor drops it so the next attempt binds again. | diff --git a/docs/spec/configuration.md b/docs/spec/configuration.md index 85cec33..cffffc2 100644 --- a/docs/spec/configuration.md +++ b/docs/spec/configuration.md @@ -352,8 +352,8 @@ All protocol settings are validated when the document is validated. ### 7.2 `au` -No defaults except `block_timeout_ms` (9900, the codec's): the laboratory supplies the -settings of the instrument's online parameter sheet. +No defaults except `block_timeout_ms` (9900, the codec's) and `format.test_code_digits` (2): +the laboratory supplies the settings of the instrument's online parameter sheet. | Field | Type | Validation | | --- | --- | --- | @@ -387,7 +387,7 @@ A receipt keeps the settings it was received with; later config changes never re | `charset` | string | `utf8` | `utf8`, `latin1`, `ascii`. Written to MSH-18 and used to decode. | | `max_message_bytes` | integer | `1048576` | 1024–67,108,864. | | `require_end_cr` | boolean | `true` | `false`: a frame ends at the end block (0x1C) and a carriage return right after it is accepted but not required, for senders that omit it. Frames the engine writes always end 0x1C 0x0D. | -| `ack_message_types` | array of string | `["ACK"]` | Destination: 1–8 message codes (MSH-9.1, three capitals or digits) accepted as the acknowledgement of a sent message. An order message is answered by an order response (`ORL`, `ORR`), which carries the same MSA segment; list its code or the answer is ignored (`delivery.ack_unmatched`) and the delivery times out. Correlation by MSA-2 and the acknowledgement levels do not change; per-order status in ORC-1 (for example `OK` or `UA`) is not evaluated, so `acknowledged` reflects the MSA code only. | +| `ack_message_types` | array of string | `["ACK"]` | Destination: 1–8 message codes (MSH-9.1, three capitals or digits, starting with a letter) accepted as the acknowledgement of a sent message. An order message is answered by an order response (`ORL`, `ORR`), which carries the same MSA segment; list its code or the answer is ignored (`delivery.ack_unmatched`) and the delivery times out. Correlation by MSA-2 and the acknowledgement levels do not change; per-order status in ORC-1 (for example `OK` or `UA`) is not evaluated, so `acknowledged` reflects the MSA code only. | | `reply_type` | string | `ack` | Source: `ack` answers every message with an `ACK`; `order_response` answers `OML^O33` with `ORL^O34`, `OML^O35` with `ORL^O36`, `OML^O21` with `ORL^O22` and `ORM^O01` with `ORR^O02` (MSH-9.3 `ORL_O34` and so on from v2.3.1), with the codes and MSA-2 an `ACK` would carry; other messages still get an `ACK`. The response is the base HL7 form, MSH and MSA only (the response group is optional in these structures): `AA` means the engine stored the order, it states no per-order acceptance (no ORC) and the reply is not an IHE LAW LAB-28 response. In enhanced mode only the application stage changes; the commit acknowledgement stays an `ACK`. | | `frame_timeout_ms` | integer | `30000` | 1000–300,000. A frame that has started (0x0B) and receives no further bytes for this long is discarded and the connection closed. The time counts while the engine waits for the frame's bytes, from when the frames completed by the same read are committed and acknowledged. | @@ -447,15 +447,15 @@ instrument before use ([compliance guide](../operations/compliance.md) validatio | --- | --- | | `connectors[]` | `id`, `label`, `protocol`, `roles` (`source`, `destination`), `summary`, `settings` (a patch: only the listed settings change), `evidence`. | | `mappings[]` | `id`, `label`, `from` and `to` protocols, `summary`, `notes`, `mapping` (a destination `mapping` object, section 8), optional `destination_settings` (a patch for the destination connector), `sample` and `evidence`. | -| `sample` | `input` and `output`: a synthetic source message and the destination message the mapping produces from it (records and segments end with CR; the AU input is the framed wire text). `header` holds the MSH fields an HL7 destination generates (`MSH.3` and so on) that `output` was produced with, and `source_settings` the AU settings needed to read `input`. | +| `sample` | `input` and `output`: a synthetic source message and the destination message the mapping produces from it (records and segments end with CR; the AU input is the framed wire text). `header` holds the MSH fields an HL7 destination generates (`MSH.3` and so on) that `output` was produced with, and `source_settings` the source connector settings needed to read `input` (the AU parameter sheet, the ASTM specimen id path). | Code tables named `tests` ship empty and their lookups keep or skip an unlisted code, so an -unedited preset does not fail a message for an unknown test. Result presets set +unedited preset does not fail a message for an unknown test. ASTM result presets set `require_single_group`: a batch with several patients or orders is refused with a transform error instead of mixing specimens. Download presets state what one order record can carry as mapping preconditions (`require`): at most one `PID`, for OML exactly one `SPM`, 1 to 18 `OBR` (the 18-test limit of the Roche cobas e 411 order record), and one specimen id, priority and -order control (and for Roche collection time and specimen type) across the `OBR`. Every `OBR` +order control (for the ORM presets also specimen type, and for Roche collection time) across the `OBR`. Every `OBR` becomes one repetition of the universal test id (`for_each` with `mode: "repeat"`), so a message that satisfies them is carried completely; any other message is refused with a transform error and the delivery is `failed`, nothing is dropped or filtered. Tests apply every diff --git a/docs/spec/diagnostics.md b/docs/spec/diagnostics.md index 9785e0e..e9f2a3d 100644 --- a/docs/spec/diagnostics.md +++ b/docs/spec/diagnostics.md @@ -86,7 +86,7 @@ active configuration; the published value and the engine's internal value never | `retry_count` | integer | Bridge: section 7 of bridge-channels. Message: retry count of the source endpoint cycle. | | `next_retry_at` | string or null | Set while a retry waits; null during an attempt and while running. | | `last_error` | object or null | Operator-facing last error: `at`, `summary`, `next_action` (string or null); see [section 7.4](#74-error-summaries). | -| `recent_errors` | array | The last 100 errors in the same shape, oldest first. | +| `recent_errors` | array | The last `diagnostics.retain_recent_errors` errors (default 100) in the same shape, oldest first. | | `allowed_actions` | array | Operator commands whose preconditions hold now: `pause`, `resume`, `restart`. | | `bridge`, `message` | object or null | Detail for the channel's kind (sections 4.2 and 4.3); the other is null. | @@ -330,7 +330,7 @@ Levels are as emitted; a row with two levels names both. | `config.applied` | info | Apply result | `config_version`, `result`, `added`, `restarted`, `updated`, `removed`, `stopped` | | `config.rejected` | warn | An apply was rejected; the runtime file was invalid at startup | `errors` (count); `file`, `error` at startup | | `config.imported`, `config.empty` | info, warn | Startup used the runtime file as a new version; there is no configuration | `file`, `config_version` | -| `config.version_skipped`, `config.prune_failed`, `config.save_failed` | warn, warn, error | A saved version was unusable; an old version could not be removed; a version could not be saved | `config_version` or `path`, `error` | +| `config.version_skipped`, `config.prune_failed`, `config.save_failed` | warn, warn, error (warn when only the apply outcomes could not be saved) | A saved version was unusable; an old version could not be removed; a version or its apply outcomes could not be saved | `config_version` or `path`, `error` | | `config.replacement_not_ready` | warn | A replacement instance did not pair in time and takes over anyway | `channel_id` | | `secrets.unavailable` | warn | Secret names could not be listed to check references | `error` | | `channel.started` | info | Instance created | `config_version` | @@ -394,7 +394,7 @@ Levels are as emitted; a row with two levels names both. | `notification.ca_invalid` | warn | At start, `notifications.ca_file` cannot be read or holds no usable certificate; TLS sends fail naming the file | `ca_file`, `error_summary` | | `backup.pruned` | info | An old scheduled backup was removed | `directory` | | `backup.status_unwritten` | warn | The attempt status could not be saved; this does not fail the backup | `error` | -| `backup.undo_failed` | error | A failed restore could not remove partial state or put previous state back | `path` (directory operations), `error` | +| `backup.undo_failed` | error; warn when only the final sync of the state directory failed | A failed restore could not remove partial state or put previous state back | `path` (directory operations), `error` | | `routing.paused_unreadable`, `routing.paused_not_saved` | warn | The paused-channel list could not be read or saved | `path`, `error` | | `ipc.group_unavailable` | warn | The socket could not be given to `ipc.group` and stays owner-only | `group`, `error_summary` | | `ipc.connected` | info | A management connection was accepted; its OS account is read from the connection (Unix peer credentials, the Windows pipe client's token) | `operator_account`, `uid_or_sid`, `pid` | @@ -402,7 +402,7 @@ Levels are as emitted; a row with two levels names both. | `ipc.hello`, `ipc.client_disconnected`, `ipc.read_failed`, `ipc.write_failed`, `ipc.pipe_busy` | debug | Management-interface client lifecycle and I/O | `client`, `operator_account`, `origin` (hello), `error` | | `host.eventlog_failed`, `host.service_failed`, `host.engine_failed`, `host.status_failed` | warn, error, error, warn | Windows service hosting failures | `error_summary` | | `alert.raised`, `alert.cleared` | warn, info | Alert change | `alert_id`, `code`, `severity` (raised), `channel_id`, `endpoint_id` | -| `operator.command` | info | An operator command was answered | `command` (`apply_config`, `validate_config`, `pause_channel`, `resume_channel`, `restart_channel`, `resend`, `close_delivery`, `set_secret`, `delete_secret`), `result` (`accepted`, `rejected`, `failed`), `operator_account` and `uid_or_sid` (the OS account behind the connection), `origin` (the client kind named in its hello: `console`, `cli`, `sim`; `unknown` without one; a label, not an identity); free-text reasons are logged by length only (`reason_length`) | +| `operator.command` | info | An operator command was answered | `command` (`apply_config`, `validate_config`, `pause_channel`, `resume_channel`, `restart_channel`, `resend`, `close_delivery`, `verify_config_version`, `set_secret`, `delete_secret`, `test_endpoint`, `test_notification`), `result` (`accepted`, `rejected`, `failed`), `operator_account` and `uid_or_sid` (the OS account behind the connection), `origin` (the client kind named in its hello: `console`, `cli`, `sim`; `unknown` without one; a label, not an identity); free-text reasons are logged by length only (`reason_length`) | The message store logs its own lines for `message.frame_committed`, `message.committed`, `message.identity_reused`, `message.aborted` and the `delivery.*` events `attempt_started`, diff --git a/docs/spec/message-channels.md b/docs/spec/message-channels.md index 48a8d95..4265ba2 100644 --- a/docs/spec/message-channels.md +++ b/docs/spec/message-channels.md @@ -455,8 +455,10 @@ Steps, in order, each idempotent: The attempt record is committed before the first byte is written, so a delivery never starts sending without a record. Counted `unknown`. 4. **Queue.** Deliveries in `queued` are kept in receipt order with their `next_attempt_at`. -5. **Paused channels.** The stored operator-paused flags are restored; those channels stay - stopped. +5. **Paused channels.** Operator pause flags are not in the store: the registry reads them + from `/routing/paused.json` + ([bridge-channels.md §12](bridge-channels.md#12-startup-and-operator-stop)); those channels + stay stopped. 6. **Report.** One `reconciliation.completed` event with the counts; each `unknown` delivery is visible through `delivery_needs_attention`, each aborted transfer through its message. Alerts are recomputed from the store on the first snapshot. @@ -489,10 +491,10 @@ follow. Per message channel and per destination (full schema in [diagnostics.md](diagnostics.md#4-channel-snapshots)): `received`, `duplicates`, `invalid`, -`filtered`, `aborted`, `bytes_in`; per destination `queued`, `sending`, `acknowledged`, -`rejected`, `timed_out`, `outcome_unknown`, `failed` (of which `transform_errors` failed in -their mapping), `cancelled`, `oldest_queued_at`, `next_attempt_at`, `last_ack_at`, -`last_error_summary`. +`filtered`, `aborted`, `bytes_in`; per destination `queued`, `sending`, `oldest_queued_at`, +`next_attempt_at`, `attempts`, `acknowledged`, `rejected`, `timed_out`, `outcome_unknown`, +`failed` (of which `transform_errors` failed in their mapping), `bytes_out`, +`last_attempt_at`, `last_ack_at`, `last_error`. ## 16. Non-goals diff --git a/docs/spec/operator-console.md b/docs/spec/operator-console.md index 040f2b5..2f2cdbc 100644 --- a/docs/spec/operator-console.md +++ b/docs/spec/operator-console.md @@ -64,7 +64,7 @@ An intentionally stopped channel is never styled as a failure. A channel with an | `listening` | `neutral` | circle with a dot, "Listening" (with "waiting for peer" when no peer) | | `connecting` | `info` | spinner, "Connecting" | | `retrying` | `warning` | circular arrow, "Retrying" | -| `disconnected` | `neutral` | hollow circle, "Disconnected" | +| `disconnected` | `neutral` | dashed circle, "Disconnected" | | `error` | `danger` | cross, "Error" | | `disabled` | `neutral` | dash, "Disabled" | @@ -201,8 +201,8 @@ flags for content export, duplicate risk, superseded messages and restore. | `restart_channel` (`channel_command: restart`) | channel | Exists; enabled; not operator-paused; runner available; engine not shutting down | Yes: the session closes and counters of the instance reset | New instance from the active definition | | `resend` | message, destinations, mode, optional reason | Readable store; message belongs to a configured message channel; destinations and states satisfy [message-channels.md §9](message-channels.md#9-resend-and-close); optional reason is 1–500 trimmed characters; a superseded message needs `confirm_superseded` | The dialog explains both modes; duplicate risk requires a checkbox | Per-destination result list; `new_message_id` when a new message was created | | `close_delivery` | delivery, reason | Readable store; delivery exists in `queued`, `rejected`, `failed`, `timed_out` or `outcome_unknown`; reason is 1–500 trimmed characters | Yes: "Closing does not contact the destination" | Delivery `cancelled` with the reason | -| `export_messages` | filter, format, optional original bodies | Readable store; valid message filter | CLI/IPC operation | Export chunks and matching count (section 6) | -| `verify_transmission` | channel id, period | Readable store; valid period; the channel id filters stored messages and need not remain configured | CLI/IPC operation | Per-destination report and up to 10,000 delivery rows | +| `export_messages` | filter, format, optional original bodies | Readable store; valid message filter | The Export dialog restates the filters and the matching count and warns about identifiers; content only when ticked | Export chunks and matching count (section 6) | +| `verify_transmission` | channel id, period | Readable store; valid period; the channel id filters stored messages and need not remain configured | No | Per-destination report and up to 10,000 delivery rows | | `create_backup` | directory, or configured backup directory | New or empty absolute directory, or `backup.directory` set; the engine's backup service available | Yes for Back up now; uses `backup.directory` | Directory, files, size and audit head | | `validate_config` | document | None beyond a writable audit log over IPC; CLI validation is offline | No | Problems and the per-channel plan (`added`, `changed`, `updated`, `removed`, `unchanged`, `stopped` for channels the document disables); the plan is always present and empty when the document has errors; nothing changed | | `apply_config` (`put_config`) | document, `base_version`, note | Valid document; base equals active version; note is 1–500 trimmed characters | Yes: shows changed and untouched channels | New active version and per-channel outcomes, including partial failures; validation/conflict/save failures leave the previous version active | @@ -373,7 +373,8 @@ Structured viewer over the engine's in-memory log ring ([diagnostics.md](diagnos the most recent `logging.ring_buffer_events` events since the engine started. Older history is in the log files under the log directory, which the viewer does not read. Filters: level (at or above), time range, channel, endpoint, event, text. Follows live by -default; scrolling up pauses following and shows "Jump to live". A row expands to its fields; +default; the list is newest first, and scrolling away from the newest event or opening a row +pauses following and shows "Jump to live". A row expands to its fields; channel and endpoint fields link to their pages. The viewer keeps a bounded window (10,000 rows) and queries older ring entries with `before_seq`; reconnect backfill uses `after_seq` (decision 20). Message bodies are never in logs, so none @@ -416,7 +417,7 @@ show the active counts. raises `notifications_failing`. - **Privacy**: idle protection, a setting of this console on this computer (not of the engine): after 1–240 minutes without activity (default 15) bodies, parsed fields and - audit details are hidden behind "Show again". There is no login; it does not lock the + audit details are hidden until the operator chooses "Continue". There is no login; it does not lock the computer. - **Audit**: the audit log ([audit.md](audit.md)) as a grid, newest first, filtered by time, account, action, origin, outcome and object; a row opens the event's details; export (CSV, diff --git a/docs/testing.md b/docs/testing.md index 6d65ded..6d7c1ca 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -11,8 +11,8 @@ checked at integration points rather than after every edit. | Crate tests | Each crate's own behavior, including error paths | `crates//src` and `crates//tests` | The crate's author, scoped (`cargo test -p`) | | Protocol conformance | Codecs accept the corpus, reject malformed input with typed errors, never panic (property tests on framing and escaping) | `crates/packie-astm`, `packie-au`, `packie-hl7`, `packie-files` fixtures | The crate's author | | Scenarios | Channels behave as specified under connect, send, disconnect, reconnect, config apply, pause/resume, overflow, duplicate, crash-and-restart; driven by the simulator over real loopback TCP and virtual serial ports | `tests/scenarios/*.json` + `crates/packie-sim` runner | Routing/transport authors for their scenarios; the gate for all | -| Console | Type-check and lint; component tests for grids and filters; smoke of each page against the simulator-backed engine | `console/` | Console author; the gate for the smoke journey | -| Gate | `cargo fmt --check`, `cargo clippy --workspace -D warnings`, `cargo test --workspace`, console `tsc` + lint + tests, scenario suite | CI on every pull request and every push to `main`; a maintainer before a release | +| Console | Type-check and lint; component tests for grids and filters; browser journeys through each page on the mock engine | `console/` | Console author; the gate for the journeys | +| Gate | `cargo fmt --check`, `cargo clippy --workspace -D warnings`, `cargo test --workspace`, console `tsc` + lint + tests, scenario suite | CI on every pull request and every push to `develop` or `main`; a maintainer before a release | ## Rules diff --git a/packaging/VERIFY.md b/packaging/VERIFY.md index da78be1..1713fa8 100644 --- a/packaging/VERIFY.md +++ b/packaging/VERIFY.md @@ -241,10 +241,10 @@ These steps check the system daemon that the `.pkg` installs. A user agent (`ser - [ ] M5a. Break the bootstrap (for example set `"node_id": "Bad Id"`), run `sudo packie --bootstrap "/Library/Application Support/Positive ACK/bootstrap.json" service stop` and `… service start`, wait 30 seconds, then repeat M2. - Expected: `stopped`, not relaunched; `/var/log/packie/launchd.stderr.log` ends with the + Expected: `stopped`, not relaunched; `/Library/Logs/Positive ACK/launchd.stderr.log` ends with the `node.node_id` error and "the service is not restarted until this is fixed". Restore the bootstrap and start again. -- [ ] M6. Run `sudo packaging/macos/uninstall.sh` from a checkout, or the copy shipped with the release. +- [ ] M6. Run `sudo packaging/macos/uninstall.sh` from a checkout. Expected: `packie service status` then prints `Not installed`, and the state under `/Library/Application Support/Positive ACK/state` is kept. From 3772f9e5ad9551bc50d9b52d2506a59ad7684032 Mon Sep 17 00:00:00 2001 From: gabalint <1663150+gabalint@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:20:59 -0500 Subject: [PATCH 2/4] Name the pull request in the changelog entry Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 2 +- changelog.d/2026-11-22-help-reconnect-timing.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60bd1ec..1edb3fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -254,7 +254,7 @@ top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/ ### Low impact -- **Fixed:** Help and guides corrected where they disagreed with the engine (2026-11-22) +- **Fixed:** Help and guides corrected where they disagreed with the engine (2026-11-22, [#11](https://github.com/openbga/interface-engine/pull/11)) The Connection help article now gives the console's actual reconnection timing: a first retry after about half a second, doubling to about 5 seconds. The operator guides were corrected in diff --git a/changelog.d/2026-11-22-help-reconnect-timing.md b/changelog.d/2026-11-22-help-reconnect-timing.md index d745635..17a96e8 100644 --- a/changelog.d/2026-11-22-help-reconnect-timing.md +++ b/changelog.d/2026-11-22-help-reconnect-timing.md @@ -4,6 +4,7 @@ type: fixed impact: low title: Help and guides corrected where they disagreed with the engine area: Documentation +pr: 11 --- The Connection help article now gives the console's actual reconnection timing: a first retry after about half a second, doubling to about 5 seconds. The operator guides were corrected in From 360e413e832d6a4cdee23d51a98bd19375fd4cf4 Mon Sep 17 00:00:00 2001 From: gabalint <1663150+gabalint@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:27:38 -0500 Subject: [PATCH 3/4] Address review: notify crate in the crate map, compliance guide, wording Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 10 +++++----- changelog.d/2026-11-22-help-reconnect-timing.md | 10 +++++----- docs/architecture.md | 3 ++- docs/operations/compliance.md | 7 ++++--- docs/operations/configuration-reference.md | 2 +- docs/operations/running-and-monitoring.md | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1edb3fd..9c5a163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -254,18 +254,18 @@ top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/ ### Low impact -- **Fixed:** Help and guides corrected where they disagreed with the engine (2026-11-22, [#11](https://github.com/openbga/interface-engine/pull/11)) +- **Fixed:** Help and operator guides corrected where they disagreed with the engine (2026-11-22, [#11](https://github.com/openbga/interface-engine/pull/11)) - The Connection help article now gives the console's actual reconnection timing: a first retry - after about half a second, doubling to about 5 seconds. The operator guides were corrected in - the same way wherever they described something the engine does differently. + The Connection to the engine help article now gives the console's actual reconnection timing: a + first retry after about half a second, doubling to about 5 seconds. Statements in the operator + guides that the engine contradicts were corrected in the same way. Technical notes: Operator guide corrections: the macOS daemon's error log is `/Library/Logs/Positive ACK/launchd.stderr.log`; the Messages text filter searches identifiers and message type, never bodies; a truncated transmission CSV ends with a `# truncated:` line and - its totals cover the whole period; an export with `--bodies` stops with an error when an + the report's totals cover the whole period; an export with `--bodies` stops with an error when an original cannot be read; `max_frame_chars` accepts 64–64,000; an AU class A destination and an HL7 destination with `ack_mode: none` reach `handed_off` at most. No behavior changed. diff --git a/changelog.d/2026-11-22-help-reconnect-timing.md b/changelog.d/2026-11-22-help-reconnect-timing.md index 17a96e8..e0027c0 100644 --- a/changelog.d/2026-11-22-help-reconnect-timing.md +++ b/changelog.d/2026-11-22-help-reconnect-timing.md @@ -2,19 +2,19 @@ date: 2026-11-22 type: fixed impact: low -title: Help and guides corrected where they disagreed with the engine +title: Help and operator guides corrected where they disagreed with the engine area: Documentation pr: 11 --- -The Connection help article now gives the console's actual reconnection timing: a first retry -after about half a second, doubling to about 5 seconds. The operator guides were corrected in -the same way wherever they described something the engine does differently. +The Connection to the engine help article now gives the console's actual reconnection timing: a +first retry after about half a second, doubling to about 5 seconds. Statements in the operator +guides that the engine contradicts were corrected in the same way. ## Technical notes Operator guide corrections: the macOS daemon's error log is `/Library/Logs/Positive ACK/launchd.stderr.log`; the Messages text filter searches identifiers and message type, never bodies; a truncated transmission CSV ends with a `# truncated:` line and -its totals cover the whole period; an export with `--bodies` stops with an error when an +the report's totals cover the whole period; an export with `--bodies` stops with an error when an original cannot be read; `max_frame_chars` accepts 64–64,000; an AU class A destination and an HL7 destination with `ack_mode: none` reach `handed_off` at most. No behavior changed. diff --git a/docs/architecture.md b/docs/architecture.md index f50e55e..c4c2514 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -101,7 +101,7 @@ How OpenBGA Interface Engine is built. Behavior details per area live in `docs/s | ASTM E1381 / E1394 (LIS01-A2 / LIS02-A2) | `packie-astm` | receive results, send orders/queries | Frame layer with checksum, ACK/NAK/EOT, retransmission, contention; record layer H/P/O/R/C/Q/L with field accessors. | | AU400 / AU640 | `packie-au` | receive results, send worklists | Fixed-width records. | | HL7 v2.x | `packie-hl7` | MLLP client and listener; ORU, ORM/OML, ORL, ACK, ADT as generic messages | Generic segment/field/component model with escaping; typed helpers; ACK generation in original and enhanced modes; MLLP streaming framer. Message version from MSH-12. | -| Delimited files | `packie-files` | read and write | Templates: delimiter, quoting, header row, column→field mapping, one record per line or grouped. The folder and SFTP transports in `packie-transport` detect a complete file (stable size and ignored suffixes; the folder transport also checks that no writer holds the file open). | +| Delimited files | `packie-files` | read and write | Templates: delimiter, quoting, header row, column→field mapping, one record per line or grouped. The folder and SFTP transports in `packie-transport` decide when a file is complete (`stable_seconds`, `ignore_suffixes` and, for folders, `exclusive_open_check`). | | Raw | `packie-routing` | bridges, taps | No parsing. | Transformation model (`packie-transform`): a message's parsed model is addressed by paths @@ -169,6 +169,7 @@ restricted secrets file; never stored in the documents. | `packie-audit` | Append-only, hash-chained audit log in `/audit` (its own SQLite files and writer), review queries, export, chain verification, yearly sealing and retention ([spec/audit.md](spec/audit.md)) | core, ipc | | `packie-backup` | Backup (store snapshot, bodies, audit, configuration, SHA-256 manifest), verification, restore with the engine stopped, schedule and status ([spec/backup.md](spec/backup.md)) | audit, config, core, host, ipc, store | | `packie-diagnostics` | Tracing setup, ring buffer, snapshots, alerts, counters, traffic tap | core, config (alert thresholds) | +| `packie-notify` | Alert notifications by e-mail and webhook: severity routing, rate limiting, failing-target tracking ([spec/diagnostics.md §6.1](spec/diagnostics.md#61-notifications)) | config, core, diagnostics | | `packie-routing` | Channel supervisors, bridge sessions and buffers, message pipeline, retry policy, connectors, store opening with retry; implements `packie_engine::ChannelRegistry` | astm, au, config, core, diagnostics, engine (registry contract), files, hl7, ipc, store, transform, transport | | `packie-ipc` | IPC protocol DTOs (ts-rs), framing, server and client | core, config, diagnostics | | `packie-engine` | Composition: loads config, starts diagnostics and IPC, opens audit through the host-supplied opener, schedules backups, publishes snapshots, applies config to the `ChannelRegistry` its host supplies | astm, backup, config, core, diagnostics, hl7, ipc, notify, transform | diff --git a/docs/operations/compliance.md b/docs/operations/compliance.md index 264fd96..5668b97 100644 --- a/docs/operations/compliance.md +++ b/docs/operations/compliance.md @@ -159,7 +159,7 @@ the lab's source-to-final-report comparisons: | Evidence task | Command and interpretation | | --- | --- | | Summarize receipt and delivery for a channel/time window | `packie messages verify --channel --since --until ` counts accepted, received, handed-off, unresolved, closed and pending deliveries per destination. | -| Preserve delivery-level evidence | Add `--csv --output ` for rows with original/transformed SHA-256, states, ACK level/code, `ack_control_id` (the ACK's own control id; HL7 ACK `MSH-10`), attempts and times. Check the summary or `--json` report for `truncated`; CSV has no truncation marker. Split periods exceeding 10,000 delivery rows. | +| Preserve delivery-level evidence | Add `--csv --output ` for rows with original/transformed SHA-256, states, ACK level/code, `ack_control_id` (the ACK's own control id; HL7 ACK `MSH-10`), attempts and times. Check the summary or `--json` report for `truncated`; a truncated CSV ends with a `# truncated:` line. Split periods exceeding 10,000 delivery rows. | | Preserve selected messages | `packie messages export --channel --since --until --format jsonl --output ` exports matching metadata and delivery summaries, oldest first. Add `--bodies` only when original content is required. | | Compare original and transformed content locally | `packie messages show --body original`, `--body ` and `--fields` explicitly request content; `--json` without them shows metadata, including mapping versions and stored hashes. Displayed bodies can be truncated. | @@ -167,8 +167,9 @@ Reports are audited as `transmission_verify`; message exports as `message_export filters, format, whether bodies were requested and matching count. Both record the OS account. Existing output files are refused. Even metadata and hashes can be PHI; restrict evidence access, encrypt storage/transfer, inventory recipients and retain/dispose copies -under the lab's policy. Exported bodies are UTF-8 text with invalid sequences replaced and -unreadable/incomplete originals exported as empty text, so they are not byte-exact archives. +under the lab's policy. Exported bodies are UTF-8 text with invalid sequences replaced, so +they are not byte-exact archives; an unreadable or incomplete original stops the export with an +error. Use [verified backups](install.md#backup-and-restore) when preserving the complete stored data. A stored-byte hash does not prove clinical correctness, and a missing transformed hash does diff --git a/docs/operations/configuration-reference.md b/docs/operations/configuration-reference.md index 1b710ae..8244091 100644 --- a/docs/operations/configuration-reference.md +++ b/docs/operations/configuration-reference.md @@ -116,7 +116,7 @@ that endpoint's `settings`. | `label` | Required | Display label. | | `enabled` | `true` | Boolean; `false` prevents opening the endpoint. | | `kind` | Required | `serial`, `tcp_client`, `tcp_listener`, `folder`, `sftp`. | -| `settings` | `{}` | Object for the chosen kind; its required fields still apply. | +| `settings` | Required | Object for the chosen kind. | | `tags` | `{}` | Up to 20 string-to-string metadata entries. | ### Serial settings diff --git a/docs/operations/running-and-monitoring.md b/docs/operations/running-and-monitoring.md index 98b4c04..69a147c 100644 --- a/docs/operations/running-and-monitoring.md +++ b/docs/operations/running-and-monitoring.md @@ -17,7 +17,7 @@ deliveries needing attention, message-store state and free disk space. | --- | --- | | Running (`healthy` in `packie status`) | The engine has an active configuration and usable store, disk is above the critical limit, and enabled channels are running or starting. | | Needs attention (`degraded`) | A channel needs recovery, the store is unavailable, disk is critically low, or no valid configuration is active. Open the alerts and affected channel. | -| Stopping (`stopped`) | Shutdown has completed. | +| Stopping (`stopped`) | Shutdown has completed; this is the engine's final state before it exits. | Paused and disabled channels do not by themselves make the engine degraded. A healthy engine can still have deliveries needing an operator's decision. From 7d9b6df4dac29e6ee851539760e79409ce6abf87 Mon Sep 17 00:00:00 2001 From: gabalint <1663150+gabalint@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:29:45 -0500 Subject: [PATCH 4/4] Bring two more statements in line with the corrected ones Co-Authored-By: Claude Fable 5.2 --- console/help/mapping-rules.json | 2 +- docs/spec/acceptance.md | 2 +- docs/spec/operator-console.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/console/help/mapping-rules.json b/console/help/mapping-rules.json index bc88d8e..edf3394 100644 --- a/console/help/mapping-rules.json +++ b/console/help/mapping-rules.json @@ -7,7 +7,7 @@ { "title": "Rules", "paragraphs": [ - "A destination's rules run from top to bottom and build a new message, which starts empty apart from generated header fields. copy writes the text at From to To, with a default for an empty source and Required to fail the message when it is empty. constant writes fixed text, concat joins paths and text, datetime reformats a date, calculate works out a number, when runs its rules if a condition holds. A message that fails a rule is kept and shows as failed; fix the mapping, apply, then resend." + "A destination's rules run from top to bottom and build a new message, which starts empty apart from generated header fields, or as a copy of the source when both are HL7 or both ASTM. copy writes the text at From to To, with a default for an empty source and Required to fail the message when it is empty. constant writes fixed text, concat joins paths and text, datetime reformats a date, calculate works out a number, when runs its rules if a condition holds. A message that fails a rule is kept and shows as failed; fix the mapping, apply, then resend." ] }, { diff --git a/docs/spec/acceptance.md b/docs/spec/acceptance.md index e7a15f3..d256204 100644 --- a/docs/spec/acceptance.md +++ b/docs/spec/acceptance.md @@ -115,7 +115,7 @@ The release sentence of requirements.md, clause by clause. | E-02 | ASTM send of orders and queries | The engine runs the sender side (ENQ, frames, EOT) and records `received` on completion | PRO-01 | `msg-astm-receive-ack-after-commit`, `crate: packie-astm` | | E-03 | AU400/AU640 class A and B over serial and TCP; send worklists | Class B ACKs follow durable commit; incomplete samples abort; settings are frozen per receipt | PRO-02 | `crate: packie-au` | | E-04 | HL7 MLLP client and listener in both acknowledgement modes | Per-message acknowledgement tracking; mismatched acknowledgements are ignored and logged | PRO-03 | `msg-hl7-in-ack`, `msg-hl7-out-ack-tracked` | -| E-05 | Delimited files in and out, grouped records, quoting | Columns and order as templated; completion detection; oversize file aborted | PRO-04 | `msg-hl7-out-ack-tracked`, `crate: packie-files` | +| E-05 | Delimited files in and out, grouped records, quoting | Columns and order as templated; completion detection; oversize file aborted | PRO-04 | `msg-hl7-out-ack-tracked`, `crate: packie-files`, `crate: packie-transport` | | E-06 | Raw bytes through bridges and taps | No parsing; counters and observed messages work with a framer | PRO-05 | `bridge-tcp-full-duplex`, `bridge-tap-hl7` | | E-07 | Conformance corpora including malformed and truncated input; property tests on framing and escaping | Typed errors for malformed input, never a panic, for every protocol | PRO-06 | `crate: packie-astm`, `packie-au`, `packie-hl7`, `packie-files` | diff --git a/docs/spec/operator-console.md b/docs/spec/operator-console.md index 2f2cdbc..795c6ff 100644 --- a/docs/spec/operator-console.md +++ b/docs/spec/operator-console.md @@ -115,7 +115,7 @@ Rows sort by rank, then by the tie-break rules: | 5 | `running` with traffic in the last 60 s | | 6 | `running`, idle | | 7 | `starting` | -| 8 | `stopped` (paused, disabled) | +| 8 | `stopped` (any reason) | Tie-breaks inside a rank: channels with an error in the last 5 minutes above quiet ones, then the most recent error first, then label A to Z. A retrying channel never sorts below a