diff --git a/packages/desktop/openadapt_desktop/cli.py b/packages/desktop/openadapt_desktop/cli.py index 187ff56d42..1d659d01d5 100644 --- a/packages/desktop/openadapt_desktop/cli.py +++ b/packages/desktop/openadapt_desktop/cli.py @@ -1019,7 +1019,7 @@ def main(argv: list[str] | None = None) -> None: p.add_argument( "--admit-local", action="store_true", - help="Sign a MockMed/local-dev admission that production trust maps refuse", + help="Sign a local-dev admission that production trust maps refuse", ) # replay diff --git a/packages/desktop/openadapt_desktop/targets.py b/packages/desktop/openadapt_desktop/targets.py index 5560c219e3..228ce98ed4 100644 --- a/packages/desktop/openadapt_desktop/targets.py +++ b/packages/desktop/openadapt_desktop/targets.py @@ -281,7 +281,7 @@ def record_args(self, out_dir: Path, *, task: str = "") -> list[str]: if self.backend == "web" and not self.url: # Flow's interactive web recorder deliberately requires an exact # URL. Its separate demo-record command is the canonical bundled - # MockMed quickstart, so keep Desktop's blank-URL path useful + # bundled quickstart demo, so keep Desktop's blank-URL path useful # without inventing an implicit public URL. return [ "demo-record", diff --git a/packages/flow/openadapt_flow/__main__.py b/packages/flow/openadapt_flow/__main__.py index 195b1b4bc7..f9789035fd 100644 --- a/packages/flow/openadapt_flow/__main__.py +++ b/packages/flow/openadapt_flow/__main__.py @@ -6,7 +6,7 @@ - ``record`` — record a demonstration into the format ``compile`` consumes. With no ``--backend`` and no ``--url``, capture the desktop on this OS. ``--url`` without ``--backend`` still records the browser. -- ``demo-record`` — serve MockMed locally and record the canonical demo. +- ``demo-record`` — serve the bundled demo locally and record the canonical demo. - ``compile`` — compile a recording directory into a workflow bundle. - ``induce`` — induce a parameterized PROGRAM bundle from MULTIPLE recordings (multi-trace induction); refuses (nonzero exit) when intent is @@ -24,7 +24,7 @@ capabilities (each child a ``QualificationAdmissionEnvelope``). Not compose. ``certify`` / ``run`` execute the parent; ``replay`` refuses it. The launcher form is ``openadapt flow process``. -- ``replay`` — replay a bundle; serves the bundled MockMed demo app when no +- ``replay`` — replay a bundle; serves the bundled demo app when --demo-app is passed ``--url`` is given (with optional ``--drift`` to demonstrate healing). ``--worklist`` drives a program's loop over a CLI-supplied relation; effect verification and API actuation are wired from ``--config`` / flags. @@ -36,7 +36,7 @@ demonstration (induce + gate + validate the correction, promote only a verified revision), writing an updated bundle. Refuses bad fixes. - ``approve`` — mark a durably-paused run's pending escalation approved. -- ``bench`` — replay a bundle N times against MockMed and aggregate. +- ``bench`` — replay a bundle N times against the demo app and aggregate. - ``visualize`` — SEE what a demonstration compiled into: emit a program-graph view of a bundle or a composed parent (child bundles, --after DAG, effect-bound handoffs) as self-contained HTML, Mermaid, or the shared JSON @@ -282,7 +282,7 @@ def _resolve_record_capture_window( def _with_drift(url: str, drift: str | None) -> str: - """Append a ``?drift=...`` query to a MockMed base URL.""" + """Append a ``?drift=...`` query to a demo app base URL.""" if not drift: return url return f"{url.rstrip('/')}/?drift={drift}" @@ -1109,7 +1109,7 @@ def _undo_run_target_problem(args: argparse.Namespace, workflow) -> Optional[str Resolves ``--config`` and the backend flags the way replay does. A web target with no URL and no attached browser would start the bundled - MockMed demo, so the undo would act on the demo and use up its approval. + bundled demo, so the undo would act on the demo and use up its approval. """ from openadapt_flow.backends.factory import _normalize_kind @@ -1233,8 +1233,8 @@ def _replay_desktop( ) -> int: """Replay against a non-browser native/remote backend built by the factory. - No Playwright browser, no bundled MockMed, no session video — those are - web-only. ``--drift`` (a MockMed teaching aid) is refused. The backend is + No Playwright browser, no bundled demo app, no session video — those are + web-only. ``--drift`` (a demo teaching aid) is refused. The backend is built from the resolved ``BackendConfig`` and the shared replayer wiring runs exactly as it does for the web path. With ``rollback_plan``, a GUI compensation starts from the run's start screen (the halt cleanup and its @@ -1246,7 +1246,7 @@ def _replay_desktop( if args.drift: raise SystemExit( - "--drift only demonstrates healing on the bundled MockMed web demo; " + "--drift only demonstrates healing on the bundled web demo; " f"it does not apply to the {backend_cfg.kind!r} backend." ) try: @@ -1268,7 +1268,7 @@ def _replay_desktop( effect_verifier=effect_verifier, api_actuator=api_actuator, durable=durable, - # No MockMed drift here, so the deterministic structural rung is + # No demo drift here, so the deterministic structural rung is # preferred exactly as in a non-drift web replay. use_structural=True, pixel_verify_enabled=pixel_verify_enabled, @@ -1984,7 +1984,7 @@ def _cmd_record_desktop(args: argparse.Namespace, backend: str) -> int: def _cmd_demo_record(args: argparse.Namespace) -> int: from openadapt_flow.demo_driver import record_triage_demo - from openadapt_flow.mockmed.server import serve + from openadapt_flow.tutorial import serve_demo_app as serve url, stop = serve(port=0) try: @@ -3115,7 +3115,7 @@ def _cmd_replay(args: argparse.Namespace) -> int: ) if args.drift and not demo_app: raise SystemExit( - "--drift only applies to the bundled MockMed demo app (--demo-app); " + "--drift only applies to the bundled demo app (--demo-app); " "drift your own app for real." ) if ( @@ -3125,7 +3125,7 @@ def _cmd_replay(args: argparse.Namespace) -> int: ): raise SystemExit( "replay needs a target: pass --url, set backend.url in --config, or " - "pass --demo-app to replay against the bundled MockMed demo app." + "pass --demo-app to replay against the bundled demo app." ) refuse_unqualified_skill(bundle, target_url=url) @@ -3137,7 +3137,7 @@ def run_on_page(page, *, entry_url: Optional[str]): # The browser backend is built through the same factory as the # desktop backends; the grounding / identity / deployment wiring and # the run are shared (see _build_and_run_replayer). ``--drift`` (a - # MockMed teaching aid) forces the visual floor so the healing ladder + # demo teaching aid) forces the visual floor so the healing ladder # is exercised instead of the structural rung resolving it. backend = build_backend(backend_cfg, page=page) held_backend.append(backend) @@ -3215,12 +3215,12 @@ def run_on_page(page, *, entry_url: Optional[str]): stop = None if url is None and demo_app: - from openadapt_flow.mockmed.server import serve + from openadapt_flow.tutorial import serve_demo_app as serve url, stop = serve(port=0) url = _with_drift(url, args.drift) drift_note = f" (drift: {args.drift})" if args.drift else "" - print(f"--demo-app: replaying against bundled MockMed{drift_note}") + print(f"--demo-app: replaying against bundled demo app{drift_note}") video_dir = getattr(args, "record_video", None) from playwright.sync_api import sync_playwright @@ -4048,7 +4048,7 @@ def _cmd_run(args: argparse.Namespace) -> int: ``--dry-run`` / ``--explain`` print the coverage report and stop before execution. Once admitted, it delegates to the shared executor (the same backend / effect / actuation / durable runtime as ``replay``), with - ``--drift`` (a MockMed-only teaching aid) forced off. + ``--drift`` (a demo-only teaching aid) forced off. """ from openadapt_flow.composition import is_composition_artifact from openadapt_flow.execution_profiles import ( @@ -5919,8 +5919,8 @@ def _cmd_bench(args: argparse.Namespace) -> int: from openadapt_flow.bench import run_bench from openadapt_flow.emit.skill import bundle_surface from openadapt_flow.ir import Workflow - from openadapt_flow.mockmed.server import serve from openadapt_flow.report import render_bench_report + from openadapt_flow.tutorial import serve_demo_app as serve try: surface = bundle_surface(Workflow.load(Path(args.bundle))) @@ -5930,7 +5930,7 @@ def _cmd_bench(args: argparse.Namespace) -> int: from openadapt_flow.cli_hints import command print( - "BENCH REFUSED: bench replays a bundle against the bundled MockMed " + "BENCH REFUSED: bench replays a bundle against the bundled demo " f"web app, and this bundle was recorded on {surface!r}. Measure it " "on its own app with repeated " f"`{command('run BUNDLE --config deploy.yaml')}`. Nothing was executed." @@ -8792,7 +8792,7 @@ def _add_backend_flags(p: argparse.ArgumentParser) -> None: default=None, metavar="APP", help=( - "Owner application for --backend macos (e.g. TextEdit). During " + "Owner application for --backend macos (e.g. MyApp). During " "record this scopes Capture to that local app window; during " "replay/run it overrides backend.macos_app." ), @@ -9663,7 +9663,7 @@ def build_parser() -> argparse.ArgumentParser: p = sub.add_parser( "demo-record", - help="Serve MockMed and record the canonical triage demo", + help="Serve the bundled demo app and record the canonical demo", allow_abbrev=False, ) p.add_argument("--out", required=True, help="Recording output directory") @@ -9673,7 +9673,7 @@ def build_parser() -> argparse.ArgumentParser: help="Note text typed during the demo (recorded as a parameter)", ) p.add_argument("--param-name", default="note", help="Parameter name for the note") - p.add_argument("--drift", default=None, help="Comma-separated MockMed drift modes") + p.add_argument("--drift", default=None, help="Comma-separated demo drift modes") p.add_argument("--headed", action="store_true", help="Run the browser headed") p.add_argument( "--record-video", @@ -10243,7 +10243,7 @@ def build_parser() -> argparse.ArgumentParser: "--demo-app", action="store_true", help=( - "Serve the bundled MockMed demo app and replay against it (for a " + "Serve the bundled demo app and replay against it (for a " "bundle recorded on it, such as the tutorial's)" ), ) @@ -10251,7 +10251,7 @@ def build_parser() -> argparse.ArgumentParser: "--drift", default=None, help=( - "Comma-separated MockMed drift modes (theme,move,rename,modal) " + "Comma-separated demo drift modes (theme,move,rename,modal) " "to demonstrate bounded drift resolution; only with --demo-app" ), ) @@ -11040,7 +11040,7 @@ def build_parser() -> argparse.ArgumentParser: p = sub.add_parser( "bench", - help="Replay a bundle N times against MockMed and aggregate", + help="Replay a bundle N times against the bundled demo and aggregate", allow_abbrev=False, ) p.add_argument("bundle", help="Workflow bundle directory") @@ -11048,7 +11048,7 @@ def build_parser() -> argparse.ArgumentParser: p.add_argument( "--drift", default=None, - help="Comma-separated drift modes forwarded to the MockMed URL", + help="Comma-separated drift modes forwarded to the demo URL", ) p.add_argument("--run-root", required=True, help="Directory for per-iteration runs") p.add_argument( @@ -11064,7 +11064,7 @@ def build_parser() -> argparse.ArgumentParser: "benchmark", help=( "Benchmark compiled replay vs. a Claude computer-use agent on " - "the MockMed triage task (agent arm needs an Anthropic API key " + "the bundled demo task (agent arm needs an Anthropic API key " "and costs real money)" ), allow_abbrev=False, @@ -11576,7 +11576,7 @@ def build_parser() -> argparse.ArgumentParser: q.add_argument( "--admit-local", action="store_true", - help="Sign a MockMed/local-dev admission that production trust maps refuse", + help="Sign a local-dev admission that production trust maps refuse", ) q.add_argument("--replace", action="store_true", help="Replace an existing project") q.add_argument("--out", default=None, help="Write the accepted proposal JSON") @@ -11619,7 +11619,7 @@ def build_parser() -> argparse.ArgumentParser: q.add_argument( "--admit-local", action="store_true", - help="Sign a MockMed/local-dev admission that production trust maps refuse", + help="Sign a local-dev admission that production trust maps refuse", ) q.add_argument( "--proposer", @@ -13055,7 +13055,7 @@ def _repair_store_flag(rp: argparse.ArgumentParser) -> None: p.add_argument( "--seed-mockmed", action="store_true", - help="Write the synthetic MockMed ok and banner-lie admissions", + help="Write the synthetic demo ok and banner-lie admissions", ) p.add_argument( "--config", @@ -13084,7 +13084,7 @@ def _repair_store_flag(rp: argparse.ArgumentParser) -> None: help=( "Reward contract bundle directory (contract.json, " "required_effects.json, forbidden_effects.json, oracle.json, " - "optional certificate.json). Defaults to the seeded MockMed " + "optional certificate.json). Defaults to the seeded demo " "tier-2 bundle when --seed-mockmed is given." ), ) @@ -13113,7 +13113,7 @@ def _repair_store_flag(rp: argparse.ArgumentParser) -> None: "--seed-mockmed", action="store_true", help=( - "Write the synthetic MockMed reward bundles (tier-2 read-only " + "Write the synthetic demo reward bundles (tier-2 read-only " "SQLite oracle with a calibrated synthetic certificate; tier-0 " "screen dump)" ), @@ -13406,9 +13406,9 @@ def _cmd_serve_execute(args: argparse.Namespace) -> int: seeded = () if args.seed_mockmed: - from openadapt_flow.mockmed.execute_seed import demo_admissions + from openadapt_flow.tutorial import demo_execute_admissions - seeded = demo_admissions() + seeded = demo_execute_admissions() return run_serve_execute( data_dir=Path(args.data_dir) if args.data_dir else None, host=args.host, @@ -13439,16 +13439,20 @@ def _cmd_serve_reward(args: argparse.Namespace) -> int: data_dir = Path(args.data_dir) if args.data_dir else default_data_dir() contract = args.contract seeded_paths: dict[str, Path] = {} + seeded_store: Optional[tuple[Path, Path]] = None if args.seed_mockmed: from openadapt_flow.execute.keys import ( fingerprint_of, load_or_create_private_key, ) - from openadapt_flow.reward.seed import seed_mockmed + from openadapt_flow.tutorial import seed_demo_reward key = load_or_create_private_key(data_dir) issuer_key_id = "self_signed:" + fingerprint_of(key.public_key()) - seeded_paths = seed_mockmed(data_dir, key, issuer_key_id) + seeded_paths, store_db, store_screen = seed_demo_reward( + data_dir, key, issuer_key_id + ) + seeded_store = (store_db, store_screen) if contract is None: contract = str(seeded_paths["tier2"]) if contract is None: @@ -13470,9 +13474,9 @@ def _cmd_serve_reward(args: argparse.Namespace) -> int: print(f" {REWARD_NOTICE}") for label, path in seeded_paths.items(): print(f" seeded {label:<6} {path}") - if seeded_paths: - print(f" store {data_dir / 'mockmed' / 'records.db'}") - print(f" screen {data_dir / 'mockmed' / 'screen.json'}") + if seeded_store is not None: + print(f" store {seeded_store[0]}") + print(f" screen {seeded_store[1]}") print( " Register each episode with POST /v1/episodes BEFORE the " "rollout runs. A required effect asserts a change, so the worker " diff --git a/packages/flow/openadapt_flow/backend.py b/packages/flow/openadapt_flow/backend.py index 49b16730ef..6f8a9a6312 100644 --- a/packages/flow/openadapt_flow/backend.py +++ b/packages/flow/openadapt_flow/backend.py @@ -159,7 +159,7 @@ class SystemOfRecordBackend(Protocol): write actually reached the system of record — a partial save, a phantom optimistic-UI success, a duplicate submission all look identical on screen (``docs/LIMITS.md`` "5 of 7 write faults silent"). A backend that can read - the app's authoritative store (a JSON ``/api/db`` endpoint, an EMR's own + the app's authoritative store (a JSON records endpoint, an app's own API) exposes it here; the recorder snapshots it before and after each event (``sor_before`` / ``sor_after`` on the event, exactly as it already records ``url_before`` / ``url_after``), and the compiler's effect miner diff --git a/packages/flow/openadapt_flow/backends/factory.py b/packages/flow/openadapt_flow/backends/factory.py index 900c6d648b..c3a81ce86d 100644 --- a/packages/flow/openadapt_flow/backends/factory.py +++ b/packages/flow/openadapt_flow/backends/factory.py @@ -114,7 +114,7 @@ def build_backend( if not cfg.macos_app: raise ValueError( "backend.kind 'macos' requires backend.macos_app " - "(e.g. --macos-app TextEdit)" + "(e.g. --macos-app MyApp)" ) from openadapt_flow.backends.macos_backend import MacOSBackend diff --git a/packages/flow/openadapt_flow/backends/parallels_vm.py b/packages/flow/openadapt_flow/backends/parallels_vm.py index c9da4a6525..c3371d5fb4 100644 --- a/packages/flow/openadapt_flow/backends/parallels_vm.py +++ b/packages/flow/openadapt_flow/backends/parallels_vm.py @@ -400,7 +400,7 @@ def snapshot(self, name: str, description: str = "") -> str: """Create a snapshot and return its id. Snapshots are the drift-reset and warm-boot mechanism: every run - reverts to a clean ``opendental-ready`` state in seconds. + reverts to a clean ``app-ready`` state in seconds. """ args = ["snapshot", self.uuid, "-n", name] if description: diff --git a/packages/flow/openadapt_flow/backends/playwright_backend.py b/packages/flow/openadapt_flow/backends/playwright_backend.py index b14de886ee..a7715308da 100644 --- a/packages/flow/openadapt_flow/backends/playwright_backend.py +++ b/packages/flow/openadapt_flow/backends/playwright_backend.py @@ -1040,7 +1040,7 @@ class _FramePoint: # Page-structure identity of a FORM FIELD that sits in no record row. # -# A data-entry form (OpenEMR's new-patient page, most CRUD screens) lays its +# A data-entry form (most CRUD screens) lays its # fields out in label/control groups (``.form-group.row`` and the like), not # table rows, so the row rule above abstains and identity used to fall to the # OCR band read across the field's visual row. This mirrors that band in the diff --git a/packages/flow/openadapt_flow/backends/win_agent/server.py b/packages/flow/openadapt_flow/backends/win_agent/server.py index 5749a9ceaa..491853072c 100644 --- a/packages/flow/openadapt_flow/backends/win_agent/server.py +++ b/packages/flow/openadapt_flow/backends/win_agent/server.py @@ -2129,7 +2129,7 @@ def _window_guard(user32: Any, hwnd: int, point: tuple[int, int]) -> None: """Refuse a native action that the target's window could not take. Checked with Win32 because UI Automation's own hit test passes through - windows that are still loading (seen live with Notepad over the app): + windows that are still loading (seen live with an auxiliary window over the app): the window under the point must belong to the target's top-level window, and that window and the target's must be enabled. A window a modal dialog has disabled would drop the action without a word. diff --git a/packages/flow/openadapt_flow/compiler/compile.py b/packages/flow/openadapt_flow/compiler/compile.py index 38f61d2bc3..0360a110d7 100644 --- a/packages/flow/openadapt_flow/compiler/compile.py +++ b/packages/flow/openadapt_flow/compiler/compile.py @@ -675,7 +675,7 @@ def _selection_readback_region(png: bytes, target_region: Region) -> Region: # Tolerance for REGION_STABLE postconditions. The structural (edge-based) # phash distance is ~0 for identical screens, <= 12 for cosmetic drift # (theme palettes, relocated buttons elsewhere in the region) and >= 30 for -# semantic drift (e.g. a blocking modal), measured on MockMed; 16 splits +# semantic drift (e.g. a blocking modal), measured on synthetic fixtures; 16 splits # those populations with margin. REGION_STABLE_TOLERANCE = 16 @@ -722,7 +722,7 @@ def _selection_readback_region(png: bytes, target_region: Region) -> Region: # openadapt_flow.volatility): clock times, dates near the recording date, # digit/punctuation-dominated fragments, and low-entropy noise all name a # moment or a count, not an invariant screen state, and cannot survive -# replay against live data. Observed on OpenEMR: a stray ':01' clock-minute +# replay against live data. Observed on live apps: a stray ':01' clock-minute # fragment was mined and false-halted every later replay. Dates FAR from # the recording date (a DOB in an identity banner) are deliberately kept — # they are identity data, not chronology. @@ -1246,7 +1246,7 @@ def _param_text_in_region( and no single fragment need carry it. The reverse containment ``_contains_excluded`` also accepts (excluded value CONTAINS the text) must NOT disqualify a region: an application's own literal word is frequently a - substring of a longer demonstrated value (MockMed's ``Triage`` inside the + substring of a longer demonstrated value (a short option label inside the note ``E2E triage booking three months``), and treating that as contamination would disarm perfectly stable regions. @@ -2790,7 +2790,7 @@ def _compile_recording( (``compiler.effect_mining``). When True, each step gets candidate typed ``Effect``s auto-derived from what the demonstration observed: a real ``record_written`` / ``field_equals`` from a captured - ``/api/db``-style SoR delta, a flagged placeholder for a + REST SoR delta, a flagged placeholder for a consequential step whose binding is app-specific (not derivable), or nothing (with an honest "no verifiable effect derivable" log). Default False keeps the bundle byte-identical to before; even when diff --git a/packages/flow/openadapt_flow/compiler/effect_mining.py b/packages/flow/openadapt_flow/compiler/effect_mining.py index 8bf6117e0f..98848b3dab 100644 --- a/packages/flow/openadapt_flow/compiler/effect_mining.py +++ b/packages/flow/openadapt_flow/compiler/effect_mining.py @@ -14,7 +14,7 @@ in ``docs/design/WORKFLOW_PROGRAM_IR.md`` §7: - **Derivable now** — when the demonstration actually OBSERVED the system of - record (a ``/api/db``-style JSON snapshot captured before and after a step, + record (a REST JSON snapshot captured before and after a step, or a structured DOM field map), the concrete binding *is* in the recording: which record appeared, which field took the typed value, and (if present) the idempotency key. We mine those into real, machine-checkable ``Effect``s. diff --git a/packages/flow/openadapt_flow/compiler/fixup_passes.py b/packages/flow/openadapt_flow/compiler/fixup_passes.py index 8e165ea58c..0a0906a788 100644 --- a/packages/flow/openadapt_flow/compiler/fixup_passes.py +++ b/packages/flow/openadapt_flow/compiler/fixup_passes.py @@ -4,7 +4,7 @@ asserts nothing, and a strict certification policy (``clinical-write``) then refuses the bundle. These passes replace such a gesture with an equivalent one that carries its own check, using only the recording's own frames. They used -to live in one script per workflow (``scripts/openemr_qualification.py``); +to live in one script per workflow; they now run in every compile. Each pass is evidence-gated and records every change it makes, so the result diff --git a/packages/flow/openadapt_flow/compiler/local_edit.py b/packages/flow/openadapt_flow/compiler/local_edit.py index a8ffe48bb3..fc478c1d24 100644 --- a/packages/flow/openadapt_flow/compiler/local_edit.py +++ b/packages/flow/openadapt_flow/compiler/local_edit.py @@ -324,7 +324,7 @@ def _click_edit(step: Step, steps: Sequence[Step], k: int) -> Optional[LocalEdit role = (target.role or "").lower() label = _label(step) or "" if role in {"button", "link"} and _DISMISS_LABEL.match(label): - # An informational dialog's dismiss (MockMed's What's New "Continue + # An informational dialog's dismiss (e.g. a What's New "Continue # to tasks"): the page stays, and the control is gone afterwards. return LocalEdit( step.id, diff --git a/packages/flow/openadapt_flow/demo_driver.py b/packages/flow/openadapt_flow/demo_driver.py index 5ca0e8be37..e8b0dec53b 100644 --- a/packages/flow/openadapt_flow/demo_driver.py +++ b/packages/flow/openadapt_flow/demo_driver.py @@ -6,8 +6,8 @@ be. Replay never uses selectors. ``record_triage_demo`` records the MockMed triage save that ``openadapt-flow -demo-record`` uses. The MockLoan disbursement recorder is a benchmark fixture -in the source checkout (``benchmark/harness/mockloan/demo.py``). +demo-record`` uses. The lending disbursement recorder is a benchmark fixture +in the source checkout. """ from __future__ import annotations diff --git a/packages/flow/openadapt_flow/deployment.py b/packages/flow/openadapt_flow/deployment.py index 79bb375e8f..38451e7cb2 100644 --- a/packages/flow/openadapt_flow/deployment.py +++ b/packages/flow/openadapt_flow/deployment.py @@ -112,7 +112,7 @@ class BackendConfig(BaseModel): deployment_surface: Optional[DeclaredSurface] = None #: The GUI URL to drive (the app under automation). None => the caller's - #: own default (e.g. ``replay`` serves the bundled MockMed demo). + #: own default (e.g. ``replay --demo-app`` serves the bundled demo). #: ``web`` only. url: Optional[str] = None #: Run the browser headed (visible). Default headless. ``web`` only. @@ -144,7 +144,7 @@ class BackendConfig(BaseModel): agent_tls_pin: Optional[str] = None # -- native macOS -------------------------------------------------------- - #: Owner application name/substring (e.g. ``"TextEdit"``). REQUIRED for + #: Owner application name/substring (e.g. ``"MyApp"``). REQUIRED for #: ``kind: macos``. macos_app: Optional[str] = None #: Window-title substring. The backend refuses ambiguous matches rather @@ -1119,7 +1119,7 @@ class RollbackSection(BaseModel): #: Many record systems forbid deleting a chart for audit or legal reasons: #: prefer a ``void`` compensation there. allow_delete: bool = False - #: The app's versioned bookkeeping profile, by name (``openemr``; + #: The app's versioned bookkeeping profile, by name (e.g. an app profile; #: ``openadapt_flow.app_profiles``), shared with the verifier's frame and #: the RL grader: which tables move on their own and how (append-only, #: session state, named columns). Never patient data. Applies to diff --git a/packages/flow/openadapt_flow/execution_profiles.py b/packages/flow/openadapt_flow/execution_profiles.py index ceeb706779..32c3342f89 100644 --- a/packages/flow/openadapt_flow/execution_profiles.py +++ b/packages/flow/openadapt_flow/execution_profiles.py @@ -2660,7 +2660,7 @@ def _external_network_call_state( if report.external_network_calls == "observed" or report.model_calls > 0: return "observed" # A browser run whose origin and entry URL are both on this computer (the - # bundled tutorial serves MockMed on 127.0.0.1) sent its own traffic only + # bundled tutorial serves the demo app on 127.0.0.1) sent its own traffic only # to this machine. Any non-loopback URL, a web run with no recorded origin, # and every remote-display target still count as observed egress. target_urls = [ diff --git a/packages/flow/openadapt_flow/fault_gate.py b/packages/flow/openadapt_flow/fault_gate.py index 37a9a2df54..0cfe058f28 100644 --- a/packages/flow/openadapt_flow/fault_gate.py +++ b/packages/flow/openadapt_flow/fault_gate.py @@ -825,7 +825,7 @@ class SqliteCopy: SQL (or inserts ``target``). The check's read runs against the copy. The database's other tables are outside the slice. ``subject_field`` is - the column they refer to the saved record by (OpenEMR's ``pid``). Unset, + the column they refer to the saved record by (e.g. a foreign-key id). Unset, it is the one column the slice's table shares with other tables whose name ends in ``id`` (not the key). """ diff --git a/packages/flow/openadapt_flow/generate/demo_analysis.py b/packages/flow/openadapt_flow/generate/demo_analysis.py index cbf69ba1f1..57e69e583c 100644 --- a/packages/flow/openadapt_flow/generate/demo_analysis.py +++ b/packages/flow/openadapt_flow/generate/demo_analysis.py @@ -786,7 +786,7 @@ def _date_part( values: Sequence[Optional[str]], demos: Sequence["Demo"] ) -> Optional[str]: """Is the column the year, month, ISO week or day of one date value the - task gives, in every row? (Redmine stores a time entry's ``tyear``, + task gives, in every row? (Some apps store a derived year column, ``tmonth`` and ``tweek``.) The app computes it, so it isn't pinned.""" if len({v for v in values}) < 2: diff --git a/packages/flow/openadapt_flow/generate/verify_contract.py b/packages/flow/openadapt_flow/generate/verify_contract.py index af1b4d4f50..6c4d7ab9e9 100644 --- a/packages/flow/openadapt_flow/generate/verify_contract.py +++ b/packages/flow/openadapt_flow/generate/verify_contract.py @@ -310,7 +310,7 @@ class ChildGroup: #: the row is still expected, with this value empty. co_owners: list[str] = field(default_factory=list) #: The app adds this row with an empty value when the task leaves the - #: parameter out (Redmine's custom field values): expected then too. + #: parameter out (such as custom field values): expected then too. empty_when_null: bool = False #: The parameter whose value the rows hold (``children`` may hold a #: second group for it: a call's lead is its parent and an attendee). @@ -653,7 +653,7 @@ def _pick( """The best location. Among tied ones: the one whose column is named like the parameter (``stage``, not ``last_stage``); else drop a column that is only a copy of another tied one, lower-cased or digits only, in - every row of its table (EspoCRM's ``email_address.lower``, + every row of its table (such as a normalized lowercase email column, ``phone_number.numeric``).""" loc, tied = best(found) @@ -1370,7 +1370,7 @@ def _touched_rows( def _version_column(schema: Schema, plan: KindPlan) -> Optional[dict[str, Any]]: """A whole-number column of the main record that went up by exactly one - in every update demonstration (Redmine's ``lock_version``).""" + in every update demonstration (such as an optimistic ``lock_version``).""" t = schema.tables[plan.anchor] if len(t.primary_key) != 1: @@ -1411,8 +1411,8 @@ def _audit_source( ) -> Optional[dict[str, Any]]: """A table that gained, in every update demonstration, a row naming the main record (a column holding its key) and the acting user (a column - holding the actor's id): the app's own audit trail of saves (EspoCRM's - ``action_history_record``, Dolibarr's agenda events).""" + holding the actor's id): the app's own audit trail of saves (such as + audit history or agenda event tables).""" t = schema.tables[plan.anchor] if len(t.primary_key) != 1 or not actor_values: diff --git a/packages/flow/openadapt_flow/jit/authority.py b/packages/flow/openadapt_flow/jit/authority.py index 3f3bdb79a0..8f01113ff8 100644 --- a/packages/flow/openadapt_flow/jit/authority.py +++ b/packages/flow/openadapt_flow/jit/authority.py @@ -462,7 +462,7 @@ class AdmissionPolicy(BaseModel): signed_at: str = Field(min_length=10, max_length=64) expires_at: str = Field(min_length=10, max_length=64) #: ``host`` or ``host:port`` of a web app's origin, or a desktop or - #: remote app's ``://`` (``macos://textedit``). + #: remote app's ``://`` (``macos://example-app``). allowed_hosts: tuple[str, ...] = Field(min_length=1) #: Step actions (``openadapt_flow.ir.ActionKind`` values). allowed_actions: tuple[str, ...] = Field(min_length=1) @@ -624,7 +624,7 @@ def scope_problems( allowed = {h.lower() for h in policy.allowed_hosts if "://" not in h} else: # A desktop or remote app is named with its kind - # (``macos://textedit``), so a web host entry never covers it. + # (``macos://example-app``), so a web host entry never covers it. host = target_origin.lower() allowed = {h.lower() for h in policy.allowed_hosts if "://" in h} if host not in allowed: diff --git a/packages/flow/openadapt_flow/jit/compile_agent.py b/packages/flow/openadapt_flow/jit/compile_agent.py index d89d8a8be0..94317053fd 100644 --- a/packages/flow/openadapt_flow/jit/compile_agent.py +++ b/packages/flow/openadapt_flow/jit/compile_agent.py @@ -364,7 +364,7 @@ def origin(self) -> str: """``://``, from :func:`~openadapt_flow.surface_selection.surface_target_origin`. A canary admits the program on this origin only. An admission policy - names it in ``allowed_hosts`` the same way (``macos://textedit``); a + names it in ``allowed_hosts`` the same way (``macos://example-app``); a bare host there names a web app only.""" from openadapt_flow.surface_selection import surface_target_origin diff --git a/packages/flow/openadapt_flow/jit/recorded.py b/packages/flow/openadapt_flow/jit/recorded.py index 0f7546b9ab..976f322878 100644 --- a/packages/flow/openadapt_flow/jit/recorded.py +++ b/packages/flow/openadapt_flow/jit/recorded.py @@ -3,7 +3,7 @@ A trajectory file holds the native actions an agent sent in one run, in its own format, with the task id and inputs that run had:: - {"dialect": "anthropic", "task_id": "mockmed.add_note", + {"dialect": "anthropic", "task_id": "demo.add_note", "inputs": {"note": "..."}, "actions": [{"action": "screenshot"}, ...]} :class:`RecordedTrajectoryAgent` sends those actions through the capture diff --git a/packages/flow/openadapt_flow/jit/signature.py b/packages/flow/openadapt_flow/jit/signature.py index fb35824efd..b360e25aea 100644 --- a/packages/flow/openadapt_flow/jit/signature.py +++ b/packages/flow/openadapt_flow/jit/signature.py @@ -69,7 +69,7 @@ class TaskSignature: """What a cached program is for. Args: - task_id: A stable id the caller picks, such as ``mockmed.add_note``. + task_id: A stable id the caller picks, such as ``demo.add_note``. instruction: The task as told to the computer-use agent. ``{name}`` placeholders are filled from the run's parameters. params: Parameter name to type (``"string"``, ``"integer"``, diff --git a/packages/flow/openadapt_flow/reward/seed.py b/packages/flow/openadapt_flow/mockmed/reward_seed.py similarity index 100% rename from packages/flow/openadapt_flow/reward/seed.py rename to packages/flow/openadapt_flow/mockmed/reward_seed.py diff --git a/packages/flow/openadapt_flow/operator_profile.py b/packages/flow/openadapt_flow/operator_profile.py index bfa150f6f3..512d4ec3a3 100644 --- a/packages/flow/openadapt_flow/operator_profile.py +++ b/packages/flow/openadapt_flow/operator_profile.py @@ -76,7 +76,7 @@ def _clean_name(value: Any) -> Optional[str]: def app_name(report: dict[str, Any]) -> Optional[str]: - """The report's app name; otherwise the program name's first word (``openemr``).""" + """The report's app name; otherwise the program name's first word.""" for key in ("app", "app_name", "application_name"): name = _clean_name(report.get(key)) if name: diff --git a/packages/flow/openadapt_flow/policy_packs.py b/packages/flow/openadapt_flow/policy_packs.py index 635f7d4165..67a5409a75 100644 --- a/packages/flow/openadapt_flow/policy_packs.py +++ b/packages/flow/openadapt_flow/policy_packs.py @@ -38,7 +38,7 @@ class PolicyPack(BaseModel): allow_local_dev_signer=True, require_identity_on_writes=True, require_system_of_record_effect=True, - summary="Local and MockMed. Local-dev admission only. Same identity and effect pins.", + summary="Local and demo apps. Local-dev admission only. Same identity and effect pins.", ) CLOUD_PACK: Final[PolicyPack] = PolicyPack( diff --git a/packages/flow/openadapt_flow/qualification_dev_signer.py b/packages/flow/openadapt_flow/qualification_dev_signer.py index ab4b2441b4..eb407c82db 100644 --- a/packages/flow/openadapt_flow/qualification_dev_signer.py +++ b/packages/flow/openadapt_flow/qualification_dev_signer.py @@ -1,6 +1,6 @@ """Local-dev qualification signer that cannot enter a production trust map. -Quickstart and MockMed can sign a local pin-confirmation admission with this +Quickstart and local demos can sign a local pin-confirmation admission with this key. The key, its issuer workflow, and its ref prefix are public and intentional. Production verification refuses them. Loading a production signer registry that contains this public key fails closed. diff --git a/packages/flow/openadapt_flow/qualification_proposal.py b/packages/flow/openadapt_flow/qualification_proposal.py index d934fd22d8..3a13f79ad4 100644 --- a/packages/flow/openadapt_flow/qualification_proposal.py +++ b/packages/flow/openadapt_flow/qualification_proposal.py @@ -7,7 +7,7 @@ HALTs. Guessing is not a path. The accepted project is the existing -:class:`~openadapt_flow.qualification.QualificationProject`. Local MockMed +:class:`~openadapt_flow.qualification.QualificationProject`. Local demo quickstart can then sign a local-dev admission that production trust maps refuse. """ diff --git a/packages/flow/openadapt_flow/qualification_web_session.py b/packages/flow/openadapt_flow/qualification_web_session.py index bdd3ad9763..cd2b4a92f7 100644 --- a/packages/flow/openadapt_flow/qualification_web_session.py +++ b/packages/flow/openadapt_flow/qualification_web_session.py @@ -1,6 +1,6 @@ """Identify a web application by its address and signed-in session. -Real systems such as OpenEMR or openIMIS carry none of OpenAdapt's +Real production web systems carry none of OpenAdapt's ``openadapt-*`` ```` markers, so the backend's built-in observer cannot label them. This observer identifies them by what any web application has: diff --git a/packages/flow/openadapt_flow/qualify/config.py b/packages/flow/openadapt_flow/qualify/config.py index d79e4cd736..9be1f8113b 100644 --- a/packages/flow/openadapt_flow/qualify/config.py +++ b/packages/flow/openadapt_flow/qualify/config.py @@ -359,7 +359,7 @@ class RecordConfig(BaseModel): match: list[str] = Field(default_factory=list) fields: dict[str, FieldValue] = Field(default_factory=dict) #: The record field that must be unique per write (idempotency key), or a - #: list of fields that are unique together, such as OpenEMR's + #: list of fields that are unique together, such as a composite key #: ``[lname, fname, DOB]``. A list (even of one field) is a composite key: #: it also counts records that were already there, so the verifier's read #: must cover the key (see :func:`composite_key_read_problems`). diff --git a/packages/flow/openadapt_flow/record_check_binding.py b/packages/flow/openadapt_flow/record_check_binding.py index c35d1d9692..43a24b1c30 100644 --- a/packages/flow/openadapt_flow/record_check_binding.py +++ b/packages/flow/openadapt_flow/record_check_binding.py @@ -45,7 +45,7 @@ The binding file schema (JSON or YAML):: schema: openadapt.record-check-binding/v1 - workflow_name: openimis-claim-intake + workflow_name: example-record-intake source_content_digest: steps: - step: step_012 diff --git a/packages/flow/openadapt_flow/record_check_identity.py b/packages/flow/openadapt_flow/record_check_identity.py index a8aa87b98b..b75c224fcb 100644 --- a/packages/flow/openadapt_flow/record_check_identity.py +++ b/packages/flow/openadapt_flow/record_check_identity.py @@ -1,7 +1,7 @@ """Propose identity evidence for clicks a bundle runs without a right-record check. docs/LIMITS.md: identity protection applies only where it is armed, and a live -OpenEMR bundle armed 4 to 7 of its 12 clicks. ``scaffold-verifier --bundle`` +A real web bundle armed 4 to 7 of its 12 clicks. ``scaffold-verifier --bundle`` reports identity coverage before and after evidence taken from the recording's DOM / accessibility context near each unarmed click. diff --git a/packages/flow/openadapt_flow/record_check_synthesis.py b/packages/flow/openadapt_flow/record_check_synthesis.py index 5bf54fff94..89136a51ed 100644 --- a/packages/flow/openadapt_flow/record_check_synthesis.py +++ b/packages/flow/openadapt_flow/record_check_synthesis.py @@ -22,7 +22,7 @@ field dropped, saved twice, saved on the wrong record, another record of the same subject destroyed, a stray write elsewhere), plus another record changed or deleted. Every generated read is built, and a database read is - run, so a read that can't work is caught too. On a fixture (MockMed, the + run, so a read that can't work is caught too. On a local fixture (the effect_e2e record service) the check also runs end to end through the replayer (:mod:`openadapt_flow.record_check_proof`). A check that misses any fault, or stops the clean save, is written as a draft with the misses diff --git a/packages/flow/openadapt_flow/registry.py b/packages/flow/openadapt_flow/registry.py index d2c4483170..5fa300c95b 100644 --- a/packages/flow/openadapt_flow/registry.py +++ b/packages/flow/openadapt_flow/registry.py @@ -1,6 +1,6 @@ """Workflow registry: fetch a packaged, parameterized bundle by name. -``openadapt-flow pull openemr/new-referral`` reads ``registry/index.json`` from +``openadapt-flow pull app/workflow-name`` reads ``registry/index.json`` from this repository on GitHub, downloads each file of the named bundle, checks every file against the sha256 recorded in the index, and then loads the bundle so its own manifest digest is checked too. Nothing is installed or run. @@ -889,7 +889,7 @@ def add_parser(sub: Any) -> None: "pull", help="Download a packaged workflow bundle by name", allow_abbrev=False ) p.add_argument( - "workflow", nargs="?", help="Workflow id, for example openemr/new-referral" + "workflow", nargs="?", help="Workflow id, for example app/workflow-name" ) p.add_argument( "--out", default=None, help="Destination directory (default: ./)" diff --git a/packages/flow/openadapt_flow/reward/bundle.py b/packages/flow/openadapt_flow/reward/bundle.py index fd830417fb..01c57c1a86 100644 --- a/packages/flow/openadapt_flow/reward/bundle.py +++ b/packages/flow/openadapt_flow/reward/bundle.py @@ -5,7 +5,7 @@ and (when certified) a self-signed certificate with the calibration counts beside it. :func:`write_bundle` writes one from the effects and oracle a caller passes; tests, the benchmark harnesses and the ``serve-reward`` demo -seed (:mod:`openadapt_flow.reward.seed`) all build their bundles with it. +seed (the demo reward seed) all build their bundles with it. Nothing here is a production recipe. A production-scope certificate is calibrated on a held-out corpus by the OpenAdapt control service. diff --git a/packages/flow/openadapt_flow/risk.py b/packages/flow/openadapt_flow/risk.py index 548336d974..f5148498fd 100644 --- a/packages/flow/openadapt_flow/risk.py +++ b/packages/flow/openadapt_flow/risk.py @@ -473,7 +473,7 @@ def is_write_shaped(text: str) -> bool: # A retained control label must carry at least this many letters or digits to # count as evidence of what the control does. Icon-only controls OCR to single -# glyphs: openIMIS's floppy-disk Save button reads as the CJK glyph "日", a +# glyphs: an icon-only floppy-disk Save button can OCR as the CJK glyph "日", a # check mark as "v", a close cross as "X". Such a fragment proves nothing about # the control's business effect, so it must not turn an icon-only actuator into # a "labelled non-write" control. @@ -562,7 +562,7 @@ def confirmation_opener_step_ids(steps: Iterable[Step]) -> tuple[tuple[str, str] """Return ``(opener_id, confirm_id)`` for clicks that only open a confirmation. Many systems put a confirmation dialog between the form and the save: - OpenEMR's "Create New Patient" only opens "Confirm Create New Patient", + A multi-step form's "Create New Record" only opens "Confirm Create New Record", and the record is created by that dialog's Confirm button. Per-step inference marks both clicks irreversible from their labels, so the opener is counted as the save and the record check lands on the wrong step. diff --git a/packages/flow/openadapt_flow/runtime/effects/__init__.py b/packages/flow/openadapt_flow/runtime/effects/__init__.py index 0eca8e8d43..cfa4b2dc03 100644 --- a/packages/flow/openadapt_flow/runtime/effects/__init__.py +++ b/packages/flow/openadapt_flow/runtime/effects/__init__.py @@ -18,9 +18,9 @@ :class:`SeparateSessionReadbackVerifier` reads the saved record from the application's own record page in a separately signed-in, read-only browser session, for teams with no API or database access. -- Verifiers: :class:`RestRecordVerifier` (JSON REST SoR, e.g. MockMed - ``/api/db``), :class:`GraphQLRecordVerifier` (read-only GraphQL query), - :class:`FhirEffectVerifier` (OpenEMR FHIR R4, primary), +- Verifiers: :class:`RestRecordVerifier` (JSON REST SoR), + :class:`GraphQLRecordVerifier` (read-only GraphQL query), + :class:`FhirEffectVerifier` (FHIR R4, primary), :class:`SqlRecordVerifier` (read-only SQL, enforced whitelist), :class:`FileArrivalVerifier` (file / SFTP arrival), :class:`MaildirDeliveryVerifier` (maildir / SMTP-capture email delivery), @@ -35,7 +35,7 @@ :class:`RedactionPolicy` evidence minimization, and the customer plugin seam (:func:`register_verifier_factory` / the ``openadapt_flow.effect_verifiers`` entry-point group). -- SQL table-delta audit (promoted from the Frappe Lending reference matrix): +- SQL table-delta audit (exact per-table row-delta verification): :func:`capture_table_counts`, :func:`audit_table_deltas`. - Secret-isolated auth for declarative configs: :class:`AuthRef`, and :class:`ResolvedSecrets` for a plugin record check's ``secret_env`` slots. diff --git a/packages/flow/openadapt_flow/runtime/effects/_common.py b/packages/flow/openadapt_flow/runtime/effects/_common.py index 8555f0019d..666d23b7df 100644 --- a/packages/flow/openadapt_flow/runtime/effects/_common.py +++ b/packages/flow/openadapt_flow/runtime/effects/_common.py @@ -218,7 +218,7 @@ def judge_records( ] key_holders: list[dict[str, Any]] = [] if effect.composite_key: - # Several fields together are the key (OpenEMR: lname + fname + DOB). + # Several fields together are the composite key (e.g. last + first + date). # The save's own record is counted by exact text, so a correct save # is never held. Records that carry the key are then counted across # the WHOLE read set, pre-existing ones included and before any diff --git a/packages/flow/openadapt_flow/runtime/effects/auth.py b/packages/flow/openadapt_flow/runtime/effects/auth.py index 5ba2a08a7e..672a487773 100644 --- a/packages/flow/openadapt_flow/runtime/effects/auth.py +++ b/packages/flow/openadapt_flow/runtime/effects/auth.py @@ -30,7 +30,7 @@ class AuthRef(BaseModel): - ``bearer_env`` -- name of an env var holding a bearer token; resolves to ``Authorization: Bearer ``. - ``header`` + ``value_env`` -- an arbitrary auth header (e.g. - ``X-API-Key``) whose VALUE comes from the named env var. Frappe-style + ``X-API-Key``) whose VALUE comes from the named env var. Token-pair ``Authorization: token :`` fits here too (put the whole value in the env var). - ``basic_env`` -- name of an env var holding ``user:password``; resolves diff --git a/packages/flow/openadapt_flow/runtime/effects/db_snapshot.py b/packages/flow/openadapt_flow/runtime/effects/db_snapshot.py index 4ff0eea25b..104951cd07 100644 --- a/packages/flow/openadapt_flow/runtime/effects/db_snapshot.py +++ b/packages/flow/openadapt_flow/runtime/effects/db_snapshot.py @@ -812,8 +812,8 @@ def _definitions(s: _Session) -> tuple[dict[str, _Def], str]: #: MySQL and MariaDB types whose value ``JSON_OBJECT`` can't carry as text: #: a bit string, a geometry or a vector is bytes, which turns the whole -#: object into a binary string that isn't valid JSON (Dolibarr's -#: ``llx_societe.geopoint``). They are read as the hex of their stored bytes. +#: object into a binary string that isn't valid JSON (such as a binary +#: spatial column). They are read as the hex of their stored bytes. _MYSQL_HEX_TYPES = frozenset( { "bit", diff --git a/packages/flow/openadapt_flow/runtime/effects/effect.py b/packages/flow/openadapt_flow/runtime/effects/effect.py index c1b94b9fce..baad2ef2d8 100644 --- a/packages/flow/openadapt_flow/runtime/effects/effect.py +++ b/packages/flow/openadapt_flow/runtime/effects/effect.py @@ -215,9 +215,9 @@ class ValueExpr(BaseModel): #: resolves to nothing, so the check matches nothing and fails closed. map: Optional[dict[str, str]] = None #: For a ``param`` the system of record stores transformed: how it stores - #: what was entered (OpenEMR's New Patient form saves street and city in + #: what was entered (some web forms normalize street and city to #: capitals). Applied after :attr:`map`, with full Unicode case mapping, - #: as the browser's ``toUpperCase()`` does for OpenEMR's "U" fields + #: as the browser's ``toUpperCase()`` does for uppercase-forced fields #: ("Peña" is stored "PEÑA", "Straße" "STRASSE"). ``capitalize_words`` #: puts the first letter of each space-separated word in capitals and #: drops extra spaces, as an app's capitalize-on-save fields do (JavaScript: @@ -236,7 +236,7 @@ class ValueExpr(BaseModel): #: null field) and nothing else: never ``""``, never the text ``"None"``. null: Optional[Literal[True]] = None #: ``True`` when the system of record leaves this field out of a record - #: whose value is null (Redmine's issue JSON omits ``assigned_to`` when + #: whose value is null (some REST APIs omit nullable keys when #: no one is assigned). Then a null value matches a missing field too. #: Without it a missing field matches nothing: a misspelled or #: unprojected field must not pass for null. Declared per field, never @@ -928,7 +928,7 @@ class Effect(BaseModel): #: caller names (:data:`DEFAULT_IDEMPOTENCY_KEY_FIELD` unless told). key_field: str = DEFAULT_IDEMPOTENCY_KEY_FIELD #: ``record_written`` only: a duplicate (idempotency) key made of several - #: fields, such as OpenEMR's ``{lname, fname, DOB}``. Field -> value, each + #: fields, such as ``{lname, fname, dob}``. Field -> value, each #: a :class:`ValueExpr` like :attr:`match`. The count reads only records #: whose key fields all match, and the check also REFUTES when more than #: one record in the read set carries the key, counting records that @@ -1587,12 +1587,12 @@ class EffectVerifier(Protocol): """Independent verification of a typed :class:`Effect` against a REAL system of record (an API / DB / filesystem), never the screen. - A verifier is bound to one substrate (an OpenEMR FHIR endpoint, a REST + A verifier is bound to one substrate (a FHIR endpoint, a REST system of record, a document store) and knows how to (1) snapshot the system of record before the action and (2) decide whether the intended effect actually landed. The same :class:`Effect` contract is honored by every substrate -- that substrate-agnosticism is the point (an - OpenEMR-shaped protocol would just overfit MockMed's replacement). + single-app-shaped protocol would overfit one vendor). Contract for implementers: diff --git a/packages/flow/openadapt_flow/runtime/effects/fhir.py b/packages/flow/openadapt_flow/runtime/effects/fhir.py index 1a5b93c917..fbdd6441d7 100644 --- a/packages/flow/openadapt_flow/runtime/effects/fhir.py +++ b/packages/flow/openadapt_flow/runtime/effects/fhir.py @@ -1,6 +1,6 @@ -"""OpenEMR FHIR R4 system-of-record :class:`EffectVerifier` (primary substrate). +"""FHIR R4 system-of-record :class:`EffectVerifier` (primary substrate). -After a GUI write in OpenEMR (add a patient note / observation / encounter), +After a GUI write to a FHIR-backed app (add a record / observation / note), this verifier queries the FHIR R4 API and confirms the resource ACTUALLY EXISTS in the system of record with the expected field values -- healthcare, the wedge. It is the ``api`` implementation tier of the RFC transition @@ -9,9 +9,9 @@ system of record answers in FHIR ``Bundle`` search-sets whose resources are nested (``subject.reference``, ``valueString``, ``code.text``), so the same :class:`Effect` contract is checked through a FHIR-shaped lens -- proving the -protocol is substrate-agnostic, not MockMed-shaped. +protocol is substrate-agnostic, not shaped to any demo app. -Real FHIR contract (OpenEMR ``/apis/default/fhir/R4``, HL7 FHIR R4): +Real FHIR contract (HL7 FHIR R4 REST search endpoint): GET {base}/{ResourceType}?{search params} Authorization: Bearer @@ -35,11 +35,11 @@ read is unreadable, and a 401 drops the cached token so the next poll gets a new one. -LIVE vs contract-gated: point it at a real OpenEMR by setting -``OPENEMR_FHIR_BASE_URL`` (+ a bearer token); tests that need a live instance +LIVE vs contract-gated: point it at a real FHIR server by setting +``FHIR_BASE_URL`` (+ a bearer token); tests that need a live instance are skipped when it is absent. CI exercises it against an in-repo fake that emits byte-faithful FHIR R4 ``Bundle`` JSON (``tests`` fixtures) -- the fake -mirrors the real FHIR wire shape, never MockMed's screen. +mirrors the real FHIR wire shape, never a demo screen. """ from __future__ import annotations diff --git a/packages/flow/openadapt_flow/runtime/effects/frame.py b/packages/flow/openadapt_flow/runtime/effects/frame.py index bfb3549466..a3c1bd656e 100644 --- a/packages/flow/openadapt_flow/runtime/effects/frame.py +++ b/packages/flow/openadapt_flow/runtime/effects/frame.py @@ -43,7 +43,7 @@ as it was before the change; each entry explains at most one row, and a row whose record key changed is never explained. -A row of a per-user table names no record (OpenEMR's ``user_settings``, +A row of a per-user table names no record (such as ``user_settings``, owned by ``setting_user``). Owner-scoped attribution covers it: for a table whose rows carry an owner (``attribution.owners``, and the app profile's ``own_rows`` tables), another user's write entry of the matching kind that @@ -139,7 +139,7 @@ class FrameAttribution(BaseModel): read: Optional[dict[str, Any]] = None #: ``audit_read`` only: the record field the audit entry's #: ``record_field`` refers to, when it isn't the frame's identity field. - #: OpenEMR's log names a patient (``pid``) while ``lists`` or ``pnotes`` + #: An audit log may name a parent record key while child tables #: rows are told apart by their own ``id``. Such a log names a patient, #: not a table: any entry for a patient covers every row of that #: patient. So the bot's write to a table the frame doesn't read, logged @@ -148,7 +148,7 @@ class FrameAttribution(BaseModel): #: The whole-database frame (``frame.database``) closes the first. record_key: Optional[str] = None #: ``audit_read`` only: per surface or table, the field that names the - #: record when it isn't ``record_key`` (OpenEMR's ``contact`` row points + #: record when it isn't ``record_key`` (a related row may point #: at its chart through ``foreign_id``). record_keys: dict[str, str] = Field(default_factory=dict) #: ``audit_read`` only: the entry field naming what the entry did, and @@ -246,7 +246,7 @@ def _shape(self) -> "FrameAttribution": class FrameSideRecord(BaseModel): """Rows the save adds beside each new declared record (a side record). - OpenEMR's New Patient path writes one ``history_data`` row for the new + A create-record path may write one side-table row for the new chart, linked by ``pid``. Declared here, such rows are part of the save, not collateral, and a missing or extra one refutes the frame. """ @@ -315,7 +315,7 @@ class FrameDatabase(BaseModel): #: The app's own bookkeeping, reviewed per app: a table name #: (append-only) or ``{table, mode, reason}``. allow_tables: list[AllowedTable] = Field(default_factory=list) - #: Table -> the surface whose records it holds (``patient_data`` -> + #: Table -> the surface whose records it holds (e.g. primary table -> #: ``patient``): an effect routed to the surface declares rows here too. views: dict[str, str] = Field(default_factory=dict) #: Table -> a surface that declares its rows (a contract's own read of @@ -1625,7 +1625,7 @@ def new_row( # Side records: the links each new declared record gives its side rows. # A new record another actor created gives its side rows the same way: - # those rows are that actor's too (OpenEMR logs a contact row with no + # those rows are that actor's too (some apps log a side row with no # patient, so only its link to the colleague's chart attributes it). side_links: list[set[str]] = [] other_links: list[set[str]] = [] @@ -1763,7 +1763,7 @@ def partner( if any(c not in after or after.get(c) is None for c in same): return # The partner's ``same`` columns as they are now: the default row - # was written with them (OpenEMR copies the label and the value). + # was written with them (some apps copy both the label and the value). partners.append(({c: str(after.get(c)) for c in same}, how, list(rules))) for key in set(before_map) | set(after_map): diff --git a/packages/flow/openadapt_flow/runtime/effects/fresh_session.py b/packages/flow/openadapt_flow/runtime/effects/fresh_session.py index 770c168f8b..fafc64c5d5 100644 --- a/packages/flow/openadapt_flow/runtime/effects/fresh_session.py +++ b/packages/flow/openadapt_flow/runtime/effects/fresh_session.py @@ -21,7 +21,7 @@ application. Any doubt (no session, a launch the running instance absorbed, the same account as the run, ``ready_text`` never shown) is INDETERMINATE. -The drivers are tested against scripted backends and the MockMed fault +The drivers are tested against scripted backends and the local fault server only; no live desktop app or RDP host is exercised in CI. """ diff --git a/packages/flow/openadapt_flow/runtime/effects/rest.py b/packages/flow/openadapt_flow/runtime/effects/rest.py index 02387a124a..d43efb4bec 100644 --- a/packages/flow/openadapt_flow/runtime/effects/rest.py +++ b/packages/flow/openadapt_flow/runtime/effects/rest.py @@ -2,7 +2,7 @@ Verifies a typed :class:`Effect` against a REST/JSON system of record: an HTTP endpoint that returns the authoritative records (an EMR's own JSON API, -an internal service, the MockMed transactional back end at ``GET /api/db``). +an internal service, or a transactional REST back end). This is the ``api`` implementation tier of the RFC's transition contract (``docs/design/WORKFLOW_PROGRAM_IR.md`` section 4: "call the app's API / DB write; effect probed against the system of record") for a plain-JSON back end. @@ -422,7 +422,7 @@ def _fetch_pass( return None following = urljoin(url, following) if not _same_origin(following, self.base_url): - # OpenEMR, for one, builds next links from its configured site + # Some servers build next links from a configured site # address, which can differ from the address the read uses. self.read_problem = ( f"next link origin {_origin(following)} != base_url " diff --git a/packages/flow/openadapt_flow/runtime/effects/sql.py b/packages/flow/openadapt_flow/runtime/effects/sql.py index 25c6d76cf1..1848699bdd 100644 --- a/packages/flow/openadapt_flow/runtime/effects/sql.py +++ b/packages/flow/openadapt_flow/runtime/effects/sql.py @@ -1,7 +1,7 @@ """Read-only SQL system-of-record :class:`EffectVerifier` + table-delta audit. -Promotes the SQL-audit verification the governed Frappe Lending reference -matrix proved (``benchmark/frappe_lending/fixture.py``, merged PR #131) from +Promotes the SQL-audit verification pattern +proved by the governed reference matrix from bespoke benchmark plumbing into a deployable kit component: - :class:`SqlRecordVerifier` -- a PARAMETERIZED read-only SELECT is the record @@ -9,7 +9,7 @@ idempotency key, field read-back, collateral loss, ``count_new_only``), exactly like every other substrate. - :func:`audit_table_deltas` -- the EXACT row-count-delta contract lifted from - the Frappe fixture: every table named in the contract must move by exactly + the reference fixture: every table named in the contract must move by exactly the declared delta, and every OTHER table must move by exactly 0 (a write that "worked" but also inserted a stray row elsewhere is a violation). - :func:`capture_table_counts` -- read-only ``COUNT(*)`` per audited table, @@ -253,7 +253,7 @@ def _sql_tokens( #: Audited table names must be plain identifiers (letters / digits / ``_`` / -#: space -- Frappe's ``tabLoan Application`` has a space). Anything else +#: space -- some SQL schemas use spaces in table names). Anything else #: (quotes, backticks, semicolons, comment tokens) is refused rather than #: escaped: the audit runs with read credentials, but identifier smuggling #: must still be impossible. @@ -1037,7 +1037,7 @@ def bind_null_sql_params( def read_cell(value: Any) -> Any: """A binary column as ``0x`` + hex, so records stay JSON-serializable. - OpenEMR keys rows by ``uuid binary(16)``; a driver returns those as bytes, + Some apps key rows by ``uuid binary(16)``; a driver returns those as bytes, which a baseline (JSON) cannot hold. Equal bytes give equal text, so record identity and change detection are unaffected. """ @@ -1217,7 +1217,7 @@ def verify( time.sleep(self.poll_interval_s) -# -- exact table-delta audit (promoted from benchmark/frappe_lending) -------- +# -- exact table-delta audit ------------------------------------------------ def capture_table_counts( @@ -1271,8 +1271,8 @@ def audit_table_deltas( ) -> tuple[list[str], dict[str, int]]: """Exact-contract table-delta audit; violations plus the full delta map. - The contract the governed Frappe Lending matrix proved (lifted from - ``benchmark/frappe_lending/fixture.py::audit_table_deltas``): every table + The contract proved by the governed table-delta reference matrix + (``audit_table_deltas``): every table in ``expected`` must change by EXACTLY its declared delta, and every other observed table must change by exactly 0 -- a "successful" write that also perturbed an unrelated table is a violation, not noise. diff --git a/packages/flow/openadapt_flow/runtime/replay/_shared.py b/packages/flow/openadapt_flow/runtime/replay/_shared.py index 8d5de5c6bb..3ff124b01e 100644 --- a/packages/flow/openadapt_flow/runtime/replay/_shared.py +++ b/packages/flow/openadapt_flow/runtime/replay/_shared.py @@ -202,7 +202,7 @@ def _frame_viewport(frame_png: bytes) -> tuple[int, int]: PC_TEMPLATE_THRESHOLD = 0.9 # REGION_STABLE asserts recorded structure, not palette. The ordinary # grayscale template matcher remains the first (stricter) check; this edge-map -# threshold is a color-invariant fallback. Exact v1.16.1 MockMed evidence +# threshold is a color-invariant fallback. Exact v1.16.1 fixture evidence # measured correct theme+parameter substitution at 0.86 and a true blocking # modal at 0.24, leaving a deliberate margin on both sides. PC_STRUCTURAL_TEMPLATE_THRESHOLD = 0.8 diff --git a/packages/flow/openadapt_flow/submit_binding.py b/packages/flow/openadapt_flow/submit_binding.py index 5cda0f3f6d..5d93d1d2c6 100644 --- a/packages/flow/openadapt_flow/submit_binding.py +++ b/packages/flow/openadapt_flow/submit_binding.py @@ -5,7 +5,7 @@ A consequential click must be tied to a record before Flow will deliver it. For a control inside a table row, the row is the record: its identity text is verified before the click and leased until delivery. An icon-only Save that -floats next to a form (openIMIS's claim Save is a floppy-disk button with no +floats next to a form (an icon-only Save button with no text, accessible name, or tooltip, outside any row) has no such identity, so Flow refuses the click. That refusal is correct: without more evidence, an unlabeled icon could be any control on the page. diff --git a/packages/flow/openadapt_flow/tutorial.py b/packages/flow/openadapt_flow/tutorial.py index ca7054225b..5b3fdb6014 100644 --- a/packages/flow/openadapt_flow/tutorial.py +++ b/packages/flow/openadapt_flow/tutorial.py @@ -882,3 +882,31 @@ def run_demo_workflow_replay( finally: if stop is not None: stop() + + +def serve_demo_app(*, port: int = 0) -> tuple[str, Callable[[], None]]: + """Serve the bundled MockMed demo app on a local port.""" + + from openadapt_flow.mockmed.server import serve + + return serve(port=port) + + +def demo_execute_admissions() -> tuple[Any, ...]: + """Return the bundled demo Execute admissions for ``--seed-mockmed``.""" + + from openadapt_flow.mockmed.execute_seed import demo_admissions + + return demo_admissions() + + +def seed_demo_reward( + data_dir: Path, key: Any, issuer_key_id: str +) -> tuple[dict[str, Path], Path, Path]: + """Seed the bundled demo reward bundles and return (bundles, db, screen).""" + + from openadapt_flow.mockmed.reward_seed import seed_mockmed + + paths = seed_mockmed(data_dir, key, issuer_key_id) + store = Path(data_dir) / "mockmed" + return paths, store / "records.db", store / "screen.json" diff --git a/packages/flow/openadapt_flow/validation/dense_surface.py b/packages/flow/openadapt_flow/validation/dense_surface.py index 7de3cb8c0a..297ef0cfaf 100644 --- a/packages/flow/openadapt_flow/validation/dense_surface.py +++ b/packages/flow/openadapt_flow/validation/dense_surface.py @@ -2,7 +2,7 @@ The bounded identity evidence (``docs/validation/IDENTITY_EVIDENCE.md``: false accept 0.000%, false abort 26.17%) is measured on SYNTHETIC corpora — string pairs -with hand-injected OCR noise — and, at the product level, on CLEAN OpenEMR +with hand-injected OCR noise — and, at the product level, on clean production identity banners. Neither is the surface where a wrong-patient write actually does damage: a DENSE, SIBLING-HEAVY record list, where OCR noise is worst (small dense rows, adjacent-row bleed) and near-duplicate names sit one row @@ -415,7 +415,7 @@ def render_table_html( return ( "" f"" - "
MockMed — Patient Records (demo, all data fake)
" + "
Synthetic Records Table (demo, all data fake)
" "
Search results — " f"{table.n_rows} patients
" "
" @@ -1272,7 +1272,7 @@ def render_markdown(result: dict[str, Any], agg: dict[str, Any]) -> str: "(`docs/validation/IDENTITY_EVIDENCE.md`: **false accept 0.000%, false " f"abort {_pct(SYNTHETIC_FALSE_ABORT)}**) are measured on SYNTHETIC " "corpora (string pairs with hand-injected OCR noise) and, at the " - "product level, on CLEAN OpenEMR identity banners. This study " + "product level, on clean production identity banners. This study " "measures the SAME matcher on the surface where a wrong-patient " "write actually does damage: a dense, sibling-heavy record LIST, " "rendered as HTML, screenshotted, and read by the repo's own OCR " diff --git a/packages/flow/openadapt_flow/verifier.py b/packages/flow/openadapt_flow/verifier.py index e7a8a59885..16e35ac5c5 100644 --- a/packages/flow/openadapt_flow/verifier.py +++ b/packages/flow/openadapt_flow/verifier.py @@ -3694,7 +3694,7 @@ def capture_database( caps data rows across tables and auxiliary queries; exceeding it refuses the read without returning a partial snapshot. - ``profile`` (``openemr``) applies an app profile's bookkeeping rules, the + ``profile`` (by app-profile name) applies an app profile's bookkeeping rules, the same ones the frame uses (``openadapt_flow.app_profiles``); its own-row rules need the acting user's sign-in names (``actor_names``), whose ids are read in the same transaction. ``before``: a snapshot taken earlier diff --git a/packages/flow/openadapt_flow/vision/hashing.py b/packages/flow/openadapt_flow/vision/hashing.py index 6f25add5cd..61c789b85c 100644 --- a/packages/flow/openadapt_flow/vision/hashing.py +++ b/packages/flow/openadapt_flow/vision/hashing.py @@ -7,7 +7,7 @@ text placement rather than palette. Identical frames still hash identically (distance 0), a dark-theme re-render of the same screen stays within a small distance, while a genuinely different screen state (e.g. an unexpected -modal) remains far away. Measured on MockMed: same-screen theme drift +modal) remains far away. Measured on synthetic fixtures: same-screen theme drift distances are <= 12 versus >= 30 for a blocking modal. """ diff --git a/packages/flow/openadapt_flow/volatility.py b/packages/flow/openadapt_flow/volatility.py index 7ddf39e737..aa91cdf95d 100644 --- a/packages/flow/openadapt_flow/volatility.py +++ b/packages/flow/openadapt_flow/volatility.py @@ -3,7 +3,7 @@ Postconditions and identity evidence must SELECT FOR STABILITY: text that names a *moment* (clock times, freshly-dated rows), a *count* (counters, badges), or noise (short/low-entropy fragments) cannot survive replay -against live data — a fresh OpenEMR recording once mined ``text_present +against live data — a live web recording once mined ``text_present ':01'`` (a clock-minute fragment) and every later replay halted on it the moment the clock moved on (docs/validation/VALIDATION.md, Track D). @@ -28,7 +28,7 @@ # Clock times are volatile at replay latency (the minute hand moves between # record and replay). The second alternative catches bare OCR fragments like # ':01' — a colon-led minute with no hour digit, which slipped past the old -# combined pattern and false-halted three live OpenEMR replays. +# combined pattern and false-halted three live replays. CLOCK_RE = re.compile( r"(? list[str]: + """Scan sibling core packages (types, desktop, capture) for app names.""" + root = packages_dir if packages_dir is not None else FLOW.parent + if not root.is_dir(): + return [] + config = config if config is not None else load_config() + terms = _term_patterns(config) + checked_terms = { + term: terms[term] for term in CORE_PACKAGE_APP_TERMS if term in terms + } + violations: list[str] = [] + for pkg_name, mod_name in CORE_PACKAGE_ROOTS: + pkg_root = root / pkg_name / mod_name + if not pkg_root.is_dir(): + continue + for path in sorted(pkg_root.rglob("*")): + if not path.is_file() or path.suffix not in SUFFIXES: + continue + if "__pycache__" in path.parts: + continue + rel = path.relative_to(root).as_posix() + try: + text = path.read_text(encoding="utf-8") + except UnicodeDecodeError: + continue + for number, line in enumerate(text.splitlines(), start=1): + stripped = line.lstrip() + if EXAMPLE_MARKER.match(stripped): + continue + split = _CAMEL_BOUNDARY.sub(" ", line) + for term, (pattern, is_name) in checked_terms.items(): + if pattern.search(line) or (is_name and pattern.search(split)): + violations.append( + f"packages/{rel}: {term!r} on line {number} " + "(0 allowed in core packages)" + ) + return violations + + def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser( description=__doc__.split("\n", 1)[0], allow_abbrev=False @@ -153,17 +210,21 @@ def main(argv: list[str] | None = None) -> int: hits = scan() baseline = json.loads(BASELINE.read_text(encoding="utf-8")) new, stale = compare(hits, baseline) + core_violations = scan_core_packages() if args.update_baseline: - if new: + if new or core_violations: print("New hits cannot enter the baseline:", file=sys.stderr) - print("\n".join(f" {line}" for line in new), file=sys.stderr) + print( + "\n".join(f" {line}" for line in (*new, *core_violations)), + file=sys.stderr, + ) return 1 BASELINE.write_text(json.dumps(counts(hits), indent=2) + "\n", encoding="utf-8") print(f"Baseline lowered: {BASELINE.relative_to(FLOW)}") return 0 - if new: + if new or core_violations: print( "The engine names a specific application. Put what one app needs " "in data (app_profiles/*.yaml, a generated contract, a deployment " @@ -172,7 +233,9 @@ def main(argv: list[str] | None = None) -> int: "only gives an example may carry '# example:'.", file=sys.stderr, ) - print("\n".join(f" {line}" for line in new), file=sys.stderr) + print( + "\n".join(f" {line}" for line in (*new, *core_violations)), file=sys.stderr + ) if stale: print( "The baseline is higher than the engine now; lower it with " @@ -180,7 +243,7 @@ def main(argv: list[str] | None = None) -> int: file=sys.stderr, ) print("\n".join(f" {line}" for line in stale), file=sys.stderr) - if new or stale: + if new or stale or core_violations: return 1 total = sum(n for by_term in baseline.values() for n in by_term.values()) print(f"Engine generality OK ({total} baseline hits left)") diff --git a/packages/flow/scripts/generality.toml b/packages/flow/scripts/generality.toml index 5603f91be8..c7a0bf4836 100644 --- a/packages/flow/scripts/generality.toml +++ b/packages/flow/scripts/generality.toml @@ -59,6 +59,7 @@ paths = ["app_profiles/"] # flags). They may name the demo app and its REST shape; nothing else may. [allow.terms_in] "mockmed/" = ["mockmed", "mockmed-records", "mockmed-write"] +"mockloan/" = ["mockloan", "mockmed", "mockmed-records"] "taskgen/profiles/" = ["mockmed"] "tutorial.py" = ["mockmed", "mockmed-records", "mockmed-write"] "demo_proof.py" = ["mockmed", "mockmed-records", "mockmed-write"] diff --git a/packages/flow/scripts/generality_baseline.json b/packages/flow/scripts/generality_baseline.json index 95d302d09c..58e4bbdd6d 100644 --- a/packages/flow/scripts/generality_baseline.json +++ b/packages/flow/scripts/generality_baseline.json @@ -1,193 +1,8 @@ { "__main__.py": { - "mockmed": 41, - "textedit": 1 - }, - "backend.py": { - "mockmed-records": 1 - }, - "backends/factory.py": { - "textedit": 1 - }, - "backends/parallels_vm.py": { - "open-dental": 1 - }, - "backends/playwright_backend.py": { - "openemr": 1 - }, - "backends/win_agent/server.py": { - "notepad": 1 - }, - "compiler/compile.py": { - "mockmed": 2, - "mockmed-records": 1, - "openemr": 1 - }, - "compiler/effect_mining.py": { - "mockmed-records": 1 - }, - "compiler/fixup_passes.py": { - "openemr": 1 - }, - "compiler/local_edit.py": { - "mockmed": 1 - }, - "demo_driver.py": { - "mockloan": 2 + "mockmed": 6 }, "deployment.py": { - "mockmed": 1, - "mockmed-records": 1, - "openemr": 1, - "textedit": 1 - }, - "execution_profiles.py": { - "mockmed": 1 - }, - "fault_gate.py": { - "openemr": 1 - }, - "generate/demo_analysis.py": { - "redmine": 1 - }, - "generate/verify_contract.py": { - "dolibarr": 1, - "espocrm": 2, - "redmine": 2 - }, - "jit/authority.py": { - "textedit": 2 - }, - "jit/compile_agent.py": { - "textedit": 1 - }, - "jit/recorded.py": { - "mockmed": 1 - }, - "jit/signature.py": { - "mockmed": 1 - }, - "mockloan/__init__.py": { - "mockloan": 2, - "mockmed": 2 - }, - "mockloan/fault_server.py": { - "mockloan": 6, - "mockmed-records": 2 - }, - "mockloan/server.py": { - "mockloan": 4 - }, - "mockloan/static/app.js": { - "mockloan": 3, - "mockmed": 1 - }, - "mockloan/static/index.html": { - "mockloan": 2 - }, - "mockloan/static/styles.css": { - "mockloan": 1, - "mockmed": 1 - }, - "operator_profile.py": { - "openemr": 1 - }, - "policy_packs.py": { - "mockmed": 1 - }, - "qualification_dev_signer.py": { - "mockmed": 1 - }, - "qualification_proposal.py": { - "mockmed": 1 - }, - "qualification_web_session.py": { - "openemr": 1, - "openimis": 1 - }, - "qualify/config.py": { - "openemr": 1 - }, - "record_check_binding.py": { - "openimis": 1 - }, - "record_check_identity.py": { - "openemr": 1 - }, - "record_check_synthesis.py": { - "mockmed": 1 - }, - "registry.py": { - "openemr": 2 - }, - "reward/seed.py": { - "mockmed": 34 - }, - "risk.py": { - "openemr": 1, - "openimis": 1 - }, - "runtime/effects/__init__.py": { - "frappe": 1, - "mockmed": 1, - "mockmed-records": 1, - "openemr": 1 - }, - "runtime/effects/_common.py": { - "openemr": 1 - }, - "runtime/effects/auth.py": { - "frappe": 1 - }, - "runtime/effects/db_snapshot.py": { - "dolibarr": 1, - "dolibarr-table": 1 - }, - "runtime/effects/effect.py": { - "mockmed": 1, - "openemr": 5, - "redmine": 1 - }, - "runtime/effects/fhir.py": { - "mockmed": 2, - "openemr": 5, - "openemr-fhir-path": 1 - }, - "runtime/effects/frame.py": { - "openemr": 6, - "patient_data": 1, - "pnotes": 1 - }, - "runtime/effects/fresh_session.py": { - "mockmed": 1 - }, - "runtime/effects/rest.py": { - "mockmed": 1, - "mockmed-records": 1, - "openemr": 1 - }, - "runtime/effects/sql.py": { - "frappe": 7, - "frappe-table": 1, - "openemr": 1 - }, - "runtime/replay/_shared.py": { - "mockmed": 1 - }, - "submit_binding.py": { - "openimis": 1 - }, - "validation/dense_surface.py": { - "mockmed": 1, - "openemr": 2 - }, - "verifier.py": { - "openemr": 1 - }, - "vision/hashing.py": { - "mockmed": 1 - }, - "volatility.py": { - "openemr": 3 + "mockmed-records": 1 } } diff --git a/packages/flow/tests/e2e/test_record_compile_replay.py b/packages/flow/tests/e2e/test_record_compile_replay.py index 46fd5ed44d..f02c99563a 100644 --- a/packages/flow/tests/e2e/test_record_compile_replay.py +++ b/packages/flow/tests/e2e/test_record_compile_replay.py @@ -476,7 +476,7 @@ def cli(*args: str) -> subprocess.CompletedProcess: str(healed), ) assert proc.returncode == 0, f"stdout:\n{proc.stdout}\nstderr:\n{proc.stderr}" - assert "bundled MockMed" in proc.stdout + assert "bundled demo app" in proc.stdout assert (selfserve_run / "report.json").is_file() assert (healed / "workflow.json").is_file() report = json.loads((selfserve_run / "report.json").read_text()) diff --git a/packages/flow/tests/test_engine_generality_check.py b/packages/flow/tests/test_engine_generality_check.py index 6b21db8539..82d2237664 100644 --- a/packages/flow/tests/test_engine_generality_check.py +++ b/packages/flow/tests/test_engine_generality_check.py @@ -129,3 +129,26 @@ def test_the_engine_passes_against_its_baseline(check) -> None: new, stale = check.compare(check.scan(), baseline) assert not new, "\n".join(new) assert not stale, "\n".join(stale) + + +def test_core_packages_guard_catches_app_names(check, tmp_path: Path) -> None: + for rel, text in { + "types/openadapt_types/a.py": 'APP = "OpenEMR"\n', + "desktop/openadapt_desktop/b.py": "# example: Medplum\nx = 1\n", + "desktop/openadapt_desktop/c.py": "URL = 'https://stedi.example'\n", + "capture/openadapt_capture/d.py": "isMockMed = True\n", + }.items(): + path = tmp_path / rel + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text, encoding="utf-8") + + violations = check.scan_core_packages(tmp_path) + assert len(violations) == 3 + assert any("openadapt_types/a.py" in v and "openemr" in v for v in violations) + assert any("openadapt_desktop/c.py" in v and "stedi" in v for v in violations) + assert any("openadapt_capture/d.py" in v and "mockmed" in v for v in violations) + + +def test_monorepo_core_packages_have_zero_app_leaks(check) -> None: + violations = check.scan_core_packages() + assert not violations, "\n".join(violations) diff --git a/packages/flow/tests/test_reward_trust_boundary.py b/packages/flow/tests/test_reward_trust_boundary.py index bf3be7e4ec..f95b62d2d8 100644 --- a/packages/flow/tests/test_reward_trust_boundary.py +++ b/packages/flow/tests/test_reward_trust_boundary.py @@ -21,6 +21,14 @@ from openadapt_types.oracle import OracleChannel # noqa: E402 from openadapt_types.reward import RewardOutcomeV1 # noqa: E402 +from openadapt_flow.mockmed.reward_seed import ( # noqa: E402 + MOCKMED_HONEST_PATIENT, + MOCKMED_LIE_PATIENT, + MOCKMED_QUERY, + mockmed_episode, + seed_mockmed, + write_mockmed_encounter, +) from openadapt_flow.reward.bundle import ( # noqa: E402 calibrate_bundle, write_bundle, @@ -44,14 +52,6 @@ assert_sqlite_database, build_oracle, ) -from openadapt_flow.reward.seed import ( # noqa: E402 - MOCKMED_HONEST_PATIENT, - MOCKMED_LIE_PATIENT, - MOCKMED_QUERY, - mockmed_episode, - seed_mockmed, - write_mockmed_encounter, -) from openadapt_flow.reward.worker import RewardWorker, RewardWorkerError # noqa: E402 from openadapt_flow.runtime.effects.effect import Effect # noqa: E402 diff --git a/packages/flow/tests/test_reward_worker.py b/packages/flow/tests/test_reward_worker.py index dbe3f52577..5b6e4ce0dd 100644 --- a/packages/flow/tests/test_reward_worker.py +++ b/packages/flow/tests/test_reward_worker.py @@ -24,6 +24,16 @@ ) import openadapt_flow.reward.callables as callables # noqa: E402 +from openadapt_flow.mockmed.reward_seed import ( # noqa: E402 + MOCKMED_DUPLICATE_PATIENT, + MOCKMED_HONEST_PATIENT, + MOCKMED_LIE_PATIENT, + MOCKMED_QUERY, + mockmed_episode, + seed_mockmed, + write_mockmed_banner, + write_mockmed_encounter, +) from openadapt_flow.reward.bundle import ( # noqa: E402 CALIBRATION_FILE, CALIBRATION_TRIALS, @@ -50,16 +60,6 @@ from openadapt_flow.reward.oracles import ( # noqa: E402 observation, ) -from openadapt_flow.reward.seed import ( # noqa: E402 - MOCKMED_DUPLICATE_PATIENT, - MOCKMED_HONEST_PATIENT, - MOCKMED_LIE_PATIENT, - MOCKMED_QUERY, - mockmed_episode, - seed_mockmed, - write_mockmed_banner, - write_mockmed_encounter, -) from openadapt_flow.reward.serve import OPENAI_GRADER_ROUTE, create_app # noqa: E402 from openadapt_flow.reward.worker import RewardWorker, RewardWorkerError # noqa: E402 from openadapt_flow.runtime.effects.effect import Effect # noqa: E402