Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(app): address review on #5884 — observe the thread id, harden the drift guard

M3gA-Mindc858ba69d9a9
diff --git a/app/src/AppRoutes.redirects.test.tsx b/app/src/AppRoutes.redirects.test.tsx
index 126037405b..4a80820e4f 100644
--- a/app/src/AppRoutes.redirects.test.tsx
+++ b/app/src/AppRoutes.redirects.test.tsx
@@ -114,9 +114,23 @@ describe('AppRoutes back-compat redirects', () => {
const [fs, path] = await Promise.all([import('node:fs'), import('node:path')]);
// vitest runs with `app/` as cwd (test/vitest.config.ts sets the root).
const source = fs.readFileSync(path.resolve('src/AppRoutes.tsx'), 'utf8');
- const routed = [...source.matchAll(/<Route path="([^"]+)" element={<Navigate /g)].map(
- match => match[1]
- );
+
+ // Each route's body is the slice up to the next `<Route path=`, and the body
+ // is searched for `<Navigate`. Deliberately NOT a single-line regex like
+ // `/<Route path="…" element={<Navigate /`: Prettier wraps a `<Route>` across
+ // lines as soon as its props exceed the print width, and a one-line pattern
+ // then silently skips that redirect — the list stays unchanged and this test
+ // still claims full coverage. A guard that stops guarding is worse than none.
+ const starts = [...source.matchAll(/<Route\s+path="([^"]+)"/g)];
+ const routed = starts
+ .filter((match, index) => {
+ const from = match.index ?? 0;
+ const to =
+ index + 1 < starts.length ? (starts[index + 1].index ?? source.length) : source.length;
+ return /<Navigate\b/.test(source.slice(from, to));
+ })
+ .map(match => match[1]);
+
expect(routed.sort()).toEqual(REDIRECTS.map(r => r.from).sort());
});
});
diff --git a/app/src/AppRoutesIOS.pairing.test.tsx b/app/src/AppRoutesIOS.pairing.test.tsx
index f36f33ce3d..819d402d08 100644
--- a/app/src/AppRoutesIOS.pairing.test.tsx
+++ b/app/src/AppRoutesIOS.pairing.test.tsx
@@ -21,13 +21,24 @@
* `pages/ios/PairScreen.test.tsx`. Not repeated here.
*/
import { render, screen } from '@testing-library/react';
-import { MemoryRouter } from 'react-router-dom';
+import { MemoryRouter, useParams } from 'react-router-dom';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
vi.mock('./features/human/HumanPage', () => ({
default: () => <div data-testid="page-human">human</div>,
}));
-vi.mock('./pages/Accounts', () => ({ default: () => <div data-testid="page-chat">chat</div> }));
+// Renders the route param back out. A stub that discards params makes
+// `/chat/thread-abc`, `/chat/anything` and a route that dropped the
+// `:threadId` segment entirely produce identical DOM — so the deep-link test
+// below would pass without observing the thread id at all. Mirrors the
+// technique already used in `AppRoutes.connections-flows.test.tsx`.
+vi.mock('./pages/Accounts', () => {
+ const ChatProbe = () => {
+ const { threadId } = useParams();
+ return <div data-testid="page-chat">{`chat:${threadId ?? ''}`}</div>;
+ };
+ return { default: ChatProbe };
+});
vi.mock('./pages/Settings', () => ({
default: () => <div data-testid="page-settings">settings</div>,
}));
@@ -103,7 +114,9 @@ describe('AppRoutesIOS — deep links a paired phone must honour', () => {
renderAt('/chat/thread-abc');
- expect(screen.getByTestId('page-chat')).toBeInTheDocument();
+ // The segment must survive to the page, not merely match the route: this is
+ // the half a notification deep link depends on.
+ expect(screen.getByTestId('page-chat')).toHaveTextContent('chat:thread-abc');
expect(screen.getByTestId('mobile-tab-bar')).toBeInTheDocument();
expect(screen.queryByTestId('page-human')).not.toBeInTheDocument();
});
diff --git a/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx b/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx
index 2bf440c1de..e7999b017b 100644
--- a/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx
+++ b/app/src/components/intelligence/MemorySourceRow.pipelineWarning.test.tsx
@@ -129,7 +129,7 @@ describe('MemorySourceRow — the row tells the truth about embedding state', ()
});
});
-describe('MemorySourceRow — the warning is suppressed only while a sync is in flight', () => {
+describe('MemorySourceRow — what suppresses the warning', () => {
// `settled = !progress && !result` in MemorySourceRow.tsx. This suppression is
// correct (mid-sync `chunks_pending` is legitimately transient) and is also the
// most plausible way for the indicator to never appear: a source wedged in a
@@ -145,6 +145,29 @@ describe('MemorySourceRow — the warning is suppressed only while a sync is in
expect(warning()).not.toBeInTheDocument();
});
+ it('ALSO stays hidden after a sync has finished, for as long as the result chip lives', () => {
+ // Pinned because it is surprising and load-bearing, not because it is right.
+ //
+ // `settled = !progress && !result` (MemorySourceRow.tsx:100). `result` is the
+ // terminal success/failure chip, and MemorySourcesRegistry only clears it
+ // when the NEXT sync starts (`:213`, `:358`) — nothing else drops it. So
+ // after any completed sync the "stored without vectors" warning is hidden
+ // indefinitely, which is exactly the shape of the incident this file exists
+ // for: chunks synced, none embedded, and no indicator anywhere.
+ //
+ // Recorded as a bug in ~/tinyhuman/bugs/W6-ui-bugs.md rather than asserted
+ // as correct. If someone narrows the suppression to `progress` alone, this
+ // test fails and should be updated to expect the warning — that failure is
+ // the fix landing, not a regression.
+ renderRow({
+ status: storedWithoutVectors(),
+ progress: null,
+ result: { ok: true } as unknown as React.ComponentProps<typeof MemorySourceRow>['result'],
+ });
+
+ expect(warning()).not.toBeInTheDocument();
+ });
+
it('reports the truth again once the sync has settled', () => {
renderRow({ status: storedWithoutVectors(), progress: null, result: null });