Skip to content

refactor(flow): extract Stedi 270/271 eligibility client into optional connector package - #2488

Merged
abrichr merged 2 commits into
mainfrom
gemini/extract-eligibility-plugin
Nov 21, 2026
Merged

abrichr merged 2 commits into
mainfrom
gemini/extract-eligibility-plugin

Conversation

@abrichr

@abrichr abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member

Summary

Extracts the Stedi 270/271 healthcare payer eligibility subpackage (openadapt_flow/eligibility/, 48 engine-generality baseline hits, zero engine importers) out of openadapt-flow core into a standalone optional connector package under packages/connectors/eligibility/ (openadapt-eligibility):

  • Extracted package (packages/connectors/eligibility/):
    • Moved openadapt_flow/eligibility/{__init__.py, artifact.py, client.py, payer_routes.yaml, waterfall.py} -> packages/connectors/eligibility/openadapt_eligibility/ (preserving git rename history).
    • Moved the 4 dedicated eligibility test suites (test_eligibility_api.py, test_eligibility_artifact.py, test_eligibility_live_stedi.py, test_eligibility_waterfall.py) -> packages/connectors/eligibility/tests/ and updated imports to openadapt_eligibility.
    • Added pyproject.toml (openadapt-eligibility, MIT, depending on openadapt-flow) and README.md.
  • Core cleanup (packages/flow/):
    • Removed openadapt_flow/eligibility/payer_routes.yaml from packages/flow/public-artifacts.json.
    • Updated packages/flow/tests/test_binary_file_descriptors.py to test flow's own item_approval._write_exclusive and added test_write_exclusive_preserves_exact_bytes_and_refuses_overwrite in packages/connectors/eligibility/tests/test_eligibility_artifact.py so zero binary-preservation coverage is lost.
    • Ratcheted packages/flow/scripts/generality_baseline.json strictly downward from 301 to 253 (-48 hits; independent of refactor(flow): generalize Execute seeding, reward bundles, and identity chrome #2486, so both PRs can merge in any order).

Generality Gate

  1. No per-app code in the engine: Yes — openadapt_flow/ no longer ships the Stedi 270/271 vendor client, payer route YAML, or healthcare eligibility waterfall (48 -> 0 stedi hits in openadapt_flow/).
  2. Fix the class, not the instance: Yes — establishes packages/connectors/ as the clean optional connector boundary outside openadapt-flow core, depending only on public openadapt_flow primitives (AuthRef, DocumentHashVerifier, Effect, open_binary).
  3. Held-out evidence: Verified both the extracted connector tests and flow's remaining descriptor and openIMIS eligibility tests independently; live Stedi API tests (3 skipped without STEDI_API_KEY) were not run against production credentials.

Verification

  • python3 scripts/check_engine_generality.py -> Engine generality OK (253 baseline hits left) (down from 301)
  • python3 scripts/check_release_consistency.py -> Release version 3.4.0 is synchronized across project, module, and lock.
  • ruff check & ruff format --check -> clean across all 10 files
  • mypy --follow-imports=silent --ignore-missing-imports packages/connectors/eligibility/openadapt_eligibility/ -> Success: no issues found in 4 source files
  • pytest (packages/connectors/eligibility/tests, packages/flow/tests/test_binary_file_descriptors.py, packages/flow/tests/test_openimis_eligibility.py) -> 140 passed, 3 skipped (live Stedi API tests)

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: b4f77ea

The move itself is a package-boundary extract: the Flow eligibility modules and their tests are retargeted to openadapt_eligibility with import-path changes only, Flow no longer ships payer_routes.yaml or those Stedi baseline hits, and the openIMIS demo stays on deployment SQL rather than the old module. I did not merge.

P1. The new package is not on the monorepo CI path, so the moved fail-closed tests no longer run on this PR. There is no packages/connectors/ (or eligibility) job in packages.yml, no uv.lock, and no workspace/editable install comparable to packages/privacy. Flow unit shards only collect packages/flow/tests/, which this PR emptied of the eligibility tests. Until the connector is locked and a CI job runs those tests on the PR, the extract drops coverage instead of relocating it. test_binary_file_descriptors also dropped the eligibility _write_exclusive case rather than pointing it at the new module.

@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: a32e57c

Delta versus my REQUEST CHANGES at b4f77ea4. I did not merge.

The unique work is CI and lock wiring for the already-moved connector. packages.yml now classifies packages/connectors/eligibility (and Flow/types changes that the connector is tested against), runs an eligibility job with the same pinned checkout/setup-python/setup-uv pattern as the other package jobs, installs from packages/connectors/eligibility/uv.lock with in-tree editable openadapt-flow and openadapt-types, asserts those imports resolve under packages/, then runs ruff check and pytest. packages-gate requires the job when it is selected. The lock records openadapt-eligibility and openadapt-flow as editable path sources. The previous _write_exclusive byte-preservation check now lives in the connector tests, including overwrite refusal.

Residual: openadapt-types is still resolved from PyPI in the lock (0.24.0) even though tool.uv.sources names the in-tree path; CI's --editable packages/types is what pins the job to the tree. This delta does not change the extracted client.

@abrichr
abrichr merged commit 53a9bba into main Nov 21, 2026
59 of 60 checks passed
@abrichr
abrichr deleted the gemini/extract-eligibility-plugin branch November 21, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant