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:
@@ -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 () => {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -353,11 +353,7 @@ describe('Even Hub simulator 0.9.5', () => {
|
||||
await launchSimulator('fast', h.bridge.devices.createPairingCode().code);
|
||||
await waitConsole('hud: HUD page created', 30_000, from);
|
||||
await waitConsole('-> ready', 20_000, from);
|
||||
await new Promise((r) => setTimeout(r, 6_500));
|
||||
await pumpConsole();
|
||||
// Opened by URL, no gesture yet: not armed, so it must still be there.
|
||||
expect(consoleLines.slice(from).some((l) => l.includes('leaving the glasses'))).toBe(false);
|
||||
await input('down'); // a glasses gesture arms it
|
||||
// No gesture and no launch source: it leaves from Ready after the (shortened) wait.
|
||||
await waitConsole('leaving the glasses: idle on ready', 15_000, from);
|
||||
await new Promise((r) => setTimeout(r, 1_500));
|
||||
await pumpConsole();
|
||||
|
||||
Reference in New Issue
Block a user