Repository navigation
fix(game): harden Plant Operator limits and validation - #130
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 779cca0198
ℹ️ 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".
779cca0 to
7e0e572
Compare
7e0e572 to
92de037
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The JAVA_TOOL_OPTIONS guard can skip adding the required NeqSim --add-opens flags when unrelated --add-opens options already exist, which can break the intended JVM hardening behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens the NeqSim Plant Operator game contract by tightening the winning operating window (power/cooling), strengthening native-validation gating, normalizing timeout input handling, and updating both regression tests and published documentation accordingly.
Changes:
- Tighten win limits to < 4,200 kW total compressor power and < 5,500 kW total cooling duty (plus associated score calibration and UI/docs text).
- Treat native validation states other than OK/WARN as violations that block a win, and normalize invalid
timeout_msinputs to the documentedValueError. - Preserve existing
JAVA_TOOL_OPTIONSwhen adding NeqSim JVM opens; add regression coverage for the above behaviors.
File summaries
| File | Description |
|---|---|
| tests/test_plant_operator_page.py | Asserts JAVA_TOOL_OPTIONS preservation logic is present in the Streamlit page source. |
| tests/test_plant_operator_game.py | Adds regression tests for strict limits, timeout normalization, and UNKNOWN native status blocking wins. |
| process_chat/plant_operator_game.py | Updates limits, makes native validation stricter, adjusts score calibration, and hardens timeout parsing. |
| pages/36_NeqSim_Plant_Operator.py | Updates JAVA_TOOL_OPTIONS handling and mission-card text to match the stricter contract. |
| docs/neqsim_plant_operator_game.md | Updates the published game contract text to reflect strict limits and native validation requirements. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
92de037 to
c5a093f
Compare
c5a093f to
29f7ab5
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new strict “<” limits and timeout validation introduce user-facing edge cases (rounded display can contradict strict thresholds; float timeouts can be silently truncated) that should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
process_chat/plant_operator_game.py:375
- Cooling-duty check is now strict (<), but the displayed actual value is rounded to 0 decimals. This can display "5,500 kW" while still passing (e.g., 5499.6), which conflicts with the "less than 5,500 kW" requirement; show at least one decimal place (or more) for the actual kW value.
evidence.total_cooling_duty_kw < MAX_COOLING_DUTY_KW,
f"{evidence.total_cooling_duty_kw:,.0f} kW",
f"less than {MAX_COOLING_DUTY_KW:,.0f} kW",
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
29f7ab5 to
e616a8b
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The tightened contract and validation behavior are consistently implemented across code, UI/docs, tests, and CI with focused regressions covering the key edge cases introduced.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
Summary
Follow-up to #129, which merged while its automated review was still completing.
JAVA_TOOL_OPTIONSand reconcile every required NeqSim JVM opening tokenValueErrorUNKNOWNand unrecognized native validation states block a game winNative difficulty calibration
A NeqSim sweep across interstage pressure and intercooler temperature confirmed a narrower but feasible operating window.
Both native cases completed with no failed or unavailable NeqSim constraints.
Native conservation fix
The failing clone/replay benchmark was caused by Studio's reflection-based ZIP/XML loader taking precedence over NeqSim's native archive loader. Reflection deserialization bypassed NeqSim
readObjecthooks and left transientSystemThermo.phaseArraystate uninitialized.The adapter now:
No conservation threshold or assertion was weakened.
Validation
PYTHONPATH=. .venv/bin/python tests/test_process_graph_conservation.py -v— 114 passedPYTHONPATH=. .venv/bin/python tests/test_process_execution.py -v— 18 passedPYTHONPATH=. .venv/bin/python tests/test_plant_operator_game.py -v— 7 passedPYTHONPATH=. .venv/bin/python tests/test_plant_operator_page.py -v— 5 passedgit diff --check— passedDocumentation impact: none — this is an internal deserialization-order correction; the user-facing game contract and limits are unchanged.
Review provenance
Addresses and resolves all Copilot and Codex comments raised during #129/#130 review.