Conversation
|
/crush_fast AI review started. |
Advanced AI Review
Click to expand reviewLet me examine the relevant source files to understand the codebase context better.Now let me check a few more specific details before writing my review.Now let me verify one more critical thing about how the module caching works with the test setup:Now I have enough context. Here is my review: Code Review: Add Endpoint TestsIssue #1: 🔴 Tests cannot restart server —
|
|
/crush_fast AI review started. |
|
/crush_fast AI review started. |
|
The issues the LLMs point out about server start / stop make sense, but for some reason tests are currently working in spite of those issues. Since the purpose of this PR is to get tests for the API to ensure that changing the backend doesn't break the API, I'd say we can ignore those issues for the time being. We should later address this by bootstrapping the server in a manner that's easier to maintain and reason about, taking advantage of top-level This PR currently looks good to merge, since tests pass and the logic hasn't been changed much, other than for some minor bugfixes. The important part when reviewing this is ensuring that those few places that change application logic are correct. |
|
/crush_fast AI review started. |
Advanced AI Review
Click to expand reviewLet me examine the relevant source files for context before providing my review.Now let me look at the Code ReviewIssue 1: 🔴 Tests will hang indefinitely on second
|
|
/crush_fast AI review started. |
|
/crush_fast (Trying one last time) AI review started. |
|
Review from GLM-5.1 locally: DetailsCode ReviewBase: This PR adds comprehensive HTTP endpoint tests covering stateless endpoints, state-dependent reads, write operations, KV store, and ZKPP (Zero-Knowledge Password Proof) flows. It also improves server shutdown cleanup (rate limiters, workers, heartbeat interval) and refactors worker path injection from a single The test coverage is thorough — ~60 test cases across 5 test files exercising happy paths, error cases, auth flows, content-type validation, cache headers, and full cryptographic ZKPP registration/challenge flows. 1. 🟡 Fragile private API access for Bottleneck cleanup
clearInterval((limiterPerMinute as unknown as { interval: ReturnType<typeof setInterval> }).interval)
clearInterval((limiterPerHour as unknown as { interval: ReturnType<typeof setInterval> }).interval)
clearInterval((limiterPerDay as unknown as { interval: ReturnType<typeof setInterval> }).interval)The comment acknowledges this, but it's worth noting that this will silently break if Bottleneck renames or removes the try {
clearInterval((limiterPerMinute as unknown as { interval?: ReturnType<typeof setInterval> }).interval)
clearInterval((limiterPerHour as unknown as { interval?: ReturnType<typeof setInterval> }).interval)
clearInterval((limiterPerDay as unknown as { interval?: ReturnType<typeof setInterval> }).interval)
} catch {
// Private API may have changed across Bottleneck versions
}2. ⚪️ Inconsistent validation order in ZKPP full flow tests
The two ZKPP full flow tests validate the encrypted salt response in different orders:
if (/[^\dA-Za-z_-]/.test(encryptedSalt)) throw new Error('Invalid characters in encrypted salt')
if (!encryptedSalt) throw new Error('Expected encrypted salt response')
if (!encryptedSalt) throw new Error('Expected encrypted salt response')
if (/[^\da-zA-Z_-]/.test(encryptedSalt)) throw new Error('Unexpected characters in encrypted salt')The empty check should come first since an empty string would pass the regex check (no invalid characters to find). The first test has the order reversed. Additionally, the regex patterns use different casing ( 3. ⚪️ Duplicated ZKPP full flow test logic
async function zkppFullFlow (baseURL: string, contentType: 'json' | 'form') {
// shared logic with parameterized content type
}This would reduce duplication and ensure both code paths stay in sync as the protocol evolves. 4. ⚪️
|
Advanced AI Review
Click to expand reviewNow let me verify one more thing about the Code ReviewIssue 1: Tests will deadlock if run in parallel —
|
|
/crush_fast AI review started. |
Advanced AI Review
Click to expand reviewNow I have enough context to write a thorough review. Let me compile my findings.## Code Review: Add Endpoint Tests 1. 🟡 Rate limiter cleanup relies on Bottleneck internal private API
clearInterval((limiterPerMinute as unknown as { interval: ReturnType<typeof setInterval> }).interval)
clearInterval((limiterPerHour as unknown as { interval: ReturnType<typeof setInterval> }).interval)
clearInterval((limiterPerDay as unknown as { interval: ReturnType<typeof setInterval> }).interval)This accesses an undocumented for (const limiter of [limiterPerMinute, limiterPerHour, limiterPerDay]) {
const internal = limiter as unknown as { interval?: ReturnType<typeof setInterval> }
if (internal.interval != null) {
clearInterval(internal.interval)
}
}2. 🟡 Test server cannot restart after being stopped — running all test files together will hang
The
This means all four test files ( 3. 🟡
|
Endpoint tests