Skip to content

fix(world): records.read rejects a non-string prefix/after with bad_args (#7899) - #8518

Merged
dezren39 merged 1 commit into
mainfrom
queue/14252-7899-records-read-args
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/14252-7899-records-read-args

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes #7899.

Problem

execute_records_read read its string arguments shape-trustingly:

let prefix = args.get("prefix").and_then(Value::as_str);
let after = args.get("after").and_then(Value::as_str);

A supplied non-string prefix/after (number, null, object, array, bool) collapsed to the same None as an omitted argument, so a scoped read silently widened to every record, and a paged read silently restarted from the beginning instead of returning bad_args. The declared schema (world_caps.rs) already types both arguments as strings; the sibling handlers in the same file (execute_chat, execute_schedule_at) already reject present-but-wrong-typed values.

Change

pkgs/id/src/world/actor.rs: prefix/after now follow the file's own idiom — absent stays None; present must be a string or the request fails with CapError::bad_args().

Tests

New world-level regression test records_read_rejects_a_non_string_prefix_or_after drives records.read through the request path (WorldActor::for_test + a probe program): number/null/object/array/bool prefix and number/null/object after all return bad_args; omitted, string-prefix, and string-after controls return exactly the pages they returned before. The test fails on the pre-fix code and passes with the fix.

cargo test --lib --features world world:: — 280 passed, 0 failed. rustfmt --check clean on both touched files.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 04:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T04:10:11.551223Z 9d575fe PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d0ae4151-e9fa-4038-870c-4f848f6616b8
Commits

Reviewing files that changed from the base of the PR and between 743476a and 9d575fe.

Files selected for processing: 2

  • pkgs/id/src/world/actor.rs
  • pkgs/id/src/world/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@dezren39 dezren39 added the queue/claimed Queue worker lifecycle state label Nov 11, 2026
@dezren39 dezren39 removed the queue/claimed Queue worker lifecycle state label Nov 11, 2026
@dezren39
dezren39 merged commit 3cad9f8 into main Nov 11, 2026
3 of 20 checks passed
@dezren39
dezren39 deleted the queue/14252-7899-records-read-args branch November 11, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant