Skip to content

feat(games): add phase equilibrium lab and flashcards - #131

Merged
EvenSol merged 3 commits into
fix/plant-operator-review-findingsfrom
feat/phase-equilibrium-game
Aug 30, 2026
Merged

EvenSol merged 3 commits into
fix/plant-operator-review-findingsfrom
feat/phase-equilibrium-game

Conversation

@EvenSol

@EvenSol EvenSol commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a shared NeqSim Games Studio destination and two new learning capabilities:

  • Phase Equilibrium Lab — Catch the Retrograde Window
    • native SRK TP flashes with mixing rule 2 and multiphase stability enabled
    • player controls temperature and absolute pressure
    • score requires gas + hydrocarbon liquid, condensate split, gas density, gas Z, liquid density, liquid viscosity, and phase-fraction closure
    • publishes phase compositions, component K-values, mixture properties, check evidence, and downloadable JSON
  • Reusable flashcard games
    • built-in phase-equilibrium and fluid-properties deck
    • answer reveal, self-check, progress, and mastery score
    • custom card/deck builder with immediate play
    • bounded, versioned JSON import/export with schema validation
  • one Games hub containing Plant Operator, Phase Equilibrium Lab, and flashcards
  • Games hub becomes the single Studio training destination; both calculated game pages remain directly testable and HTTP-probed

Native calibration

A native grid sweep confirmed a constrained feasible region rather than a hard-coded answer.

Case Liquid Gas density Gas Z Liquid density Liquid viscosity Outcome
50 °C, 80 bara 16.93 mol% 79.45 kg/m³ 0.8186 499.52 kg/m³ 0.1051 cP 1000/1000, wins
20 °C, 50 bara 19.81 mol% 48.29 kg/m³ 0.8525 554.65 kg/m³ 0.1489 cP fails four property targets

The winning region was observed around roughly 40–56 °C and 78–90 bara at the tested resolution. Missing or non-finite native evidence cannot pass a check.

Flashcard contract

  • 12-card built-in phase/property deck
  • difficulty levels: foundation, applied, advanced
  • custom decks: maximum 100 cards and 100 kB JSON
  • unique IDs, required text, known schema version, and known difficulty are enforced
  • unknown score IDs and non-boolean marks are rejected
  • custom prompts are HTML-escaped before entering the styled card surface

Validation

  • affected Python compilation — passed
  • NeqSim game suite — 35 passed
    • Plant Operator engine: 7
    • Plant Operator page: 5
    • Phase engine/native calibration: 6
    • flashcard engine: 4
    • Games/Phase pages including a native winning AppTest: 6
    • Studio navigation: 7
  • Streamlit HTTP health — 10 routes passed
  • Studio shell — 4 passed
  • git diff --check — passed
  • base PR fix(game): harden Plant Operator limits and validation #130 — Process Flowsheet Studio workflow fully green, including 114 native conservation benchmarks, browser profile, and full pilot

Documentation impact

Updated the README and Plant Operator documentation, and added docs/neqsim_games.md with the native fluid, target bands, score weights, evidence model, flashcard schema, limits, and execution boundaries.

Dependency

This PR is intentionally stacked on #130 so it includes the stricter Plant Operator limits and the native deserialization fix. Retarget it to main after #130 merges.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T14:56:48.430898Z 8fa5f79 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 8fa5f798c1

ℹ️ 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/34_NeqSim_Games.py Resolved
Comment thread process_chat/flashcard_game.py Resolved
@EvenSol
EvenSol merged commit 49b8672 into fix/plant-operator-review-findings Aug 30, 2026
3 checks passed

EvenSol commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Both P2 findings are fixed in 75a9d8c with aggregate card-count validation, symmetric 100 kB export/import enforcement, and regressions.

@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: 49b8672c93

ℹ️ 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 on lines +142 to +143
except json.JSONDecodeError as exc:
raise ValueError("Flashcard deck contains invalid JSON.") from exc

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 Catch recursion failures while parsing uploaded JSON

A deeply nested but size-compliant upload (for example, 10,000 nested arrays totaling about 20 kB) makes json.loads raise RecursionError, which this handler does not convert to ValueError. Because the Games page only catches ValueError around deck_from_json, clicking import then produces an uncaught Streamlit page exception instead of the promised validation error; catch decoder recursion failures here as invalid deck JSON.

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