Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c96574c
Refuse non-positive tee relay retry count and shadow-queue bound
wshallwshall Nov 22, 2026
57f4e3f
Harness detail panel withdraws Replay while an open loads; a non-ApiE…
wshallwshall Nov 22, 2026
92bca4a
IDE Steps view keeps handler roles and message types per panel
wshallwshall Nov 22, 2026
cf0feb8
IDE: resolve the config dir and fold case only where the filesystem does
wshallwshall Nov 22, 2026
dafe9ef
IDE Steps view insert anchors carry the row's fan-out flags
wshallwshall Nov 22, 2026
8871ccd
Alert Rules Add refuses values the engine's AlertRule refuses
wshallwshall Nov 22, 2026
ba595ef
Edit the results_relay OBX block through the parsed model
wshallwshall Nov 22, 2026
d237079
Harness A5 probe reports the raw-TCP listener port the row names
wshallwshall Nov 22, 2026
3e42d9e
Promote reports a degraded reload and its failed steps
wshallwshall Nov 22, 2026
3c057ae
IDE: the code-set custom editor saves its own file as an edit
wshallwshall Nov 22, 2026
dfc13cc
De-identify the vendored HAPI sample adt_a03.txt through the anon fra…
wshallwshall Nov 22, 2026
223c948
IDE Steps view checks panel focus before noting a suppressed change
wshallwshall Nov 22, 2026
dc41627
Tidy the per-occurrence delete and the results_relay README
wshallwshall Nov 22, 2026
89a124e
Live debug matches trace files by workspace-resolved, case-folded path
wshallwshall Nov 22, 2026
6fe90cc
Tee relay bounds: review round 1 repairs
wshallwshall Nov 22, 2026
ebc6e91
Simplify the detail-panel open-failure path and pin the A5 TCP port t…
wshallwshall Nov 22, 2026
2608998
IDE Steps view walks Move up/down in every function of a module
wshallwshall Nov 22, 2026
e8ff24d
Test Bench collections live in a null-prototype map
wshallwshall Nov 22, 2026
c36f126
Validate diagnostics resolve against the workspace and keep their line
wshallwshall Nov 22, 2026
a364461
IDE Steps view simplify pass on the insert-anchor reader
wshallwshall Nov 22, 2026
c74fe51
Simplify the alert bounds and promote shortfall changes
wshallwshall Nov 22, 2026
7366764
IDE Steps view treats a Router route row as a return
wshallwshall Nov 22, 2026
175610c
IDE: open only the exact config-dir file, and refuse an unloaded code…
wshallwshall Nov 22, 2026
fed4d38
IDE Steps view inserts after a control header as the block's first step
wshallwshall Nov 22, 2026
2cee1b7
Review round 1 repairs for the results_relay OBX edit
wshallwshall Nov 22, 2026
5cbe91c
Tee relay bounds: review round 2 repairs
wshallwshall Nov 22, 2026
36608f2
IDE Steps view shows Comment and Pragma text, and edits a Comment
wshallwshall Nov 22, 2026
a38e9ff
Scrub adt_a03's MSH time and facility, and pin its upstream values ab…
wshallwshall Nov 22, 2026
0f0aa8b
Revert the Steps change-listener reorder: its re-render is load-bearing
wshallwshall Nov 22, 2026
2f4d5a7
Review round 1 repairs: own-file line shape, Uri-keyed diagnostics, t…
wshallwshall Nov 22, 2026
c2b293f
IDE Steps context menu sets every Add item's state afresh on each open
wshallwshall Nov 22, 2026
3762573
Review round 1: blank the panel during an open, log a raised open, re…
wshallwshall Nov 22, 2026
fc54abf
Review round 1 repairs for alert bounds and promote degraded
wshallwshall Nov 22, 2026
ed2f722
IDE Steps view review round 1: refuse a malformed anchor, update besi…
wshallwshall Nov 22, 2026
9371298
Tee relay: say the Corepoint attempt count includes the first try
wshallwshall Nov 22, 2026
100294f
IDE Steps g09 test helper keeps undefined keys and matches the toolbar
wshallwshall Nov 22, 2026
65e6a2c
IDE: re-check the config-dir file at save time, and lock an unloaded …
wshallwshall Nov 22, 2026
03c9226
Review round 2 repairs for the results_relay OBX edit
wshallwshall Nov 22, 2026
d3ecfd4
Tighten the adt_a03 digest scan and the HAPI README limits
wshallwshall Nov 22, 2026
be65963
Review round 2 repairs: diagnostic grouping key, type-name match
wshallwshall Nov 22, 2026
b1eb737
Tee relay: correct the attempt-count wording the last commit left wrong
wshallwshall Nov 22, 2026
f908e45
Review round 2: keep a selection made during Replay, log no exception…
wshallwshall Nov 22, 2026
adc6810
Review round 2 repairs for alert bounds and promote degraded
wshallwshall Nov 22, 2026
707835d
IDE Steps view review round 2: refuse bad coordinates visibly
wshallwshall Nov 22, 2026
bcaaabb
Add changelog fragments for the harness detail panel and A5 TCP port …
wshallwshall Nov 22, 2026
876be80
Drop only a cancelled OBX's own NTE, PRT and Z rows in results_relay
wshallwshall Nov 22, 2026
4344d79
IDE Steps g09 review round 1: submenu, clause insert, blank body, scope
wshallwshall Nov 22, 2026
c67d69b
Say adt_a03 keeps its procedure on purpose, and why for each field
wshallwshall Nov 22, 2026
80257c8
Pin the results_relay fail-closed test to the fieldless-line refusal
wshallwshall Nov 22, 2026
d1cf27b
IDE Steps g09 review round 2: keep Comment above an elif/else clause
wshallwshall Nov 22, 2026
ff24718
Fail closed when a results_relay per-occurrence delete removes nothing
wshallwshall Nov 22, 2026
59ce6d1
Merge remote-tracking branch 'origin/b622/g01-adt-a03-scrub' into bat…
wshallwshall Nov 22, 2026
c83b68e
Merge remote-tracking branch 'origin/b622/g02-results-relay-obx' into…
wshallwshall Nov 22, 2026
4379e11
Merge remote-tracking branch 'origin/b622/g04-tee-relay-bounds' into …
wshallwshall Nov 22, 2026
716ab9e
Merge remote-tracking branch 'origin/b622/g05-harness-detail-port-pro…
wshallwshall Nov 22, 2026
ee6bf1e
Merge remote-tracking branch 'origin/b622/g06-ide-config-editors' int…
wshallwshall Nov 22, 2026
7edd9f3
Merge remote-tracking branch 'origin/b622/g07-ide-alerts-promote-trus…
wshallwshall Nov 22, 2026
d045740
Merge remote-tracking branch 'origin/b622/g08-ide-paths-testbench' in…
wshallwshall Nov 22, 2026
80ec6c4
Merge remote-tracking branch 'origin/b622/g09-ide-steps-model' into b…
wshallwshall Nov 22, 2026
14c2702
Merge remote-tracking branch 'origin/b622/g10-ide-steps-view' into ba…
wshallwshall Nov 22, 2026
0376364
Steps view: Paste on a control header lands as the block's first stat…
wshallwshall Nov 22, 2026
89edd72
Steps view: resolve live-trace file paths against the trace's own wor…
wshallwshall Nov 22, 2026
a279982
Steps view: accept only "before" as a paste position, and pin the wiring
wshallwshall Nov 22, 2026
6760a40
Steps view: buildPasteRequest takes only an explicit "before"
wshallwshall Nov 22, 2026
75c074a
Merge remote-tracking branch 'origin/b622/g11-steps-followup' into ba…
wshallwshall Nov 22, 2026
e5aa6a7
Renumber an OBX before the first OBR in the results_relay template
wshallwshall Nov 22, 2026
ff072b3
Look a blank OBX-3.1 up as "" in the results_relay template
wshallwshall Nov 22, 2026
1a87735
Refuse a config editor save or remove from a non-file document
wshallwshall Nov 22, 2026
84373bd
Review round 1 on the results_relay renumber and blank-code fixes
wshallwshall Nov 22, 2026
6ecdec5
Show a non-file config document as its own text, in place
wshallwshall Nov 22, 2026
f66b964
Review round 2 on the non-file config document page
wshallwshall Nov 22, 2026
e2f0ef4
Merge origin/main into batch/b622-wave: resolve message.py delete_seg…
wshallwshall Nov 22, 2026
ba44982
Route delete_segments(occurrence=) through main's positional guard
wshallwshall Nov 22, 2026
e45e70a
Correct the delete_segments occurrence contract and add test controls
wshallwshall Nov 22, 2026
8502441
IDE: spell out pathIdentity.ts resolve ternary; census and docs rows …
wshallwshall Nov 22, 2026
8c4c56c
IDE: spell out configEditorModel.ts resolve branches; grade it in the…
wshallwshall Nov 22, 2026
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
7 changes: 7 additions & 0 deletions changelog.d/5826-delete-one-segment.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- **`Message.delete_segments` can remove one segment.** Pass `occurrence=i` to delete only the
i-th segment of that id, numbered as `field()` and `count_segments()` number it; it returns 1, or 0
when that occurrence is absent. The `results_relay` porting template now uses it to drop a
cancelled OBX (with its NTE, PRT and Z rows) and edits the rest in place, so a feed copied from it keeps
every OBX field, escape and the OBX-to-OBR grouping. Before, the template rebuilt each OBX from a
fixed subset of fields joined by hand, and every OBX was re-inserted under the first OBR.
(`BACKLOG #5826`)
6 changes: 6 additions & 0 deletions changelog.d/5829-tee-relay-bounds.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- **The tee relay refuses a Corepoint attempt count or shadow-queue bound below one.**
`--corepoint-attempts` and `--mefor-queue-max` (and the matching `RelayConfig` fields) now take
only a positive integer, where one attempt means no retry, and a bad value stops the relay before
any listener binds. Before, zero attempts would have let the relay ACK an Epic message and then
fail without forwarding it or tripping fail-closed, and a bound of zero or less would have made
the shadow queue unbounded. (`BACKLOG #5829`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- **The harness message detail panel no longer acts on, or shows, the previous message while a new
one opens.** Selecting a row now clears the panel and withdraws Replay and Show body until that
message's open lands. Before, Replay pressed in that window would replay the previously shown
message. An open that fails with an error other than an API error is now reported and clears the
panel, where before it left the previous message on screen with nothing said. A row selected
while Replay's step-up prompt is open is kept: the refresh after the replay no longer reopens the
replayed message over it.
3 changes: 3 additions & 0 deletions changelog.d/5849-harness-a5-tcp-listener-port.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- **The harness acceptance A5 probe now reports the raw-TCP listener port.** Row A5 names the MLLP,
DICOM, TCP and API listeners, but the probe reported bindability only for MLLP, DICOM and API. It
now also reports TCP port 2580, the default of the harness's `IB_Harness_TCP` inbound.
1 change: 1 addition & 0 deletions docs/DANGEROUS-FUNCTIONALITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ the patterns cannot see, found by reading the code. The scan's limits include at
| It takes the first line of hover text it built, for a menu title. That text can carry words from the engine's reply, which `engineClient.ts` already parsed. | `statusBar.ts` |
| It splits what the MessageFoundry command line and git printed into lines, to put a time stamp on each for the "MessageFoundry Checks" output. It reads nothing out of them. | `checksLog.ts` |
| It reads the characters of the Test Bench Debug program's text, which the extension holds itself, to name the program's file by a checksum (BACKLOG #5409) | `testBenchDebugProgram.ts` |
| It lower-cases the first letter of a promote notification sentence, which always starts with its own words | `promoteOutcome.ts` |

**Extension files that parse text the patterns cannot see.**

Expand Down
16 changes: 9 additions & 7 deletions docs/TEE-RELAY.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ transformed/routed output against Corepoint's — without MEFOR delivering to re
(`AE`/`AR`) **does not propagate back to Epic** — Epic sees the relay, not Corepoint. That's why the
relay **logs every NAK** (see below). Corepoint still NAKs internally; transport failures are surfaced
via the fail-closed shutdown.
* **Fail-closed.** On a Corepoint **transport** failure (unreachable, after `--corepoint-attempts` quick
retries), the relay **stops accepting on Listener A and drops live Epic connections** so Epic sees the
outage and queues/retries on its side. It does **not** exit (so it can't crash-loop against a down
Corepoint) — **restart it once Corepoint is healthy.** A message in flight at the instant of the failure
* **Fail-closed.** On a Corepoint **transport** failure (unreachable on every one of the
`--corepoint-attempts` tries, which count the first try, so `1` means no retry), the relay **stops
accepting on Listener A and drops live Epic connections** so Epic sees the outage and
queues/retries on its side. It does **not** exit (so it can't crash-loop against a down Corepoint)
— **restart it once Corepoint is healthy.** A message in flight at the instant of the failure
may be `AA`'d-but-undelivered; the shutdown bounds further loss and Epic's resend/queue covers the rest.
(This is a simple fail-closed relay, **not** durable store-and-forward — by design.)
* **Shadow leg is decoupled.** The MEFOR copy goes through a bounded in-memory queue drained by its own
Expand Down Expand Up @@ -110,9 +111,10 @@ python -m tee run --listen-epic :6661 --corepoint corehost:5000 --mefor meforhos
python -m tee naks --db ./tee.db
```

Useful flags: `--corepoint-attempts` / `--corepoint-retry-delay` (quick retries before tripping
fail-closed), `--connect-timeout` / `--send-timeout`, `--max-frame-bytes` (frame-size DoS cap),
`--mefor-queue-max` (shadow buffer bound), `--capture-bodies` (persist full bodies — **test data only**),
Useful flags: `--corepoint-attempts` (tries before tripping fail-closed, a positive integer; see
*Fail-closed* above) / `--corepoint-retry-delay` (seconds between tries), `--connect-timeout` /
`--send-timeout`, `--max-frame-bytes` (frame-size DoS cap), `--mefor-queue-max` (shadow buffer
bound, a positive integer), `--capture-bodies` (persist full bodies — **test data only**),
`-y/--yes` (skip the test-data-only confirmation for an unattended/service start), `--log-level`,
`--stop-grace` (default 30 seconds). On shutdown the relay stops ACKing new messages, then gives
messages it has already ACKed up to the grace to finish their Corepoint and MEFOR legs, then gives
Expand Down
4 changes: 2 additions & 2 deletions docs/USER-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ Routers and Handlers work against the mutable HL7 `Message` in [messagefoundry/p

- **Peek a field** — `msg["PID-3"]` / `msg.field("OBX-3.1", occurrence=i)`; convenience properties `msg.message_code` (MSH-9.1), `msg.trigger_event` (MSH-9.2), `msg.control_id` (MSH-10).
- **Iterate repetitions / segments** — `msg.repetitions("PID-3")` walks a `~`-list; `msg.count_segments("OBX")` plus `field(occurrence=…)` walks repeating segments.
- **Mutate** — `msg["MSH-4"] = value` / `msg.set(path, value, occurrence=…, repetition=…)`; rebuild a repeating block with `msg.delete_segments("OBX")` + `msg.add_segment(line, index=…)` + `msg.add_repetition(...)`.
- **Mutate** — `msg["MSH-4"] = value` / `msg.set(path, value, occurrence=…, repetition=…)`; drop one repeating segment with `msg.delete_segments("OBX", occurrence=i)` (walk the occurrences back to front), or rebuild a whole block with `msg.delete_segments("OBX")` + `msg.add_segment(line, index=…)` + `msg.add_repetition(...)`.
- **Copy a value you read into a whole field with `msg.set_data`, never `msg.set`.** A read of a component or subcomponent, such as `msg.field("PID-3.1")`, is decoded: escaped `^`, `~` and `&` come back as plain characters. `msg.set("PV1-19", msg.field("PID-3.1"))` then writes them into a whole field as live structure, so the sender would choose the components and repetitions of a field you wrote. `msg.set_data("PV1-19", msg.field("PID-3.1") or "")` writes the value as data, and `copy_field` and `split_field` do that for you. `msg.set` on a whole field is still right for text you wrote yourself, such as `msg.set("PV1-19", "A^B")`. `messagefoundry check` flags the unsafe shape as `leaf-to-whole-field` where it can see both paths as literals ([ADR 0206](adr/0206-an-hl7-write-or-re-encode-never-lets-data-become-structure.md)). On an X12 message, `set_data` refuses the component separator in a whole element, so a value holding one raises there. Write each component on its own path, or keep `set` if you mean the separator as structure. Editing such a `set` line's path or value in the Steps view turns it into `set_data`, so change it as text.
- **Read MSH separators** — never hardcode `|^~\&`. The repeating-segment rebuild in [samples/results_relay/results_relay.py](../samples/results_relay/results_relay.py) reads them from MSH-1/MSH-2 (its `_separators` helper) before joining components.
- **Read MSH separators** — never hardcode `|^~\&`. Better still, edit through `Message` so you never join delimiters at all: [samples/results_relay/results_relay.py](../samples/results_relay/results_relay.py) drops, remaps and renumbers OBX segments in place, keeping every field, escape and the OBX-to-OBR grouping.
- **Re-encode** — `msg.encode()` (or just pass `msg` to a `Send`, which encodes for you).

A non-HL7 inbound (`content_type` other than `hl7v2`) delivers a `RawMessage` instead — read `.raw` / `.text` / `.json()` / `.xml()` (the XML accessor is XXE-safe via defusedxml: DOCTYPE, external-entity, and billion-laughs payloads raise) and `Send` a built string. For cross-field business-rule checks beyond what schema validation catches, compose the primitives in `parsing/consistency.py`, as [samples/consistency/validated_adt.py](../samples/consistency/validated_adt.py) does (raise `ConsistencyError` → dead-letter, or `return None` → filter). The three validation tiers are laid out in [HL7-VALIDATION.md](HL7-VALIDATION.md).
Expand Down
43 changes: 36 additions & 7 deletions harness/_console_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from __future__ import annotations

import html
import logging
import traceback
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime
Expand Down Expand Up @@ -50,6 +52,8 @@
from messagefoundry.apiclient import ApiError, EngineClient, StepUpRequired
from messagefoundry.parsing import HL7PeekError, parse_tree

_log = logging.getLogger(__name__)

#: Shared "error red" for inline error text — the message-detail error, the auth dialogs'
#: error labels, and the heart's stopped state — so the palette can't drift across modules.
#: Carried over from the retired console theme so there is a single source of truth for this colour.
Expand Down Expand Up @@ -292,10 +296,30 @@ def load(self, message_id: str) -> None:
# an in-flight one (rapid row clicks / replay), so a stale result is dropped in _apply.
self._open_seq += 1
self._pending_id = message_id
# No Show body until this open lands: a press now would fetch the previous message's body.
self._show_body.setEnabled(False)
# Nothing is open until this open lands. The previous message leaves the screen now, and
# Show body or Replay pressed meanwhile would act on it, so both go too (BACKLOG #5848).
self._reset("Opening the message...")
open_seq = self._open_seq
self._runner.submit(lambda: self._fetch(message_id, open_seq), on_done=self._apply)
self._runner.submit(
lambda: self._fetch(message_id, open_seq),
on_done=self._apply,
on_error=lambda exc: self._open_raised(message_id, open_seq, exc),
)

def _open_raised(self, message_id: str, open_seq: int, exc: BaseException) -> None:
"""The open raised something other than ApiError. The client wraps transport errors in
ApiError, so this is a contract break, such as a closed client or a decode bug: log it and
take _apply's error path, which drops it if a newer open superseded it. Its text can quote
message fields (a decode error names its input), so no level logs the text: WARNING carries
the type name, and DEBUG the traceback's frames without the message."""
_log.warning("message detail open raised %s", type(exc).__name__)
_log.debug(
"message detail open raised %s at:\n%s",
type(exc).__name__,
"".join(traceback.format_tb(exc.__traceback__)),
)
error = f"the message could not be opened: {type(exc).__name__}"
self._apply(_DetailSnapshot(message_id, open_seq, None, error))

def stop(self) -> None:
"""Stop the background runner (call on window close) so a late result can't touch dead widgets."""
Expand Down Expand Up @@ -409,14 +433,19 @@ def _apply_body(self, snap: _BodySnapshot) -> None:
self._raw.setPlainText(snap.raw.replace("\r", "\n"))

def _on_replay(self) -> None:
if self._message_id is None:
return
# Read once: replay() can open a step-up prompt whose nested event loop runs a load() or
# clear(). That newer selection wins, so the refresh below runs only if none did.
message_id = self._message_id
if message_id is None:
return # nothing open, or a newer load() is still in flight
open_seq = self._open_seq
try:
self._client.replay(self._message_id)
self._client.replay(message_id)
except ApiError as exc:
self.error.emit(str(exc))
return
self.load(self._message_id) # refresh detail (status/events updated)
if open_seq == self._open_seq:
self.load(message_id) # refresh detail (status/events updated)
self.changed.emit()


Expand Down
7 changes: 5 additions & 2 deletions harness/acceptance/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

_log = logging.getLogger(__name__)

#: Default listener ports referenced by section A5 (informational bindability check).
_DEFAULT_PORTS: dict[str, int] = {"MLLP": 2575, "DICOM": 11112, "API": 8765}
#: Fixed reference ports for section A5 (informational bindability check), one entry per listener
#: the A5 row names (BACKLOG #5849). Each is a stock default, not what a given deployment binds,
#: which depends on its config and --env. TCP is the default of ``IB_Harness_TCP``, the raw-TCP
#: inbound in ``harness/config/tcp_x12.py`` (endpoint ``tcp_in``); a test pins the two together.
_DEFAULT_PORTS: dict[str, int] = {"MLLP": 2575, "DICOM": 11112, "TCP": 2580, "API": 8765}


class _ChainCut(Exception):
Expand Down
Loading
Loading