Skip to content

refactor(client): the view DUs of the two order lanes, beside toDeferred - #709

Open
halcwb wants to merge 3 commits into
informedica:masterfrom
halcwb:refactor/706-view-dus
Open

halcwb wants to merge 3 commits into
informedica:masterfrom
halcwb:refactor/706-view-dus

Conversation

@halcwb

@halcwb halcwb commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Step 1 of plan #706 (#707), stacked on it: the view DUs of the two order lanes, next to today's toDeferred, read by nothing yet.

  • OrderContextView = NoPatient | Evaluating | Settled | Changing, OrderPlanView = NoPatient | Opening | Settled of plan * selected | Changing of plan * selected; a selection without a plan cannot be written.
  • OrderContextState.view and OrderPlanState.view project case for case as toDeferred does; the tests mirror the projection tests value for value.
  • OrderPlanView.holds (the prescribe button's rule) and OrderContextView.dialog (the order dialog's context, settled or changing as the plan is) are the two page rules that are more than a match. dialog lives in the context machine file because it compiles after the plan's.
  • A seed shows as Settled for now; that arm goes with Seeded in 646 step 4, after which this branch rebases.

Shared tests 513 green (6 new), Fable compile green, dependency rule green, 201 lines.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K9K57bmde8G9rfreSMKZ6L

halcwb and others added 3 commits September 15, 2026 11:28
The client holds each order lane in a domain tier and a communication
tier that plan 691 named, and a view tier it did not: Deferred, derived
by toDeferred and read only by the pages, with Provisional carrying a
value each lane chooses for itself. The plan names the view tier as a
DU per lane whose cases are the states a page can be in, states the
five tiers of client state and the rule that a command is built in a
Settled arm only, and schedules the Session, Signing and plain-fetch
applications as follow-ups. The code waits for plan 646 step 4.

Refs informedica#706

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9K57bmde8G9rfreSMKZ6L
Review on informedica#707: the branch was cut from the fork's master, before plan
646 merged, so its tree lacked the prerequisite; rebased onto upstream
master. Step 7 now says that every caller of Deferred.inProgress reads a
lane and no plain fetch does, so deleting it leaves nothing to migrate.

Refs informedica#706

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9K57bmde8G9rfreSMKZ6L
Each lane gets the DU the pages will read: the states a page can be in,
each with what is valid in it and nothing of the request. The workbench:
no patient, evaluating, settled, changing with the context sent shown
meanwhile. The plan: no patient, opening, settled and changing with the
dialog's selection inside them, so a selection without a plan cannot be
written. `view` in both machines projects to them, case for case as
`toDeferred` does today; `holds` and `dialog` are the two page rules that
are more than a match. Nothing reads them yet.

A seed shows as settled for now; the arm goes with the seed state (informedica#646).

Refs informedica#706

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9K57bmde8G9rfreSMKZ6L
@halcwb
halcwb marked this pull request as ready for review September 15, 2026 09:33
@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

This PR appears safe to merge.

What we checked:

  • Machine file order: OrderPlanMachine.fs compiles first in both projects, and it does not refer back to OrderContextMachine. The new dependency is one-way and follows F# file order.
  • View projection parity: Both view functions match the same state pairs and choose the same payloads as toDeferred. The added tests cover no patient, first load, settled data, and an active change.

Summary

The client now gives each order lane explicit page-ready view states instead of making pages interpret Deferred values. The new views keep the current screen visible during changes and add rules for the plan button and order dialog.

Diagram

sequenceDiagram
    participant U as Clinician
    participant P as Current page
    participant M as Order lane machine
    participant A as Server API
    participant T as Projection tests

    U->>P: Change an order or plan
    P->>M: Send command with request id
    M->>M: Keep held value and store request
    M->>A: Send command effect
    P->>M: Read toDeferred
    M-->>P: Provisional visible value
    T->>M: Read new view
    M-->>T: Changing visible value
    A-->>M: Return matching answer
    M->>M: Store answer and clear request
    P->>M: Read toDeferred
    M-->>P: Resolved held value
    T->>M: Read new view
    M-->>T: Settled held value

    alt No patient
        T->>M: Read new view
        M-->>T: NoPatient
    else First request has no held value
        T->>M: Read new view
        M-->>T: Evaluating or Opening
    end
Loading

Reviews (1) · Last reviewed commit: "refactor(client): the view DUs of the tw..."

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