refactor(cli): inject allocators + de-flake/extend tests (audit follow-ups)#384
Conversation
…w-ups) - config/test.zig readVidPid: take allocator param instead of page_allocator; thread through from run() (api-consistency) - switch_mapping.zig run(): accept allocator instead of building an internal GPA; thread the process allocator from main.zig - devices.zig test: bind+listen on caller thread before spawning server, removing Thread.sleep(10ms) race; assertion unchanged - config/test.zig: extract formatReport helper and add falsifiable Layer-0 tests for the report hex-dump, remap hint, and readVidPid refs: codebase audit
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Review limit reached
More reviews will be available in 3 minutes and 3 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Addresses the four audit findings an earlier batch skipped (the other three — mappingLabel deletion, scan DEFAULT_CONFIG_DIR, dump alias — were already merged and verified gone in current code).
Changes
readVidPid— take anallocatorparam instead of hard-codingstd.heap.page_allocator; thread it fromrun(), which already receives the allocator (api-consistency).run()— accept anallocatorparam instead of constructing an internal GPA; thread the existing process allocator frommain.zig. The only allocation (findMappingresult) is freed viadeferbefore return, so the injected allocator's lifetime is correct (no use-after-free, no leak); behavior is identical.Thread.sleep(10ms). The listen backlog holds the pending connection untilaccept, so it is deterministic. Asserted property (rc == 1on ERR response) unchanged.formatReportfromrun()'s read loop (publicrun()signature unchanged) and add falsifiable Layer-0 tests for the report hex-dump format, the remap hint, andreadVidPid.Test plan
./scripts/padctl-docker test→ EXIT=0.formatReportexpected string makes the suite fail (src.cli.config.test.test.formatReport: hex dump without mapping' failed, EXIT=1); restored to green.zig fmt --check(zig 0.15.2) clean on all changed files.refs: codebase audit