Repository navigation
refactor(types,desktop): generalize healthcare/clinic core contracts and policies - #2487
Conversation
Independent adversarial review: REQUEST CHANGESFrom: Codex
Evidence covers immutable source, synthetic serialized artifacts and the existing hosted run. No live app, signing or dispatch was exercised. |
…schema, and support bundled Flow policy fallback
Independent adversarial review: REQUEST CHANGESFrom: Codex Three findings from the previous review still affect ordinary readers or commands.
Resolved. The exact Flow mirror test passes. Base-generated person-only and opt-in policies, plus approved and declined records, retained identical canonical v1 bytes through both Types readers and validated against both shipped schemas. Flow's policy digests matched, and its normal unsigned-policy loader retained the delegation refusal. These checks used immutable source and synthetic unsigned inputs. Hosted CI for this revision is pending. Current run |
…catalog slots, and canonical v1 outcome bytes
Independent adversarial review: REQUEST CHANGESFrom: Codex One Desktop policy-selection regression remains. An operator can explicitly request the stricter Preserve the distinction between an omitted policy and an explicit selection through the dispatcher. A request to reuse the recorded policy can retain the old identity. An explicit selection should evaluate that policy or return a clear error. A focused regression can assert which policy reaches the evaluator for both requests on the same previously permissive bundle. The other cases from the previous review are resolved. The qualification screen forwards the inspected policy, including the legacy The policy finding comes from tracing the exact dispatcher and certification source. The serialization and catalog checks used synthetic inputs. Hosted CI is pending. Current run |
…ispatcher and qualification
Independent adversarial review: REQUEST CHANGESFrom: Codex Desktop still sends a policy selection when the user simply opens an existing bundle. The dispatcher now preserves an omitted policy and honors an explicit Omit the initial UI policy argument when the user has made no selection. Carry the policy returned by inspection through subsequent certification actions, including Check it's shared request helper. Keep the new backend behavior for a caller who expressly selects a policy. The existing regression invokes the dispatcher directly and does not cover the field the screens insert. Check it helper · Dispatcher regression This finding follows the exact request literals, dispatcher branches and certificate comparison. I did not run a certification. Hosted CI is queued. Current run |
…olicy on certification
Independent adversarial review: APPROVEFrom: Codex The remaining UI finding is resolved. Both Qualification and Check it now send only the workflow ID on initial inspection. The dispatcher therefore receives an omitted policy and can reuse the bundle's recorded policy. Both screens carry the inspected value into certification. The lifecycle screen carries it into its follow-up requests, and an explicitly supplied value in the shared request helper takes precedence. Qualification inspection · Qualification certification · Check it request helper The new Check it component test renders the screen, clicks approval and asserts the exact IPC arguments: the initial inspection omits |
Independent adversarial review: APPROVEFrom: Grok Delta confirmation versus Codex APPROVE at Delta
I did not re-litigate the previously approved unique body. The unique tree at Merge-order residual (not a blocker of this PR's own content)#2532 (#2532, currently No merge from this review. |
…y-types-desktop # Conflicts: # packages/desktop/CHANGELOG.md
Independent adversarial review: APPROVEFrom: Grok Delta confirmation versus my APPROVE at DeltaFirst-parent delta is two commits:
This also clears the earlier merge-order residual against #2532 / #2533: this head no longer ships 0.31.1. I did not re-litigate the previously approved unique body. No merge from this review. |
….1 notes #2487 declared the domain-neutral alias before the v1 member in StepClass, ApproverPolicyRefusal and OutcomeSourceV1, so .name, str() and repr() of the v1 member changed (StepClass.CLINICAL_WRITE.name became HIGH_RISK_WRITE). The v1 member now comes first and the new name is the alias, as in 0.24.0. Values, wire bytes and schemas are unchanged. The 0.24.1 notes now list #2487: the managed_job module and schemas, the domain-neutral aliases and accepted input forms, and that output stays byte-identical to 0.24.0.
…accepts Flow 4 (#2540) * release: openadapt-types 0.24.1 and openadapt-verify 0.2.1; accept Flow 4 openadapt-flow 3.4.0 imports openadapt_types.receipt, which openadapt-types 0.24.0 does not have, so a clean install of 3.4.0 fails on every receipt path. openadapt-types 0.24.1 adds the receipt, receipt callback, run ledger and exception card modules. It stays inside the <0.25.0 range every released Flow 3 accepts, so it also repairs Flow 3.4.0 installs. 0.24.1 keeps every 0.24.0 digest. escalated_after_effect_reward enters RewardContractV1.digest only when it differs from its default, and the pinned contract digest is back to its 0.24.0 value. A fixture of contracts and certificates issued by openadapt-types 0.24.0 from PyPI checks that they hash and verify unchanged. A 0.24.0 contract with verified_reward of 0.5 or less still loads; asking then earns no credit. This is the first of two release PRs. Flow 4.0.0 needs openadapt-types 0.24.1 on PyPI first: its on-prem wheelhouse is built from Flow's lock, which can only pin a types version PyPI serves. So this PR also lifts the caps that would break CI once the in-tree Flow is 4.0.0: - the launcher accepts openadapt-flow >=3.3.0,<5.0.0, in its requirements and in `openadapt doctor`'s supported range; the platform manifest is regenerated with the same component selection so its compatibility block matches. The launcher releases only on dispatch, so nothing ships here. - openadapt-verify 0.2.1 accepts openadapt-flow <5 (#2535). * release: address review of types 0.24.1 and verify 0.2.1 - verify's distribution check asserted the old <4 Flow cap; it now expects <5, so the verify job and its release build pass. - RewardScoringPolicyV1 leaves escalated_after_effect_reward out of its serialization at the default, so a contract file 0.24.1 writes stays readable by 0.24.0 and hashes the same; the digest needs no special case. A test checks the serialized form against the 0.24.0 fixture. - The types notes move the validator change into Features and add a Compatibility section. The verify note names the extras it widens. Verify's suite passes against the Flow 4.0.0 source (91 passed; the 3 installed-CLI tests need an installed openadapt-verify and fail the same way without this change). * fix(types): an undeclared escalation earns nothing escalated_after_effect_reward now defaults to 0, not 0.5. A contract written or certified before the escalated_after_effect outcome existed never declared it, so the outcome must not start paying under it. - The field is still left out of serialization at its default, so 0.24.0 contracts and certificates hash, verify and load as before, and 0.24.1 writes files 0.24.0 can read. - The validator no longer needs a default exception: any value at or above verified_reward is refused, and 0 is always below it. - The 0.24.0 fixture now also records how 0.24.0 scored every outcome it knew (tier 2, policy update 120). The test checks 0.24.1 scores them the same and gives the new outcome 0. A declared value is paid as declared. - Flow's synthetic reward bundle declares escalated_after_effect_reward 0.5, so its demo and Harness² tests keep their partial credit. That contract declares it, so it is paid. * docs: the escalated_after_effect default is 0 everywhere it is described REWARD.md, the reward worker docstring, HARNESS2.md and REWARD_WORKER.md still said the default was 0.5. The types notes and docstring restore the below-1 bound beside the below-verified_reward one. The exported contract schema carries the new docstring. * release(types): keep 0.24.0 enum member names; note #2487 in the 0.24.1 notes #2487 declared the domain-neutral alias before the v1 member in StepClass, ApproverPolicyRefusal and OutcomeSourceV1, so .name, str() and repr() of the v1 member changed (StepClass.CLINICAL_WRITE.name became HIGH_RISK_WRITE). The v1 member now comes first and the new name is the alias, as in 0.24.0. Values, wire bytes and schemas are unchanged. The 0.24.1 notes now list #2487: the managed_job module and schemas, the domain-neutral aliases and accepted input forms, and that output stays byte-identical to 0.24.0. * release(types): publish the reviewed content as openadapt-types 0.24.2 0.24.1 was stamped on main by #2543 without this PR's reviewed types code and was never published; that tree breaks 0.24.0 contracts. The reviewed content ships as 0.24.2. Only the version (pyproject, uv.lock) and the changelog change; every other types and verify file is byte-identical to the reviewed 45f0cd5.
Summary
Generalizes healthcare/clinic/insurance concepts in
packages/typesandpackages/desktopto domain-neutral core contracts and policies, keeping narrow backward-compatible wire shims only where serialized receipts or configs require compatibility.packages/typesopenadapt_types/managed_job.py): Introduced domain-neutralManagedInboxV1,ManagedOutboxV1,ManagedToolResultV1,ManagedMcpToolCatalogV1,ManagedBoundToolCallV1,ManagedToolStatusV1, andopenadapt.managed-*/v1schemas (subject_token,collect,attach_artifact,create_task) exported viascripts/export_managed_job_schemas.py.openadapt_types/clinic_job.py): Marked as a legacy compatibility shim for existingopenadapt.clinic-*/v1wire payloads, reusingManagedToolStatusV1,ManagedActuationDecisionV1,ManagedActuationHeld, andManagedToolUnknown.openadapt_types/approval.py): GeneralizedStepClass.CLINICAL_WRITE->StepClass.HIGH_RISK_WRITE(high_risk_write),ApproverPolicyRefusal.CLINICAL_WRITE_NEEDS_OPT_IN->HIGH_RISK_WRITE_NEEDS_OPT_IN, andclinical_write_opt_in_sha256->high_risk_write_opt_in_sha256, with wire-level deserialization shims and legacy aliases for previously serialized policies/receipts. Re-exported JSON schemas.openadapt_types/vocabulary/outcomes.json,outcome-vectors.json,plain_results.py,docs/VOCABULARY.md): Generalizedclinic_tool_status->managed_tool_statuswith backward-compatible input handling inplain_outcome()andPlainOutcomeInputsV1.packages/desktopPOLICY/DEFAULT_QUALIFICATION_POLICYfrom"clinical-write"to Flow's domain-neutral"record-write"inopenadapt_desktop/check_setup.py,openadapt_desktop/qualification.py,src/screens/CheckIt.tsx,src/screens/Qualification.tsx, andsrc/screens/QualificationLifecycle.tsx.dos,mrn,npi,icd,cpt) insrc/screens/NeedsYou.tsxandsrc/lib/outcomes.tswith general system-of-record acronyms (id,url,api,sku,po,dob,ssn,ein,zip); generalized healthcare/clinic wording insrc/screens/Welcome.tsx,src/screens/Sample.tsx,src/ui/ApprovalSwitch.tsx,openadapt_desktop/approval_mode.py,openadapt_desktop/config.py, andopenadapt_desktop/portal/ingress.py.Generality Gate
packages/typesandpackages/desktop, replacing them with domain-neutral contracts (managed_job,high_risk_write,managed_tool_status,record-write).packages/typestest suite (820 tests, including new domain-neutral contract and legacy-compat tests) and targetedpackages/desktopengine/portal tests (112 tests).Verification
packages/types:uv run ruff check openadapt_types tests scripts,uv run ruff format --checkon new files,uv run mypy --follow-imports=silent openadapt_types/managed_job.py openadapt_types/approval.py,uv run pytest -q(820 passed)packages/desktop:uv run ruff checkon edited modules,uv run pytest -q tests/test_engine/test_check_setup.py tests/test_engine/test_approval_mode.py tests/test_engine/test_qualification.py tests/test_engine/test_check_it_drills.py tests/test_portal/test_ingress.py tests/test_oracle_vocabulary.py(112 passed)