Repository navigation
id(roc): finish the example migration — tic-tac-toe -> RocJson, roc-counter -> Screen, adopt RocText (#565) - #2970
Conversation
…er to Screen + RocText (#565)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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: 720eb57701
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfd580419b
ℹ️ 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".
| import pf.Screen | ||
| import pf.RocText |
There was a problem hiding this comment.
Grant the new imports in source-compilation integration tests
When Roc and the platform assets are available, test_worlds_compile_roc_sources_on_the_fly and test_worlds_compile_native_workers_on_the_fly in tests/cli_integration.rs now fail before compilation. Both load this source but start fresh servers without capability grants; WorldCore::new initializes an empty grant set, and WorldService::compile_and_install passes its effective grants to check_imports, which rejects Screen. Grant Screen and RocText in these fixtures before compiling; updating the direct compilation unit tests does not cover these service-level consumers.
Useful? React with 👍 / 👎.
| base = Screen.boxed(Screen.new(w, h), 0, 0, w, h, "counter") | ||
| Screen.render_json(Screen.put_text(base, 2, 1, "count=${model.count.to_str()}", { fg: 0, bg: 0, bold: Bool.False })) |
There was a problem hiding this comment.
Rebaseline the counter's rendering fuel budgets
The sandbox-enabled suite still enforces 100,000-fuel budgets for both counter View and Layout in src/sandbox.rs::FUEL_BUDGETS, despite replacing the inexpensive text output with Screen construction and JSON rendering. The equivalent existing roc-screen renderer has recorded baselines of 123,675 fuel for its 20×3 view and 378,384 for its wide layout, already above those counter limits. Consequently checked_in_examples_stay_within_fuel_budgets retains obsolete thresholds for the rebuilt artifact. Measure the new counter and deliberately update its rendering budgets alongside this change.
Useful? React with 👍 / 👎.
Finishes the example migration pinned by triage task 2164 for #565 (queue task 2637).
Changes
pkgs/id/examples/tic-tac-toe/main.roc):recordsis built withpf.RocJson(RocJson.Object+ theencode_or_crashidiom copied from roc-chat/lounge) instead of a hand-built JSON string. Output is byte-identical:{"board":"...","plays":N,"winner":"..."}.pkgs/id/examples/roc-counter/main.roc):view/layoutrender throughpf.Screen(boxed 20x3 "counter" screen, wider box on wide viewports — the roc-screen pattern), andupdatematches its event afterpf.RocText.trim, so roc-counter is also the first example importingRocText.build.sh:tic-tac-toe.wasm(69,319 B) andcounter.wasm(59,951 B), both validated and under the 400 KB cap.count=Nview assertions insrc/sandbox.rs,src/world_session/tests.rs, andsrc/world_compile.rsnow assert the Screen frame containscount=N; the source-compile test grants the counter's new platform imports (Screen,RocText). No assertion intent changed — each still proves the count after the same inputs.Verification (laptop, this branch)
roc checkon both examples: no errors.build.shruns: built +wasm-tools validatepassed.cargo test --lib -- counter tic_tac_toe: 10 passed, 0 failed (includes the full tic-tac-toe game test, counter records/snapshot/restore tests, and both counter source-compile tests).Note on #541
The pinned-compiler rebuild criterion completes with #541 (still open), per the task packet: these artifacts were rebuilt with the laptop's current
rocvia the existing siblingbuild.shpattern, and the PR flags that dependency rather than blocking on it.🤖 Agent note · pr opened
Need help on this PR? Tag
@codesmith-botwith what you need.