Skip to content

Add shared NeqSim Studio case lifecycle - #94

Merged
EvenSol merged 5 commits into
automation/web-studio-shell-20260809from
automation/web-studio-case-context-20260810
Aug 10, 2026
Merged

Add shared NeqSim Studio case lifecycle#94
EvenSol merged 5 commits into
automation/web-studio-shell-20260809from
automation/web-studio-case-context-20260810

Conversation

@EvenSol

@EvenSol EvenSol commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Advances S2 — Shared case context and lifecycle as a stacked child of #93.

This tranche adds a real case workspace across the new Studio home and the inherited Process Flowsheet Studio:

  • New Case, Open, Download, Save As, Reset and session-local Recent Cases
  • one UI-independent active-case context spanning Studio pages
  • stable in-session case identity, schema/version, explicit units, thermodynamic package summary and provenance
  • explicit draft/dirty/solved/warning/failed/timed-out/invalid lifecycle state
  • native model availability and solved signature without serializing Java/Python objects into UI metadata
  • one-shot cross-page handoff into the existing validated importer and schema-v4 flowsheet implementation
  • direct return from Process Flowsheet Studio to Studio home

Stacked PR contract

  • Parent PR: Introduce NeqSim Studio alongside Classic #93
  • Parent branch: automation/web-studio-shell-20260809
  • Exact base SHA: 4e2db28de200a335ca1f9cd34d994c51236e512d
  • This PR base: automation/web-studio-shell-20260809
  • This PR head: automation/web-studio-case-context-20260810

This PR is not independently mergeable to main. PR #93 must merge first; this PR must then be safely retargeted/revalidated.

Compatibility boundary

Classic remains unchanged. The shared lifecycle uses Studio-only session keys and has a regression proving unrelated Classic state survives reset.

The existing Process Flowsheet Studio JSON remains the authoritative portable format:

  • no parallel case schema
  • no context wrapper added to downloads
  • existing schema-v1–v4 detailed import/migration remains authoritative
  • invalid uploads do not replace the active case before detailed validation succeeds
  • existing graph draft, native solve, workbook, .neqsim and Process Chat handoff are reused

Validation before publication

Exact head: 73233f9c25854b5d8a992b93fd3f6f7439c894b1

Passed locally:

  • Python compilation of all changed Python sources
  • PYTHONPATH=. python tests/test_studio_case_context.py -v — 13/13
  • PYTHONPATH=. python tests/test_studio_navigation.py -v — 5/5
  • PYTHONPATH=. python tests/test_flowsheet_editor.py -v — 120/120

Hosted GitHub Actions Process Flowsheet Studio #385, run 31342601214, completed successfully on the exact head. All steps passed: compilation; 13 shared lifecycle tests; Studio navigation and shell AppTest; repeated Classic + Studio HTTP/health probes; deployment-safe and warm-JVM imports; graph editor; named streams; solver diagnostics; subflowsheets; native multi-inlet conservation; and bounded execution.

Three-repository evidence

  • equinor/neqsim master at db5b98b3 contains the merged canonical diagram-topology increments through #2916. No core change is required for S2.
  • #1332 and #2899 remain the owners of professional PFD/P&ID/DEXPI semantics; this PR adds no diagram engine.
  • EvenSol/NeqSim-Colab master at 7cb7e5d4 and the executed DEXPI safety-study acceptance workflow were reviewed. S2 changes UI/session lifecycle only, so no notebook change is justified.

Documentation impact

Updates docs/neqsim_web_studio_roadmap.md and records S2 as in stack, not merged completion. No Classic documentation or calculation behavior changes.

Next dependency-ready tranche

After S2 is stack-ready, integrate the inherited flowsheet workbook/results/design/study surfaces behind the active case context (S3/S4) without rewriting their calculation logic.

@EvenSol
EvenSol marked this pull request as ready for review August 10, 2026 05:18
@EvenSol
EvenSol merged commit 1c3f524 into automation/web-studio-shell-20260809 Aug 10, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd0fad862b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pages/90_Process_Chat.py
Comment on lines +2545 to +2549
if (
model_built is not None
and session.model is not None
and not runtime_model_replaced
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mark property-only scenarios as runtime changes

When a what-if changes only equipment properties, _handle_scenario persists the patch by mutating session.model in place but sets _last_model_built only for structural changes. Consequently the model identity is unchanged and model_built is None, so this condition skips mark_active_runtime_changed; the active portable case remains labeled solved even though its live model now has different pressures, efficiencies, or other inputs. Use an explicit successful-mutation signal, such as the scenario comparison/persistence result, rather than model_built as the change detector.

Useful? React with 👍 / 👎.

Comment on lines +6825 to +6826
if solver_status == "Solved":
context_status = STATUS_WARNING if draft_warnings else STATUS_SOLVED

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve dirty state when returning from Process Chat

After Process Chat marks a case dirty because it mutated or replaced the runtime model, navigating directly back to this page leaves the stored flowsheet signature and result flag unchanged. _solver_status therefore returns Solved from the old input signature, and these lines immediately overwrite the dirty context as solved even though the stored model object may contain Chat changes—or may have been detached by Reset All. The solved classification needs to account for the active context's runtime divergence or Chat must invalidate the stored flowsheet result.

Useful? React with 👍 / 👎.

Comment thread pages/90_Process_Chat.py
Comment on lines +2474 to +2476
# Refresh whitelisted lifecycle/units/provenance evidence. The
# portable case specification is intentionally not forwarded.
session.set_studio_case_context(_studio_case)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detach the case when sidebar actions replace the model

With an active solved Studio case, the sidebar's upload, Start New Process, Load Test Process, and DEXPI actions can replace or remove process_model without calling either lifecycle helper. The next message still forwards _studio_case here as solved evidence, so the prompt associates the active case's lifecycle and thermodynamics with an unrelated model or builder session. Mark the case dirty/detached in every sidebar model lifecycle path, or omit its evidence when the live model no longer corresponds to it.

Useful? React with 👍 / 👎.

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