Repository navigation
test(snapshot): diagnose canonical worktree timeout phases - #308
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
1960e60 to
35ad063
Compare
35ad063 to
dc6b2aa
Compare
| // Keep the default budget: the last start/done pair identifies the Windows | ||
| // timeout boundary, including native Git setup and scoped layer disposal. | ||
| const startedAt = Date.now() | ||
| const phase = (name: string) => |
There was a problem hiding this comment.
SUGGESTION: Inconsistent phase function signature vs. first test
The first test (line 20-21) defines phase as returning Effect.sync(...) for yielding inside Effect.gen. This test defines phase as a plain function calling console.error directly, requiring Effect.sync(() => phase(...)) wrappers when used in Effect.gen (lines 145, 148, 150, 154, 160, 168, 169, 176) but direct calls in async callbacks (lines 109, 111, 119, 121, etc.).
This works but creates inconsistency. Consider adding a comment explaining why this test uses a plain function (to support direct calls in Effect.promise async callbacks where yield* is unavailable).
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| testEffect(Layer.empty).live("isolates snapshot indexes by canonical Git worktree", () => | ||
| Effect.acquireUseRelease( | ||
| Effect.promise(() => tmpdir()), | ||
| testEffect(Layer.empty).live("isolates snapshot indexes by canonical Git worktree", () => { |
There was a problem hiding this comment.
SUGGESTION: Test relies on default 5-second timeout without explicit declaration
The first test explicitly sets a 30-second timeout (line 83: }, 30_000)). This test omits the timeout argument, relying on testEffect's default (5 seconds per PR description). Given the extensive Git operations (init, config, add, commit, worktree add), this may timeout on slow CI — which appears intentional for diagnostics, but the intent is not documented in the test signature.
Consider adding an explicit timeout (or Infinity to disable) with a comment explaining the diagnostic purpose.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ), | ||
| ) | ||
| (tmp) => | ||
| Effect.promise(async () => { |
There was a problem hiding this comment.
WARNING: Cleanup swallows potential disposal errors without logging
The release function uses Effect.promise(async () => { ... }) with direct phase() calls. If tmp[Symbol.asyncDispose]() rejects, the rejection becomes an Effect failure (correct), but no phase marker logs the failure before the test fails. The cleanup:done marker (line 182) only runs on success.
Consider wrapping the disposal in a try/catch to emit a cleanup:error phase marker before re-throwing, preserving diagnostic value on cleanup failures.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| yield* Effect.sync(() => phase(`${name}-capture:done`)) | ||
| return captured | ||
| }).pipe(Effect.provide(snapshotLayer(tmp.path, directory))) | ||
| // Effect.provide has closed the layer scope before this marker. |
There was a problem hiding this comment.
SUGGESTION: Comment on layer scope closure could be more explicit
The comment // Effect.provide has closed the layer scope before this marker is accurate but terse. For future maintainers, it may not be obvious why this matters for the diagnostic (the layer:done phase measures post-scope-overhead).
Suggest: // Effect.provide closes the layer scope when the inner effect completes; this marker runs after scope teardown.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Previous Review SummaryCurrent summary above is authoritative. Previous snapshots are kept for context only. Previous reviewStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (1 file)
Reviewed by free · Input: 33.4K · Output: 12.4K · Cached: 164K |
|
Independent adjudication of the cleanup warning: the release path does not swallow disposal errors. It awaits The default 5-second budget is intentional here: this delivers phase diagnostics without silently changing the failure threshold or claiming its root cause is fixed. All original assertions remain. This PR references #303 and does not close it. |
Refs #303. Does not close it.
Add elapsed-time start/done markers for the canonical-worktree snapshot test: temporary root, files, Git setup, captures and layer disposal, project ID, index assertions and cleanup.
Keep the default 5-second budget, all original assertions and cleanup. No retries, skips, production changes or claim of a confirmed root cause.
Independent Linux Bun 1.3.14 native snapshot file: 4 pass, 0 fail, 16 assertions. All phase markers complete. Windows and full types remain CI gates. This diagnostic delivery does not establish that the intermittent timeout is fixed.