feat(rooms): add integration rooms provider#94
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
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, or 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 fix this CI failure" or "@codex address that feedback".
| static const rooms_state_t* s_current_state = &DEFAULT_STATE; | ||
|
|
||
| const rooms_state_t* rooms_provider_get_state(void) | ||
| { | ||
| return s_current_state; | ||
| } | ||
|
|
||
| void rooms_provider_set_state(const rooms_state_t* state) | ||
| { | ||
| s_current_state = state; |
There was a problem hiding this comment.
[P1] Avoid storing pointers to caller-owned room snapshots
The provider advertises that callers can treat the returned snapshot as provider-owned, but rooms_provider_set_state simply assigns s_current_state to the caller’s pointer without copying or retaining ownership. If an integration builds a rooms_state_t on the stack (as the tests do) or frees/overwrites the structure after the setter returns, subsequent calls to rooms_provider_get_state will read dangling memory and the UI will dereference invalid entities. The provider should allocate or copy the snapshot it owns, or document and enforce that the passed state must outlive the provider.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68cd5a35083c83249b2a1ba560481aab