test: isolate aggregate durability timing (#255) - #295
Conversation
|
@coderabbitai review |
📝 WalkthroughWalkthroughThe PR separates logical filesystem tests from host sync latency, adds real-filesystem audit and OAuth durability coverage, introduces a delayed-shutdown upstream fixture, and refines descendant-reaping assertions. ChangesDurability and lifecycle test contracts
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/helpers/upstream-manager-contracts.ts (1)
1004-1012: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDo not discard the restart result.
await restarting.catch(() => undefined)allows this test to pass when replacement startup fails after its transport starts. Keep the early rejection handler if needed, but finish withawait expect(restarting).resolves.toBeDefined().🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/helpers/upstream-manager-contracts.ts` around lines 1004 - 1012, Update the restart assertion in the test around manager.restart("work") so the restart promise’s final outcome is validated rather than discarded. Retain the early rejection handler if needed to avoid unhandled rejection during waitFor, but replace the final restarting catch with an assertion that restarting resolves to a defined value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/audit-logical-suite-contract.test.ts`:
- Around line 24-32: Update the assertions in the audit logical suite contract
test to verify that each relevant suite registers a beforeEach callback
containing the awaited stubFileSyncForLogicalTest call, rather than only
checking for the helper token. Preserve the existing positive and negative
expectations for auditDurabilitySuite and the durability suites.
---
Outside diff comments:
In `@tests/helpers/upstream-manager-contracts.ts`:
- Around line 1004-1012: Update the restart assertion in the test around
manager.restart("work") so the restart promise’s final outcome is validated
rather than discarded. Retain the early rejection handler if needed to avoid
unhandled rejection during waitFor, but replace the final restarting catch with
an assertion that restarting resolves to a defined value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 80c52bc6-03ee-4f43-a384-b55de8d6d00a
📒 Files selected for processing (11)
CHANGELOG.mdtests/audit-integrity-durability.test.tstests/audit-integrity.test.tstests/audit-log-reader.test.tstests/audit-logical-suite-contract.test.tstests/console-application-service.test.tstests/fixtures/shutdown-delay-upstream.mjstests/helpers/logical-file-sync.tstests/helpers/upstream-manager-contracts.tstests/oauth-profile-rename-durability.test.tstests/oauth-profile-rename-transaction.test.ts
|
Addressed both CodeRabbit findings on exact head |
Both findings were addressed in 4d9c6c4. CodeRabbit confirmed the inline fix on the current head and returned a successful current-head status with no new findings; the outside-diff restart finding is fixed by asserting the original promise resolves. Focused validation and independent exact-head review found no blockers.
Summary
Refs #255
Root cause and TDD evidence
The aggregate suite reproduced three exact five-second logical-suite timeouts in audit integrity/reader work, remote OAuth/Console work, and OAuth profile-rename transactions. It also reproduced a descendant containment test waiting for a replacement fixture counter after the containment ordering contract had already passed, plus a shutdown-timing test paying the generic fixture startup cost.
The focused logical/durability contract was tightened first and failed on the current tree before the implementation. The implementation stubs only FileHandle.sync in named logical suites. Real-sync coverage remains in tests/audit.test.ts, tests/audit-integrity-durability.test.ts, tests/oauth-profile-rename-durability.test.ts, and the broader durability/platform suites.
Local validation
All commands used supported Node 22.22.3. No timeout was increased and no test or platform gate was disabled.
Review
An independent exact-tree review found no blockers. It confirmed the logical sync stubs are restored per test, the audit and OAuth real-sync paths remain unmocked, the minimal shutdown fixture is cross-platform and shell-free, and the replacement containment assertion remains at the real transport start boundary.
Summary by CodeRabbit
Bug Fixes
Tests