Code Room
Vibe codingHardvc-g283
Subject Ai refactor migrationLevel Senior–Staff~28 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Your team wants to incrementally port a performance-critical C image-decoding library to Rust for memory safety, using an AI agent to translate functions. The agent produces Rust that compiles, but it's full of `unsafe` blocks and raw pointer arithmetic mirroring the C. How do you direct the agent and structure the port so you actually gain the safety you're migrating for, and how do you verify the Rust decodes identically to the C?

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.