Repository navigation
fix(flow4d): Phase D post-review hardening - #117
Merged
Merged
Conversation
Follows the independent review of PR #115 (no CRITICAL/HIGH; PHI-opaqueness, dark-serving inertness, append-only reads all confirmed). - PatientJourneyService: cast Carbon 3's float diffInMinutes to int before intdiv (was E_DEPRECATED lossy float→int per demo journey-open, TypeError under PHP 9); cache the designated-demo-encounter lookup 60s (was an unindexed ORDER BY admitted_at scan per journey request while the demo flag is on). - PathwayInstanceReadService: select only the 3 columns used from patient_experience.pathway_instances (the table also carries an encrypted source-identity column — never pull it into memory). - ReferenceModelCompiler: dedup duplicate stable_keys in the public compile() (first occurrence wins; compileVersion already relies on the DB unique key). - Tests: fractional-timestamp LOS regression with an E_DEPRECATED trap (PHPUnit here isn't set to fail on deprecations), null-encounter-id short-circuit, duplicate-stable_key dedup. 116 CarePathways+PatientFlow green; Pint clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Post-merge hardening of Phase D (#115) after an independent code review. The review found no CRITICAL/HIGH issues and confirmed PHI-opaqueness, dark-serving inertness, and append-only read discipline all hold. These four items are the actionable follow-ups; the feature still ships dark and this PR changes no prod flags.
intdiv(float)in the LOS calc (PatientJourneyService) — Carbon 3'sdiffInMinutes()returns afloat; the rawintdiv(max(0, $diff), 1440)logged anE_DEPRECATED(implicit lossy float→int) on every demo journey-open and wouldTypeErrorunder PHP 9. Now casts tointfirst.isDesignatedDemoEncounterper-request scan (PatientJourneyService) — theORDER BY admitted_at LIMIT 1ran on every journey request while the demo flag is on, with no supporting index. Cached 60 s (the designated patient changes at most once per demo refresh).PathwayInstanceReadService) — thepathway_instancesread now selects only the 3 columns it uses; the table also carries an encrypted source-identity column that should never be pulled into memory.stable_keyguard (ReferenceModelCompiler) —compileVersion()relies on the DB unique constraint, but the publiccompile()did not; a duplicate key could double an activity. First occurrence now wins.Documented as limitations (not bugs), unchanged: the narrow client stale-payload window on a just-flipped flag (dark feature only), and stage-level progress (v1 is milestone-level).
Test plan
E_DEPRECATEDtrap (PHPUnit here isn't configured to fail on deprecations, so the trap is explicit),progressForEncounterId(null)short-circuit, duplicate-stable_keydedup.🤖 Generated with Claude Code