Skip to content

Commit 58a4600

Browse files
test(memory): mock getOverrideAvailableMemoryGB in the override-chain integration test
Fix A routed the override survival-floor check through the new getOverrideAvailableMemoryGB; the override-chain integration test mocks the hardware boundary and hadn't defined it (auto-mock → undefined → NaN < floor never refused). Delegate it to getAvailableMemoryGB (no swap in this scenario) so both the loads-after-evict and hard-limit-refuses cases stay accurate. Blast-radius caught by pre-push --findRelatedTests (the §D hub rule in action). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 197f28a commit 58a4600

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

__tests__/integration/models/loadAnywayOverrideChain.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ describe('Load Anyway override chain (UI helper → service → residency)', ()
155155
mockHardwareService.getAvailableMemoryGB.mockImplementation(() =>
156156
reclaimed ? 6 : 1,
157157
);
158+
// The override survival-floor check now reads getOverrideAvailableMemoryGB (physical +
159+
// free ZRAM swap on Android; == available on iOS). This scenario has no swap headroom, so
160+
// it tracks getAvailableMemoryGB — delegate so it follows each test's dynamic value.
161+
mockHardwareService.getOverrideAvailableMemoryGB.mockImplementation(async () =>
162+
mockHardwareService.getAvailableMemoryGB(),
163+
);
158164

159165
// Force a small residency budget so the ~3 GB model can't fit without eviction —
160166
// deterministic, independent of the device-RAM heuristics under test elsewhere.

0 commit comments

Comments
 (0)