Idle exit starts however the app was opened (0.1.2)

On a real G2 with build 0.1.1, a voice launch with nothing touched never
left the glasses: no glassesMenu launch source reached the app, so the
countdown was never armed. After one swipe it left as designed.

The countdown now runs however the session was opened. The launch source is
kept for Diagnostics only. Setting up on the phone stays protected: nothing
leaves while unpaired, and a touch on the phone page holds the app open for
the grace period. Dan approved the change after the trial.

Also records the 0.1.1 trial, Dan's keep/change decisions (contract
section F) and the 0.1.1 upload. Version 0.1.2. Not reviewed, not uploaded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-21 15:34:20 -08:00
co-authored by Claude Fable 5.2
parent 3e0468802f
commit 344a2288b8
10 changed files with 133 additions and 42 deletions
+21 -5
View File
@@ -833,17 +833,33 @@ describe('leaving the glasses when idle (the app blocks notifications while it i
await until('left from the error screen', () => device.exits === 1, 1500);
});
it('opened from the phone with no gesture yet, it stays: setting up on the phone is not interrupted', async () => {
it('it leaves however it was opened: no launch source and no gesture at all (what a voice launch gave on a real G2)', async () => {
controllerExtras = { idleExit: FAST };
await pairedController();
expect(snapshot.launchSource).toBe('unknown');
await until('left from Ready with nothing ever touched', () => device.exits === 1, 1500);
expect(device.exitAttempts).toBe(1);
});
it('opened from the phone app, it leaves too', async () => {
controllerExtras = { idleExit: FAST };
await pairedController();
device.launchedFrom('appMenu');
controller.askText('typed on the phone');
await until('answer', () => phase() === 'answer');
await quiet(500);
expect(device.exits).toBe(0);
// The first gesture on the glasses means they are in use: from then on it applies.
await until('left after the answer', () => device.exits === 1, 1500);
});
it('an unpaired app never leaves: pairing on the phone is not interrupted', async () => {
controllerExtras = { idleExit: FAST };
device = new FakeDevice();
controller = makeController(device);
await controller.start();
device.launchedFrom('glassesMenu');
device.swipeDown();
await until('left after the glasses were used', () => device.exits === 1, 1500);
await quiet(700);
expect(phase()).toBe('unpaired');
expect(device.exitAttempts).toBe(0);
});
it('touching the phone page holds it open for the grace period', async () => {
+47 -11
View File
@@ -202,13 +202,14 @@ describe('the one-shot launch source is not lost during start-up', () => {
expect(host.maxInFlight).toBe(1);
});
it('control: with no launch source and no gesture, the same start-up does not leave', async () => {
it('with no launch source and no gesture at all, the same start-up still leaves, once', async () => {
await pairedHost();
controller = makeController();
await controller.start();
await until('ready', () => snapshot.state.phase === 'ready');
await quiet(500);
expect(host.exitCalls).toEqual([]);
await until('left the glasses', () => logged('left the glasses') === 1, 2000);
await quiet(400);
expect(host.exitCalls).toEqual([0]);
});
});
@@ -313,30 +314,65 @@ describe('default idle times with the production adapter (fake clock)', () => {
await expectOneExitAtThirtySeconds();
});
it('glassesMenu pushed AFTER the controller subscribed: one exit, 30 s later', async () => {
it('glassesMenu pushed AFTER the controller subscribed: still one exit, 30 s after Ready', async () => {
await pairedHost();
fakeClock();
controller = defaults();
await controller.start();
await vi.advanceTimersByTimeAsync(5 * 60_000);
expect(host.exitCalls).toEqual([]); // nothing has said the glasses are in use
host.pushLaunchSource('glassesMenu');
await vi.advanceTimersByTimeAsync(10_000);
host.pushLaunchSource('glassesMenu'); // arrives late: it must not restart or double the countdown
await vi.advanceTimersByTimeAsync(19_900);
expect(host.exitCalls).toEqual([]);
await vi.advanceTimersByTimeAsync(200);
expect(host.exitCalls).toEqual([0]);
await vi.advanceTimersByTimeAsync(10 * 60_000);
expect(host.exitCalls).toEqual([0]);
});
it('NO launch source is ever pushed (seen on a real G2 voice launch): one exit, 30 s after Ready', async () => {
await pairedHost();
fakeClock();
controller = defaults();
await controller.start();
expect(snapshot.launchSource).toBe('unknown');
await expectOneExitAtThirtySeconds();
});
it('appMenu pushed early does not arm it; the first glasses gesture does', async () => {
it('appMenu pushed early: opened from the phone app, it leaves the same way', async () => {
await pairedHost();
fakeClock();
controller = defaults();
host.pushLaunchSource('appMenu');
await controller.start();
expect(snapshot.launchSource).toBe('appMenu');
await vi.advanceTimersByTimeAsync(10 * 60_000);
expect(host.exitCalls).toEqual([]);
host.swipeDown();
await expectOneExitAtThirtySeconds();
});
it('opened and then the phone page is touched: the full two-minute grace, then 30 s', async () => {
await pairedHost();
fakeClock();
controller = defaults();
await controller.start();
await vi.advanceTimersByTimeAsync(5_000);
controller.notePhoneActivity();
await vi.advanceTimersByTimeAsync(149_500);
expect(host.exitCalls).toEqual([]);
await vi.advanceTimersByTimeAsync(1_000);
expect(host.exitCalls).toEqual([0]);
});
it('never paired: nothing leaves, however long it is left', async () => {
host = new FakeEvenHost();
fakeClock();
controller = defaults();
host.pushLaunchSource('glassesMenu');
await controller.start();
expect(snapshot.state.phase).toBe('unpaired');
host.swipeDown();
await vi.advanceTimersByTimeAsync(30 * 60_000);
expect(host.exitCalls).toEqual([]);
});
it('unsubscribing is preserved: a stopped controller no longer hears the launch source', async () => {
await pairedHost();
fakeClock();