feat(modapi): flags.evaluate, enumValue and enumValues: the game's BoolExp flags and enum values by name #3204

Merged
HumanBean merged 3 commits from ChloeNow/Longshot:feat/modapi-flag-exp-main into main 2026-12-05 17:47:44 +00:00
Member

feat(modapi): flags.evaluate, enumValue and enumValues: the game's BoolExp flags and enum values by name

Summary

Part of #2783 (Ocarina Forge, from glinesbdev): the reads a mod needs to follow the game's own checks.

  • flags.evaluate(name): one of the game's BoolExp flags worked out now (SageOfForest_IsCompleted_Exp). A
    BoolExp is never stored: it is a rule over other flags that the game's checks ask (the flows through
    GameDataActor's EventQueryIsGameDataBoolExp, 692 steps in the game's flows). flags.get cannot read them. Null
    when it cannot be answered (the flags not made yet, or a BoolArray it reads).
  • flags.enumValue(name) and flags.enumValues(name): an Enum flag's value by its name, and all its values'
    names in the game's order. A challenge's step is the Enum Step_<ChallengeName> (Step_SageOfForest: NotReady,
    Ready, Step01, ..., Complete); get only gives the value's hash.

How it works:

  • The rules come from the player's own game: its GameData/GameDataList.Product.<n>.byml.zs (the loader's rule,
    the last by name), read once on a thread of its own as the game starts and kept (api::services::flag_exps); until
    it is read, the answers are null (enumValues empty). Decoding it takes about 11 ms, more than a listener's 5 ms
    budget, so it is never read on a mod's call. No game data in the repository.
  • The interpreter (game_core::flag_exp, pure) runs a rule's postfix steps over a stack of answers, reading flags
    as flags.get does. The opcodes were read off the table's shape and the entries the game's flows name (the doc
    comment has the table): 0 Bool, 10 nested BoolExp, 1 / 11 / 12 Enum ==, before, after a value (strictly), 15 / 18 / 19
    Int ==, <, != a number, 3 and, 4 or, 5 not. An opcode the table never uses, and BoolArray reads (7 entries), answer
    null rather than a guess.
  • The fake game: game.setGameDataList({ enums, boolExps }) puts a small list in the fake RomFS; setFlag(name, "Step01", { kind: "enum" }) sets an Enum flag by its value's name.
  • Docs: docs/modding/scripting.md ("The game's checks"), the generated reference.

Read first: game/crates/game-core/src/flag_exp.rs.

Testing

Tested: Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU.

  • game-core flag_exp::tests (new, 3): enums compared in the game's order (==, strictly after, a before-and-not-after
    range), Bool / Int / nested rules, and every case that answers null (no such rule, a flag not read, a BoolArray, a
    loop, a malformed rule, an unknown opcode).
  • api flag_exps::tests::the_players_list_is_read_and_kept (new): a GameDataList written with content::byml into
    the fake RomFS is found (the last by name), read and kept.
  • modtool testing_game::tests::boolexp_flags_and_enum_values_by_name (new): a mod's evaluate and enumValue in
    the fake game follow setFlag.
  • In game (dev.py game-tests, a test mod on the kokiri-start save; passed): the list read on its own thread, no
    listener over its budget; in play Step_SageOfForest reads Ready with its 16 values in the game's order, and
    SageOfForest_IsCompleted_Exp, DoorOfTime_IsAfter_Step03_Exp and MiniGame_DampeRace_IsClearLeastOnce evaluate
    false, as the save's flags say.
  • Played, with #3203 and the screen fade (a playtest mod comparing evaluate with each EventQueryIsGameDataBoolExp
    answer the flows give: the query's answer is its branch, 0 yes): the Kokiri shopkeeper (3 checks), the
    target-shooting minigame (4: two Bool rules, MiniGame_HitTarget_IsAfter_Ready_Exp at exactly Ready, and
    _IsAfter_Retry_Exp), and the earlier sages' checks: every answer the game's, yes and no. The minigame first showed
    evaluate true where the game said no: opcode 12 is strictly after, not at or after (fixed in cd42f0f8f). In the
    playtest's flags page, Step_SageOfForest and Step_SageOfShadow read Complete with their 16 and 11 values, and
    the rules over them answer as the steps say.

Still to test:

  • Linux: mise run test (CI).

Measurements

Nothing to measure: the list is read once (about 1.4 MB decoded) on its own thread at start, off the frame; an evaluation is a few
flag reads.

Risks

An opcode read wrong would give a wrong answer for the rules that use it; the in-game check compares every BoolExp
the flows ask against the game's own answer. Unknown opcodes answer null.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head.

🤖 Generated with Claude Code

feat(modapi): flags.evaluate, enumValue and enumValues: the game's BoolExp flags and enum values by name ## Summary Part of #2783 (Ocarina Forge, from glinesbdev): the reads a mod needs to follow the game's own checks. - **`flags.evaluate(name)`**: one of the game's BoolExp flags worked out now (`SageOfForest_IsCompleted_Exp`). A BoolExp is never stored: it is a rule over other flags that the game's checks ask (the flows through `GameDataActor`'s `EventQueryIsGameDataBoolExp`, 692 steps in the game's flows). `flags.get` cannot read them. Null when it cannot be answered (the flags not made yet, or a BoolArray it reads). - **`flags.enumValue(name)`** and **`flags.enumValues(name)`**: an Enum flag's value by its name, and all its values' names in the game's order. A challenge's step is the Enum `Step_<ChallengeName>` (`Step_SageOfForest`: `NotReady`, `Ready`, `Step01`, ..., `Complete`); `get` only gives the value's hash. How it works: - **The rules come from the player's own game**: its `GameData/GameDataList.Product.<n>.byml.zs` (the loader's rule, the last by name), read once on a thread of its own as the game starts and kept (`api::services::flag_exps`); until it is read, the answers are null (`enumValues` empty). Decoding it takes about 11 ms, more than a listener's 5 ms budget, so it is never read on a mod's call. No game data in the repository. - **The interpreter** (`game_core::flag_exp`, pure) runs a rule's postfix steps over a stack of answers, reading flags as `flags.get` does. The opcodes were read off the table's shape and the entries the game's flows name (the doc comment has the table): 0 Bool, 10 nested BoolExp, 1 / 11 / 12 Enum ==, before, after a value (strictly), 15 / 18 / 19 Int ==, <, != a number, 3 and, 4 or, 5 not. An opcode the table never uses, and BoolArray reads (7 entries), answer null rather than a guess. - **The fake game**: `game.setGameDataList({ enums, boolExps })` puts a small list in the fake RomFS; `setFlag(name, "Step01", { kind: "enum" })` sets an Enum flag by its value's name. - **Docs**: `docs/modding/scripting.md` ("The game's checks"), the generated reference. Read first: `game/crates/game-core/src/flag_exp.rs`. ## Testing **Tested:** Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU. - `game-core` `flag_exp::tests` (new, 3): enums compared in the game's order (==, strictly after, a before-and-not-after range), Bool / Int / nested rules, and every case that answers null (no such rule, a flag not read, a BoolArray, a loop, a malformed rule, an unknown opcode). - `api` `flag_exps::tests::the_players_list_is_read_and_kept` (new): a GameDataList written with `content::byml` into the fake RomFS is found (the last by name), read and kept. - `modtool` `testing_game::tests::boolexp_flags_and_enum_values_by_name` (new): a mod's `evaluate` and `enumValue` in the fake game follow `setFlag`. - In game (`dev.py game-tests`, a test mod on the `kokiri-start` save; passed): the list read on its own thread, no listener over its budget; in play `Step_SageOfForest` reads `Ready` with its 16 values in the game's order, and `SageOfForest_IsCompleted_Exp`, `DoorOfTime_IsAfter_Step03_Exp` and `MiniGame_DampeRace_IsClearLeastOnce` evaluate `false`, as the save's flags say. - Played, with #3203 and the screen fade (a playtest mod comparing `evaluate` with each `EventQueryIsGameDataBoolExp` answer the flows give: the query's answer is its branch, 0 yes): the Kokiri shopkeeper (3 checks), the target-shooting minigame (4: two Bool rules, `MiniGame_HitTarget_IsAfter_Ready_Exp` at exactly Ready, and `_IsAfter_Retry_Exp`), and the earlier sages' checks: every answer the game's, yes and no. The minigame first showed `evaluate` true where the game said no: opcode 12 is strictly after, not at or after (fixed in cd42f0f8f). In the playtest's flags page, `Step_SageOfForest` and `Step_SageOfShadow` read `Complete` with their 16 and 11 values, and the rules over them answer as the steps say. **Still to test:** - Linux: `mise run test` (CI). ## Measurements Nothing to measure: the list is read once (about 1.4 MB decoded) on its own thread at start, off the frame; an evaluation is a few flag reads. ## Risks An opcode read wrong would give a wrong answer for the rules that use it; the in-game check compares every BoolExp the flows ask against the game's own answer. Unknown opcodes answer null. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). <!-- the new tests run; the whole suite not yet --> - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(modapi): flags.evaluate, enumValue and enumValues: the game's BoolExp flags and enum values by name
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
e30c81d275
Part of #2783. The rules come from the player's own GameDataList, read once on
a thread of its own at start (null until then). game_core::flag_exp runs a
BoolExp's postfix steps; unknown opcodes and BoolArray reads answer null.
Fake game: setGameDataList, setFlag with an enum value's name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, RTX 4060 Laptop GPU: dev.py game-tests with a test mod on the kokiri-start save (passed). The GameDataList read on its own thread, no listener over budget; Step_SageOfForest reads Ready with its 16 values in order; SageOfForest_IsCompleted_Exp, DoorOfTime_IsAfter_Step03_Exp and MiniGame_DampeRace_IsClearLeastOnce evaluate false, as the save says. Not yet compared against a BoolExp a flow asks in play (the load asks none).

Tested in game: Windows 11, RTX 4060 Laptop GPU: dev.py game-tests with a test mod on the kokiri-start save (passed). The GameDataList read on its own thread, no listener over budget; Step_SageOfForest reads Ready with its 16 values in order; SageOfForest_IsCompleted_Exp, DoorOfTime_IsAfter_Step03_Exp and MiniGame_DampeRace_IsClearLeastOnce evaluate false, as the save says. Not yet compared against a BoolExp a flow asks in play (the load asks none).
Owner
@review
BeanBot requested changes 2026-12-04 21:20:11 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The fake game can return another test’s cached flag rules when two lists have the same path and size. The interpreter’s comparison with the game’s own BoolExp answers also remains to be run.

Adds named BoolExp evaluation and enum reads for mods, backed by a list loaded from the player’s game. It also adds fake-game support, but its cache can make tests exercise stale rules.

Blocking (1): must change before merging.

  1. L1 game/crates/api/src/services/flag_exps.rs:99: The fake-game cache identifies a list only by path and byte length, although fake RomFS contents belong to each test thread and can be replaced with different bytes of the same length. (more on the line) Do: Keep the fake cache with the fake RomFS instance and invalidate it on replacement or reset, or key it by the list’s actual contents.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 game/crates/game-core/src/flag_exp.rs:8: The opcode meanings have not yet been compared with the answers the game gives during a flow. (more on the line) Do: Run the comparison mod during gameplay that asks BoolExp queries, covering the supported opcode families and both true and false results, and report the game’s answers against evaluate.

@fix can do L1.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven for BoolExp evaluation: the reported Windows run read enum names and returned plausible answers for three expressions, but no result was compared with a game flow’s answer. This is not a performance change.

Other systems: The loader runs at startup even without a mod using these functions, on Windows and Linux. The reported run covers Windows on NVIDIA; Linux and the comparison with live game queries remain untested. The fake RomFS is per-thread, while the new cache is process-wide.

Switches: None.

Reviewed: e30c81d275 against 18edd5097e: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the full diff, the new flag expression files, game-core watch code, host RomFS wrapper and zstd implementation, and fake-game content setup. Skimmed the remaining changed files and generated documentation; not every changed code file was read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance.
  • No switches, renderer API changes, third-party changes, or compiled outputs appear in the diff.
  • The reported Windows game run confirms that the list loads and enum names are available on that setup.

Testing: No commands that build, run tests, or execute project code were run. CI is still running; the author reports game-free tests and a Windows game run.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The fake game can return another test’s cached flag rules when two lists have the same path and size. The interpreter’s comparison with the game’s own BoolExp answers also remains to be run. Adds named BoolExp evaluation and enum reads for mods, backed by a list loaded from the player’s game. It also adds fake-game support, but its cache can make tests exercise stale rules. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/api/src/services/flag_exps.rs:99`: The fake-game cache identifies a list only by path and byte length, although fake RomFS contents belong to each test thread and can be replaced with different bytes of the same length. (more on the line) **Do:** Keep the fake cache with the fake RomFS instance and invalidate it on replacement or reset, or key it by the list’s actual contents. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `game/crates/game-core/src/flag_exp.rs:8`: The opcode meanings have not yet been compared with the answers the game gives during a flow. (more on the line) **Do:** Run the comparison mod during gameplay that asks BoolExp queries, covering the supported opcode families and both true and false results, and report the game’s answers against evaluate. `@fix` can do L1. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven for BoolExp evaluation: the reported Windows run read enum names and returned plausible answers for three expressions, but no result was compared with a game flow’s answer. This is not a performance change. **Other systems:** The loader runs at startup even without a mod using these functions, on Windows and Linux. The reported run covers Windows on NVIDIA; Linux and the comparison with live game queries remain untested. The fake RomFS is per-thread, while the new cache is process-wide. **Switches:** None. **Reviewed:** e30c81d275fc against 18edd5097e36: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the full diff, the new flag expression files, game-core watch code, host RomFS wrapper and zstd implementation, and fake-game content setup. Skimmed the remaining changed files and generated documentation; not every changed code file was read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance. - No switches, renderer API changes, third-party changes, or compiled outputs appear in the diff. - The reported Windows game run confirms that the list loads and enum names are available on that setup. **Testing:** No commands that build, run tests, or execute project code were run. CI is still running; the author reports game-free tests and a Windows game run. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +96,4 @@
}
let Some(path) = list_path() else { return Lookup::Missing };
let Some(size) = host_sys::romfs::stat(&path) else { return Lookup::Missing };
if let Some((p, s, t)) = KEPT.lock().unwrap_or_else(PoisonError::into_inner).as_ref()
Member

L1 (blocking): The fake-game cache identifies a list only by path and byte length, although fake RomFS contents belong to each test thread and can be replaced with different bytes of the same length.

When: Two tests, or two calls to setGameDataList, install different same-sized lists at GameDataList.Product.0.byml.zs. The second lookup reuses the first table, so enum names and expression results come from the wrong test or earlier list.

Do: Keep the fake cache with the fake RomFS instance and invalidate it on replacement or reset, or key it by the list’s actual contents.

**L1** (blocking): The fake-game cache identifies a list only by path and byte length, although fake RomFS contents belong to each test thread and can be replaced with different bytes of the same length. *When:* Two tests, or two calls to setGameDataList, install different same-sized lists at GameDataList.Product.0.byml.zs. The second lookup reuses the first table, so enum names and expression results come from the wrong test or earlier list. **Do:** Keep the fake cache with the fake RomFS instance and invalidate it on replacement or reset, or key it by the list’s actual contents.
@ -0,0 +5,4 @@
//! callback, so it is tested without the game.
//!
//! **A rule** is postfix over a stack of yes/no: each entry an opcode and its operands (a flag's hash, then a value).
//! Read off the table's shape and its named entries (2026-12, build e0f3ccfa):
Member

L2 (should fix): The opcode meanings have not yet been compared with the answers the game gives during a flow.

When: A mod relies on an expression using an inferred comparison or logical opcode; an incorrect interpretation would return a definite but wrong answer. The reported load encountered no BoolExp queries to compare.

Do: Run the comparison mod during gameplay that asks BoolExp queries, covering the supported opcode families and both true and false results, and report the game’s answers against evaluate.

**L2** (should fix): The opcode meanings have not yet been compared with the answers the game gives during a flow. *When:* A mod relies on an expression using an inferred comparison or logical opcode; an incorrect interpretation would return a definite but wrong answer. The reported load encountered no BoolExp queries to compare. **Do:** Run the comparison mod during gameplay that asks BoolExp queries, covering the supported opcode families and both true and false results, and report the game’s answers against evaluate.
fix(modapi): a BoolExp's "after" is strictly after
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
cd42f0f8f6
Opcode 12 compared an enum flag at or after a value; the game's own
answer is strictly after: in a playtest, MiniGame_HitTarget_IsAfter_Ready_Exp
was "no" in game with the challenge rolled back to Ready, and
flags.evaluate said true. Now `>`, as the game answers, with the docs
that said "at or after".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Pushed cd42f0f8f: a BoolExp's "after" (opcode 12) is strictly after. In a playtest, MiniGame_HitTarget_IsAfter_Ready_Exp was no in game at exactly Ready while evaluate said true; now it agrees, as every other live check did (yes and no). Docs that said "at or after" fixed. Testing updated with the played results.

Pushed cd42f0f8f: a BoolExp's "after" (opcode 12) is strictly after. In a playtest, MiniGame_HitTarget_IsAfter_Ready_Exp was no in game at exactly Ready while evaluate said true; now it agrees, as every other live check did (yes and no). Docs that said "at or after" fixed. Testing updated with the played results.
Owner
@rebase
Member

I rebased this pull request onto main (37f90245b0): the new head is 4481223f81.

Conflicts resolved

  • docs/modding/permissions.md: Kept both sides and updated the combined schema hash.
  • docs/modding/reference.md: Kept both sides and updated the combined schema hash.
  • docs/modding/scripting.md: Kept both sides and updated the abbreviated schema hash.

Nothing was built or run: read the resolution before merging.


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I rebased this pull request onto `main` (37f90245b0d1): the new head is 4481223f816b. **Conflicts resolved** - docs/modding/permissions.md: Kept both sides and updated the combined schema hash. - docs/modding/reference.md: Kept both sides and updated the combined schema hash. - docs/modding/scripting.md: Kept both sides and updated the abbreviated schema hash. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed feat/modapi-flag-exp-main from cd42f0f8f6
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 4481223f81
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-05 17:43:41 +00:00
Compare
BeanBot left a comment

Recommendation: Request changes. The fake-game cache can return another test's rules or stale rules after a same-size replacement. The reported playtest addresses the earlier request to compare expression answers with the game.

Adds named BoolExp evaluation and enum reads for mods, with a background list load and fake-game support. It gives mods access to game checks at the cost of a retained decoded table and added interpreter code.

Blocking (1): must change before merging.

  1. L1 game/crates/api/src/services/flag_exps.rs:99: The fake-game cache identifies a list only by path and byte length, although fake RomFS contents belong to each test thread and can be replaced with different bytes of the same length. When: Two tests, or two calls to setGameDataList, install different same-sized lists at GameDataList.Product.0.byml.zs. The second lookup reuses the first table, so enum names and expression results come from the wrong test or earlier list. Do: Keep the fake cache with the fake RomFS instance and invalidate it on replacement or reset, or key it by the list’s actual contents.

@fix can do L1.

Since the last review (on e30c81d275)
Resolved: L2 (The opcode meanings have not yet been compared with the answers the game gives during a fl…)
Still open: L1 (The fake-game cache identifies a list only by path and byte length, although fake RomFS co…)

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • The flag_exps.rs test fixture comment still describes opcode 12 as at or after.
More: does it help, other systems, switches, what was read

Does it help: Yes for the demonstrated cases: the author reports matching the game's answers during play, including the strict-after boundary. This is not a performance change; the reported list decode takes about 11 ms and retains about 1.4 MB.

Other systems: The list loader and interpreter affect game mod calls and the fake game on Windows and Linux. Windows gameplay was reported; Linux tests and CI are still pending.

Switches: None.

Reviewed: 4481223f81 against 37f90245b0: Read the repository rules and pull request template, the ledger, comments and reported testing, and the flag expression loader and interpreter in full. The remaining changed files and dependent callers were not read in full; the large diff output was truncated.; nothing run (a code review).

Checked and fine:

  • The changed strict-after comparison and its boundary test agree with the reported game observation.

Testing: No commands that build or run code were executed. The author reports Windows game and unit tests; Linux suite and CI have not yet run on this head.

Overlaps and merge order: Not checked; network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The fake-game cache can return another test's rules or stale rules after a same-size replacement. The reported playtest addresses the earlier request to compare expression answers with the game. Adds named BoolExp evaluation and enum reads for mods, with a background list load and fake-game support. It gives mods access to game checks at the cost of a retained decoded table and added interpreter code. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/api/src/services/flag_exps.rs:99`: The fake-game cache identifies a list only by path and byte length, although fake RomFS contents belong to each test thread and can be replaced with different bytes of the same length. *When:* Two tests, or two calls to setGameDataList, install different same-sized lists at GameDataList.Product.0.byml.zs. The second lookup reuses the first table, so enum names and expression results come from the wrong test or earlier list. **Do:** Keep the fake cache with the fake RomFS instance and invalidate it on replacement or reset, or key it by the list’s actual contents. `@fix` can do L1. **Since the last review** (on e30c81d275fc) Resolved: L2 (The opcode meanings have not yet been compared with the answers the game gives during a fl…) Still open: L1 (The fake-game cache identifies a list only by path and byte length, although fake RomFS co…) **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The flag_exps.rs test fixture comment still describes opcode 12 as at or after. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the demonstrated cases: the author reports matching the game's answers during play, including the strict-after boundary. This is not a performance change; the reported list decode takes about 11 ms and retains about 1.4 MB. **Other systems:** The list loader and interpreter affect game mod calls and the fake game on Windows and Linux. Windows gameplay was reported; Linux tests and CI are still pending. **Switches:** None. **Reviewed:** 4481223f816b against 37f90245b0d1: Read the repository rules and pull request template, the ledger, comments and reported testing, and the flag expression loader and interpreter in full. The remaining changed files and dependent callers were not read in full; the large diff output was truncated.; nothing run (a code review). **Checked and fine:** - The changed strict-after comparison and its boundary test agree with the reported game observation. **Testing:** No commands that build or run code were executed. The author reports Windows game and unit tests; Linux suite and CI have not yet run on this head. **Overlaps and merge order:** Not checked; network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
Owner
@fix
BeanBot force-pushed feat/modapi-flag-exp-main from 4481223f81
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 6500684d9f
Some checks failed
CI / What the change needs (pull_request) Successful in 7s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
PR description / Title and description (pull_request_target) Failing after 6s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
2026-12-05 17:47:29 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The fake-game cache now distinguishes list contents within each test thread, including equal-length replacements. The fix preserves the feature and its real-game loading path. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 6500684d9f. I rebased it onto main (01f53fed8b).

Changed

  • Fake flag table cache: Updated game/crates/api/src/services/flag_exps.rs:20 to cache per thread by decoded list bytes, and added coverage for equal-length replacements and separate threads. Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

Mods can evaluate game flag rules and read enum names. The cache fix prevents fake games from receiving another list's decoded table, at the cost of reading and comparing the fake list on each lookup.

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports in-game flag results matching the game's checks on Windows. The equal-length cache cases have new tests, though those tests have not been run on this head.

Other systems: The fix changes only the fake-game cache; the real game retains its background loader and shared table. Linux results are not reported.

Switches: None added or changed.

Reviewed: 6500684d9f against 01f53fed8b: Read flag_exps.rs in full, the fix diff, the relevant fake RomFS storage and read paths, AGENTS.md and CONTRIBUTING.md. Inspected the game API and flag expression diffs; the remaining changed files and generated reference were not read in full.; nothing run (a code review).

Checked and fine:

  • The fake RomFS enforces the same decoded-byte limit before the cache compares contents.
  • The added test covers replacement with equal-length bytes and a separate thread's list.
  • The fix does not remove or route around the real-game feature.

Testing: No commands that build or run tests were executed. CI has not run on this head; the author reports Windows game testing of the feature.

Overlaps and merge order: Not checked.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The fake-game cache now distinguishes list contents within each test thread, including equal-length replacements. The fix preserves the feature and its real-game loading path. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 6500684d9ff2. I rebased it onto `main` (01f53fed8b02). **Changed** - **Fake flag table cache**: Updated game/crates/api/src/services/flag_exps.rs:20 to cache per thread by decoded list bytes, and added coverage for equal-length replacements and separate threads. Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. Mods can evaluate game flag rules and read enum names. The cache fix prevents fake games from receiving another list's decoded table, at the cost of reading and comparing the fake list on each lookup. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports in-game flag results matching the game's checks on Windows. The equal-length cache cases have new tests, though those tests have not been run on this head. **Other systems:** The fix changes only the fake-game cache; the real game retains its background loader and shared table. Linux results are not reported. **Switches:** None added or changed. **Reviewed:** 6500684d9ff2 against 01f53fed8b02: Read flag_exps.rs in full, the fix diff, the relevant fake RomFS storage and read paths, AGENTS.md and CONTRIBUTING.md. Inspected the game API and flag expression diffs; the remaining changed files and generated reference were not read in full.; nothing run (a code review). **Checked and fine:** - The fake RomFS enforces the same decoded-byte limit before the cache compares contents. - The added test covers replacement with equal-length bytes and a separate thread's list. - The fix does not remove or route around the real-game feature. **Testing:** No commands that build or run tests were executed. CI has not run on this head; the author reports Windows game testing of the feature. **Overlaps and merge order:** Not checked. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean changed title from WIP: feat(modapi): flags.evaluate, enumValue and enumValues: the game's BoolExp flags and enum values by name to feat(modapi): flags.evaluate, enumValue and enumValues: the game's BoolExp flags and enum values by name 2026-12-05 17:47:37 +00:00
HumanBean deleted branch feat/modapi-flag-exp-main 2026-12-05 17:47:44 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3204
No description provided.