skills/code_review/SKILL.md
This skill defines the mandatory protocol for conducting rigorous, adversarial code reviews on Filament source code. Standard single-pass reviews focusing on style or superficial idioms are strictly prohibited. Reviews must prioritize correctness, concurrency invariants, memory models, lifecycle safety, API contracts, arithmetic boundaries, and test integrity.
put(), wakeOne(), waitForWork(), loop()). Trace full execution state machines across caller/callee boundaries.Every review must systematically evaluate the change through these six analytical lenses:
std::atomic operation and its std::memory_order (relaxed, acquire, release, acq_rel, seq_cst).memory_order_release prevents prior memory writes from sinking below the release store, but does not prevent subsequent non-atomic writes from floating above it. memory_order_acquire prevents subsequent reads from floating above the acquire load, but does not protect prior reads.notify_one() / wakeOne()) or waiting loops (wait()) are gated by unlocked relaxed loads (e.g., relaxed check of waiter counts).utils::Mutex / utils::Condition with LockGuard const as mandated by skills/cpp_static_thread_safety.uint32_t $\to$ uint16_t, size_t $\to$ uint32_t).count == 0, count == 1, $2^{16}$, $2^{32}$, INT_MAX, and overflow/underflow points.count == 0), empty containers, or null arguments change behavior (e.g., skipping a functor that previously ran once)?SplitterTraits) do not silently ignore legacy interfaces or custom types without a compilation error or fallback.emancipate()), preventing capacity degradation.[&]) or raw pointers (this) outlive background job execution.CMakeLists.txt.parallel_for helper job counts) scale with the new capability rather than only querying legacy state.Reviews must be structured using the following format:
<File Path>
- <line> [<category>] <Concise finding description detailing the exact failure mechanism.>
...
Review Summary:
- **The Blocker**: Identify the single most critical blocking issue, explaining the thread interleaving or failure sequence.
- **Intent vs. Code**: Assess whether the PR achieves its architectural goals and note any systematic omissions.
- **Explicitly Checked & Ruled Out**: List non-obvious complex areas investigated and verified as safe/correct (proves thorough inspection and eliminates false positives).
- **Minor Cleanups**: Note dead code, minor un-decremented tracking counters, or triplicated logic below the blocking finding bar.
[correctness] — Logic errors, data races, memory ordering bugs, lost wakeups, narrowing bugs, crashes.[efficiency] — Scaling bottlenecks, false sharing, unnecessary allocations, missed parallelism.[api-contract] — Broken traits, dropped interface support, violated preconditions/postconditions.[behavior-change] — Silent changes to edge-case behavior (e.g., count == 0).[test-coverage] — Tautological tests, missing failure checks, unwired tests.When instructed to review code, a branch, a commit range, or a PR:
git diff <base_branch>...<target_branch>
# or
git log -n <count> --stat
view_file to understand the complete cross-function state machine.