Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <crate>`,
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,21 @@ top, then by impact. Types follow [Keep a Changelog](https://keepachangelog.com/

### Low impact

- **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 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
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.

- **Fixed:** Configuration fixes (2026-11-12)

Signing off a verification no longer crashes, a configuration with extra text after it is rejected,
Expand Down
20 changes: 20 additions & 0 deletions changelog.d/2026-11-22-help-reconnect-timing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
date: 2026-11-22
type: fixed
impact: low
title: Help and operator guides corrected where they disagreed with the engine
area: Documentation
pr: 11
---
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
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.
14 changes: 7 additions & 7 deletions console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand Down Expand Up @@ -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).
4 changes: 2 additions & 2 deletions console/e2e/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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-<date>.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 `<name>-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 <that directory>` 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. | ☐ |
Expand Down
2 changes: 1 addition & 1 deletion console/help/connection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion console/help/mapping-rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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; one message per file to a folder or SFTP server (destination); 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` decide when a file is complete (`stable_seconds`, `ignore_suffixes` and, for folders, `exclusive_open_check`). |
| PDF reports | `packie-pdf` | read | Text layer of born-digital reports (lopdf for the file structure, an engine-owned content-stream walker for positioned text); a template of labelled fields; no OCR. |
| Raw | `packie-routing` | bridges, taps | No parsing. |

Expand Down Expand Up @@ -170,9 +170,10 @@ restricted secrets file; never stored in the documents.
| `packie-audit` | Append-only, hash-chained audit log in `<state>/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, 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 |
Expand Down
26 changes: 4 additions & 22 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| --- | --- |
Expand Down Expand Up @@ -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/`
Expand Down
Loading
Loading