Skip to content

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

Merged
EvenSol merged 5 commits into
mainfrom
feat/phase-equilibrium-game
Aug 30, 2026
Merged

EvenSol merged 5 commits into
mainfrom
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
  • aggregate card-count and serialized-size limits are enforced before custom deck state is changed or exported

Review follow-up

This incorporates the two findings from the review of #131:

  • reject a 101st custom card before mutating Streamlit session state
  • reject JSON exports larger than the same 100 kB limit used by the importer
  • reject compact imports whose canonical downloadable representation exceeds 100 kB

Validation

  • affected Python compilation — passed
  • NeqSim game suite — 37 passed
    • Plant Operator engine: 7
    • Plant Operator page: 5
    • Phase engine/native calibration: 6
    • flashcard engine: 6
    • 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
  • prerequisite PR fix(game): harden Plant Operator limits and validation #130 — fully green and merged, 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.

Context

#131 was merged into its already-merged staging base branch. This PR targets main directly and is the final integration PR for the games feature plus its review fixes.

@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-30T15:05:42.362890Z 8cb9273 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.

EvenSol commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review the final main integration, including the aggregate 100-card validation and the symmetric 100 kB JSON import/export bound added after the #131 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: 75a9d8c4d6

ℹ️ 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 process_chat/flashcard_game.py Resolved

EvenSol commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

The compact-import/canonical-export size mismatch is fixed in 8cb9273, with a boundary regression. Please re-review the updated head.

@EvenSol
EvenSol merged commit 2fd65d2 into main Aug 30, 2026
3 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 8cb9273466

ℹ️ 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".

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