fix: runner alloc idx logic, api auth for actor get#4443
fix: runner alloc idx logic, api auth for actor get#4443MasterPtato wants to merge 1 commit intomainfrom
Conversation
|
🚅 Deployed to the rivet-pr-4443 environment in rivet-frontend
|
PR Review: fix: runner alloc idx logic, api auth for actor getSummaryThe PR addresses two bug fixes: eviction handling in the runner allocation index lifecycle, and relaxing auth requirements on the actor list endpoint when filters are provided. Overall the changes are sound and fix real issues. A few observations below. Runner Allocation Index LogicDraining vs. Expired separation - The removal of ExpiredTsKey writes in the Draining state (runner.rs:691 and runner2.rs:540) is the correct fix. Previously a draining runner was marked as both draining and expired, causing the allocation index to treat it as permanently gone. Now DrainTsKey and ExpiredTsKey are distinct, which is semantically correct. Eviction propagation - Moving eviction signalling from Err(WsError::Eviction) to Ok(Err(LifecycleResult::Evicted)) in the two task files is clean. It lets the coordinator in lib.rs decide whether to clear the alloc idx before converting it back to an error. Minor style nit - The if let / else block in lib.rs:235-255 is valid but slightly unusual Rust. Consider using matches! instead. UpdatePing condition change in update_alloc_idx.rs:177 - The old guard checked whether the old alloc key existed in the index. The new guard checks whether the runner is not draining. These are not equivalent: if a runner lost its alloc key but is not draining, the new code proceeds where the old code would short-circuit. This is probably fine in practice, but it is a subtle semantic shift worth a comment explaining why the draining check is the correct gate here. API Auth for Actor List (api-public/src/actors/list.rs)The comment about reading being allowed and list requiring auth is terse. Something like 'Auth is required to enumerate all actors; individual lookups by ID or key are allowed unauthenticated' would make the policy clearer to future readers. The logic itself looks correct. Note the intentional asymmetry: actor_ids and key are checked with is_none() while actor_id uses is_empty() - this reflects their different types (Option vs String). An explicit empty-string actor_id correctly still triggers the auth path. Other Changes
VerdictNo blocking issues. The core logic changes are correct and the two bugs (draining-as-expired, premature alloc-idx clear on eviction) are fixed cleanly. The minor points above are suggestions, not blockers. Generated with Claude Code |
5b2bead to
cfc4fad
Compare
cfc4fad to
65280b5
Compare
65280b5 to
84dbf32
Compare
84dbf32 to
90c2e97
Compare
b2f4422 to
7baeb4c
Compare
7baeb4c to
791a38d
Compare
791a38d to
d5c2eee
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: