Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

19d: a time never wraps away from its AM/PM, and the last "at" times say the day (#690)

Oleksandr Ivanchenko4fedeb23e0cb
diff --git a/frontend/src/clock.ts b/frontend/src/clock.ts
index 95aae912..d8856a20 100644
--- a/frontend/src/clock.ts
+++ b/frontend/src/clock.ts
@@ -13,9 +13,8 @@ const toDate = (at: When): Date | null => {
const sameDay = (a: Date, b: Date) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
-// The locale's own short time: "8:15 PM" in en-US, "20:15" and "08:30" in en-GB. (`hour: 'numeric'` would write
-// en-GB as "8:30", which is not how a 24-hour device shows it.)
-const TIME = { timeStyle: 'short' } as const;
+// Times use the locale's own short (or medium, with seconds) style: "8:15 PM" in en-US, "20:15" and "08:30" in
+// en-GB. (`hour: 'numeric'` would write en-GB as "8:30", which is not how a 24-hour device shows it.)
export interface ClockOpts {
locale?: string;
@@ -23,24 +22,33 @@ export interface ClockOpts {
timeZone?: string;
}
-/** "8:15 PM" in en-US, "20:15" in en-GB. Null for a missing or unreadable time. */
+// The time with a no-break space (U+00A0) on the AM/PM side, so "10:51 PM" never wraps into "10:51 / PM" in a
+// narrow row (Time never splits, roadmap 19d). Node 20's ICU writes U+202F there and browsers a plain space; both
+// become U+00A0. Any other U+202F becomes a plain space, as before. A 24-hour locale ("20:15") has no day period,
+// so it comes back as the locale wrote it.
+function clockParts(d: Date, style: 'short' | 'medium', opts: ClockOpts): string {
+ const parts = new Intl.DateTimeFormat(opts.locale, { timeStyle: style, ...(opts.timeZone ? { timeZone: opts.timeZone } : {}) }).formatToParts(d);
+ return parts
+ .map((p, i) => {
+ if (p.type !== 'literal') return p.value;
+ const nextToPeriod = parts[i + 1]?.type === 'dayPeriod' || parts[i - 1]?.type === 'dayPeriod';
+ return nextToPeriod ? p.value.replace(/[\u202f ]/g, '\u00a0') : p.value.replace(/\u202f/g, ' ');
+ })
+ .join('');
+}
+
+/** "8:15\u00a0PM" in en-US (a no-break space before PM), "20:15" in en-GB. Null for a missing or unreadable time. */
export function timeText(at: When, opts: ClockOpts = {}): string | null {
const d = toDate(at);
if (!d) return null;
- // Some ICU builds (Node 20) put a narrow no-break space before AM/PM; browsers use a plain
- // space. One space everywhere keeps copy and tests the same on every runtime.
- return d
- .toLocaleTimeString(opts.locale, { ...TIME, ...(opts.timeZone ? { timeZone: opts.timeZone } : {}) })
- .replace(/\u202f/g, ' ');
+ return clockParts(d, 'short', opts);
}
-/** "8:15:02 PM" / "20:15:02": the device's clock with seconds, for step-by-step logs. */
+/** "8:15:02\u00a0PM" / "20:15:02": the device's clock with seconds, for step-by-step logs. Same AM/PM rule. */
export function secondsText(at: When, opts: ClockOpts = {}): string | null {
const d = toDate(at);
if (!d) return null;
- return d
- .toLocaleTimeString(opts.locale, { timeStyle: 'medium', ...(opts.timeZone ? { timeZone: opts.timeZone } : {}) })
- .replace(/\u202f/g, ' ');
+ return clockParts(d, 'medium', opts);
}
/** "Nov 3" / "3 Nov", with the weekday ("Tue, Nov 3") or year ("Nov 3, 2026") when asked. */
diff --git a/frontend/src/components/JiraSettings.tsx b/frontend/src/components/JiraSettings.tsx
index e9a9f400..addd9f38 100644
--- a/frontend/src/components/JiraSettings.tsx
+++ b/frontend/src/components/JiraSettings.tsx
@@ -6,6 +6,7 @@ import { Loader2, Pencil, Power, RefreshCw, Ticket as TicketIcon } from 'lucide-
import type { DevTeamRef } from '../devMode';
import { JIRA_CHANGED_EVENT, JIRA_COPY, JiraState, hhmm, jiraApi, jiraHint, jiraHost, jiraStore, ticketSummary, tokenLine } from '../dev/jiraSetup';
import { storeApi } from '../passwordStore';
+import { atClock } from '../clock';
import { TeamFaces } from './TeamFaces';
import { openJiraSetup } from './JiraSetup';
@@ -224,7 +225,7 @@ export const JiraSettings: React.FC<{
</p>
<p className={`flex items-center gap-2 text-[11px] ${rejected ? 'text-rose-300' : 'text-zinc-400'}`} data-jira-status>
<span className={`w-1.5 h-1.5 rounded-full ${rejected ? 'bg-rose-400' : 'bg-teal-300'}`} aria-hidden="true" />
- {rejected ? `Jira stopped accepting the token at ${hhmm(rejected)}. Nothing new is picked up.` : `${site.polled_at ? `Checked ${hhmm(site.polled_at)} · ` : ''}${ticketSummary(jira.tickets)}`}
+ {rejected ? `Jira stopped accepting the token ${atClock(rejected)}. Nothing new is picked up.` : `${site.polled_at ? `Checked ${hhmm(site.polled_at)} · ` : ''}${ticketSummary(jira.tickets)}`}
</p>
<dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs">
{kv.map(([k, v]) => (
diff --git a/frontend/src/dev/prepush.ts b/frontend/src/dev/prepush.ts
index e351539d..40d049ff 100644
--- a/frontend/src/dev/prepush.ts
+++ b/frontend/src/dev/prepush.ts
@@ -535,7 +535,7 @@ export function storyOf(c: PrepushCard, cards: PrepushCard[], bot: string, appro
const at = c.status === 'pushed' ? (usedAt(c) ?? c.updated_at) : null;
// One source for the override's first line: the card renders it as the lead (Mira FIX 2).
const lead = overriddenLine(c, bot);
- if (at !== null || c.status === 'pushed') return { step: 'pushed', lead, now: pushedLine(at), next: null, at, approval: null };
+ if (at !== null || c.status === 'pushed') return { step: 'pushed', lead, now: pushedLine(at, now), next: null, at, approval: null };
const exp = c.grant?.expires_at ?? null;
if (c.grant && c.grant.used_at === null && exp !== null && now >= exp)
// Ada (Nov 13), Mira's FIX 7 rule: in an expired step the lead drops its promise.
@@ -551,7 +551,7 @@ export function storyOf(c: PrepushCard, cards: PrepushCard[], bot: string, appro
const next = followUp(c, cards);
const at = usedAt(next, c);
const base = { lead, next, approval: null, at: null };
- if (at !== null) return { ...base, step: 'pushed', now: pushedLine(at), at };
+ if (at !== null) return { ...base, step: 'pushed', now: pushedLine(at, now), at };
// The lead says only what the person did once its promise no longer holds (Mira FIX 7, Ada round 3).
const plain = `You asked ${bot} to fix this and push again.`;
const exp = c.grant?.expires_at ?? null;
@@ -606,7 +606,11 @@ export function liveCard(c: PrepushCard, cards: PrepushCard[]): PrepushCard {
return cur;
}
-export const pushedLine = (at: number | null): string => (hhmm(at) ? `Pushed · ${hhmm(at)}` : 'Pushed');
+/** "Pushed · 8:15 PM" today, "Pushed · Nov 10, 8:15 PM" on another day (roadmap 19d). */
+export const pushedLine = (at: number | null, now: number = Date.now()): string => {
+ const t = at === null ? null : localClock(at, now);
+ return t ? `Pushed · ${t}` : 'Pushed';
+};
/** Mira FIX 3: "still" and "always ask" say the press covered the usual OK, not this kind. */
export const asksLine = (bot: string, a: PushApproval): string =>
a.reason ? `${bot}'s push still needs your OK. ${a.reason.charAt(0).toUpperCase()}${a.reason.slice(1)}. Pushes like this always ask, every time.` : `${bot}'s push still needs your OK. Pushes like this always ask, every time.`;
diff --git a/frontend/tests/botActions.test.mjs b/frontend/tests/botActions.test.mjs
index 6ab352ca..e955d390 100644
--- a/frontend/tests/botActions.test.mjs
+++ b/frontend/tests/botActions.test.mjs
@@ -13,7 +13,7 @@ const ui = await loadBundled(`
`);
// Visible text only, so assertions don't match class names or ids.
-const text = (html) => html.replace(/<[^>]+>/g, ' ').replace(/’/g, "'").replace(/&#x27;|&#39;/g, "'").replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/\s+/g, ' ').trim();
+const text = (html) => html.replace(/<[^>]+>/g, ' ').replace(/’/g, "'").replace(/&#x27;|&#39;/g, "'").replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/[^\S\u00a0]+/g, ' ').trim();
const buttons = (html) => [...html.matchAll(/<button[^>]*>([\s\S]*?)<\/button>/g)].map((m) => text(m[1]));
const routineMeta = (over = {}) => ({
@@ -47,7 +47,7 @@ test('applied routine card: summary, routine facts, Undo, Edit and Pause', () =>
const t = text(html);
assert.match(t, /Coach set up a routine/);
assert.match(t, /Created routine 'Morning motivation'/);
- assert.match(t, /When Every day at 7:00 AM, Berlin time/);
+ assert.match(t, /When Every day at 7:00\u00a0AM, Berlin time/);
assert.match(t, /Runs as Coach/);
assert.match(t, /Posts in #general/);
assert.match(t, /Next run/);
@@ -138,7 +138,7 @@ test('non-routine actions: no routine facts, verb fallback', () => {
});
test('schedules in words: ours for known shapes, the server text otherwise', () => {
- assert.equal(b.scheduleWords({ type: 'monthly', time: '09:00', days: [1, 'last'], tz: 'UTC' }), 'Every month on the 1st and last day at 9:00 AM, UTC');
+ assert.equal(b.scheduleWords({ type: 'monthly', time: '09:00', days: [1, 'last'], tz: 'UTC' }), 'Every month on the 1st and last day at 9:00\u00a0AM, UTC');
assert.equal(b.scheduleWords({ type: 'cron', expression: '0 9 * * MON#2', tz: 'UTC' }), 'Custom rule 0 9 * * MON#2, UTC');
assert.equal(b.scheduleWords({ type: 'lunar' }, 'when the moon is full'), 'When the moon is full');
assert.equal(b.scheduleWords(null, ''), 'Unknown schedule');
@@ -343,7 +343,7 @@ test('a follow-up card says when it runs in local words, never the raw ISO time'
assert.doesNotMatch(shown, /2026-11-06T|14:00:00Z/, shown);
const d = new Date(at);
const day = d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' });
- const time = d.toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/\u202f/g, ' ');
+ const time = d.toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/[\u202f ](AM|PM)/, '\u00a0$1');
assert.match(shown, new RegExp(`once on ${day} at ${time}`), shown);
assert.equal(b.summaryText(b.parseBotActionMeta(meta)), `scheduled a follow-up 'Follow-up: check the deploy', once on ${day} at ${time}, in the thread "Deploy"`);
// A summary whose schedule we can't read stays as the server wrote it.
diff --git a/frontend/tests/continuity.test.mjs b/frontend/tests/continuity.test.mjs
index a2bef3f9..7a652636 100644
--- a/frontend/tests/continuity.test.mjs
+++ b/frontend/tests/continuity.test.mjs
@@ -197,7 +197,7 @@ test('monthly and cron schedules in plain words', () => {
assert.equal(c.monthDaysText([15, 'last', 1]), 'the 1st, 15th and last day');
assert.equal(c.monthDaysText([2, 3, 11, 12, 13, 21, 22, 23]), 'the 2nd, 3rd, 11th, 12th, 13th, 21st, 22nd and 23rd');
assert.equal(c.monthDaysText(['last']), 'the last day');
- assert.equal(c.describeSchedule({ type: 'monthly', time: '09:00', days: [1], tz: 'UTC' }), 'Every month on the 1st at 9:00 AM, UTC');
+ assert.equal(c.describeSchedule({ type: 'monthly', time: '09:00', days: [1], tz: 'UTC' }), 'Every month on the 1st at 9:00\u00a0AM, UTC');
assert.equal(c.describeSchedule({ type: 'cron', expression: '0 9 * * MON#2', tz: 'UTC' }), 'Custom rule 0 9 * * MON#2, UTC');
assert.equal(c.describeSchedule({ type: 'lunar' }), 'Unknown schedule');
});
@@ -246,14 +246,14 @@ test('sameDays: the Weekdays chip is on only for exactly Mon–Fri', () => {
test('describeSchedule writes the zone as a city and names common day sets', () => {
const w = (weekdays) => c.describeSchedule({ type: 'weekly', time: '09:00', weekdays, tz: 'Europe/Kyiv' });
- assert.equal(c.describeSchedule({ type: 'daily', time: '09:00', tz: 'Europe/Kyiv' }), 'Every day at 9:00 AM, Kyiv time');
- assert.equal(w(['mon']), 'Every Monday at 9:00 AM, Kyiv time');
- assert.equal(w(['fri', 'mon', 'wed']), 'Mon, Wed and Fri at 9:00 AM, Kyiv time');
- assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri']), 'Weekdays at 9:00 AM, Kyiv time');
- assert.equal(w(['sat', 'sun']), 'Weekends at 9:00 AM, Kyiv time');
- assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']), 'Every day at 9:00 AM, Kyiv time');
- assert.equal(w(['tue', 'thu']), 'Tue and Thu at 9:00 AM, Kyiv time');
- assert.equal(c.describeSchedule({ type: 'monthly', time: '07:00', days: [1], tz: 'Europe/Kyiv' }), 'Every month on the 1st at 7:00 AM, Kyiv time');
+ assert.equal(c.describeSchedule({ type: 'daily', time: '09:00', tz: 'Europe/Kyiv' }), 'Every day at 9:00\u00a0AM, Kyiv time');
+ assert.equal(w(['mon']), 'Every Monday at 9:00\u00a0AM, Kyiv time');
+ assert.equal(w(['fri', 'mon', 'wed']), 'Mon, Wed and Fri at 9:00\u00a0AM, Kyiv time');
+ assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri']), 'Weekdays at 9:00\u00a0AM, Kyiv time');
+ assert.equal(w(['sat', 'sun']), 'Weekends at 9:00\u00a0AM, Kyiv time');
+ assert.equal(w(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']), 'Every day at 9:00\u00a0AM, Kyiv time');
+ assert.equal(w(['tue', 'thu']), 'Tue and Thu at 9:00\u00a0AM, Kyiv time');
+ assert.equal(c.describeSchedule({ type: 'monthly', time: '07:00', days: [1], tz: 'Europe/Kyiv' }), 'Every month on the 1st at 7:00\u00a0AM, Kyiv time');
assert.equal(c.describeSchedule({ type: 'cron', expression: '0 9 * * MON#2', tz: 'Europe/Kyiv' }), 'Custom rule 0 9 * * MON#2, Kyiv time');
assert.equal(c.describeSchedule({ type: 'interval', every_minutes: 120 }), 'Every 2 h');
});
diff --git a/frontend/tests/devAnyGit.test.mjs b/frontend/tests/devAnyGit.test.mjs
index 1757b479..0dde425a 100644
--- a/frontend/tests/devAnyGit.test.mjs
+++ b/frontend/tests/devAnyGit.test.mjs
@@ -84,7 +84,7 @@ test('provider beats the host guess: a GitHub Enterprise host the server calls g
assert.equal(m.gitOnlyRepo(s, 'ghe.example.test/demo/core'), false);
assert.equal(m.statusLine(s).note, null, 'no plain-git line');
assert.deepEqual(texts(m.statusLine(s).parts), ['Watching ', 'demo/core', ' · ', 'main']);
- assert.equal(m.repoRows(state({ repos: [APP, GHE] }))[1].state, 'Watching · checked 9:00 AM');
+ assert.equal(m.repoRows(state({ repos: [APP, GHE] }))[1].state, 'Watching · checked 9:00\u00a0AM');
// The same row from an older server is guessed as plain git.
assert.ok(m.gitOnlyRepo(state({ repos: [noProvider(GHE)] }), 'ghe.example.test/demo/core'));
// Rendered: what the desk passes to the card for this repo keeps the CI tile and Post.
@@ -133,11 +133,11 @@ test('watching (GitHub): no quiet line, cards keep CI and Post', () => {
test('watching (a folder with no remote): read with git, "Landed changes only", counted as watched', () => {
const s = state({ repos: [APP, NOTES] });
const rows = m.repoRows(s);
- assert.equal(rows[1].state, 'Landed changes only · checked 9:00 AM');
+ assert.equal(rows[1].state, 'Landed changes only · checked 9:00\u00a0AM');
assert.equal(rows[1].led, 'ok');
assert.equal(rows[1].note, LOCAL_TIP);
assert.equal(rows[1].origin, 'From Notes’s folder');
- assert.equal(rows[0].state, 'Watching · checked 9:00 AM');
+ assert.equal(rows[0].state, 'Watching · checked 9:00\u00a0AM');
assert.equal(rows[0].note, null);
assert.equal(m.repoRows(state({ repos: [APP, { ...NOTES, polled_at: null }] }))[1].state, 'Landed changes only');
assert.equal(m.reposSummary(s), 'Watching 2 repos');
@@ -145,7 +145,7 @@ test('watching (a folder with no remote): read with git, "Landed changes only",
assert.deepEqual(m.repoFilters(s).map((f) => f.label), ['app', 'notes']);
const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: s });
assert.match(out, /data-dv-repo-note="true">Read from Notes’s folder on the server/);
- assert.match(out, /data-dv-repo-state="true" aria-describedby="([^"]+-note-1)">Landed changes only · checked 9:00 AM<\/span>/);
+ assert.match(out, /data-dv-repo-state="true" aria-describedby="([^"]+-note-1)">Landed changes only · checked 9:00\u00a0AM<\/span>/);
assert.doesNotMatch(out, /Local folder, no remote/);
// The 0.7.1 shape (no repos[]): a local source is no longer turned into other_host.
const legacy = m.parseDevMode({ on: true, status: 'watching', repo: 'notes', sources: [{ team: 'Notes', repo: 'notes', host: null, from: 'local' }] });
@@ -238,7 +238,7 @@ test('too big (error): the row always reads "Too big to read"; the quiet line is
assert.match(out, /Too big to read/);
}
// A code on a non-error row changes nothing.
- assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, poll_code: 'too_big' }] }))[1].state, 'Landed changes only · checked 9:00 AM');
+ assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, poll_code: 'too_big' }] }))[1].state, 'Landed changes only · checked 9:00\u00a0AM');
// Any other error keeps "Can't read it right now".
assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, status: 'error', poll_error: 'Couldn’t reach the repo’s host.' }] }))[1].state, 'Can’t read it right now. Trying again.');
assert.equal(m.devSubLine(state({ repos: [cap] })).parts[0].text, 'Can’t read a repo');
diff --git a/frontend/tests/devAutodetect.test.mjs b/frontend/tests/devAutodetect.test.mjs
index 3e38e9f1..3d800655 100644
--- a/frontend/tests/devAutodetect.test.mjs
+++ b/frontend/tests/devAutodetect.test.mjs
@@ -240,7 +240,7 @@ test('PX-2 (style-v2 §3/§4): header chip and subtitle, LED per status, Checked
const { root } = await desk({ status: st, ...extra }, { onOpenLooseEnds() {} });
const line = document.querySelector('[data-dv-status]');
assert.equal(line.querySelector('[data-dv-led]').dataset.s, want[st], `${st}: LED`);
- assert.match(line.querySelector('[data-dev-checked]').textContent, /^Checked \d{1,2}:\d\d [AP]M$/, `${st}: Checked lives in the status line`);
+ assert.match(line.querySelector('[data-dev-checked]').textContent, /^Checked \d{1,2}:\d\d\u00a0[AP]M$/, `${st}: Checked lives in the status line`);
assert.equal(document.querySelectorAll('[data-dev-checked]').length, 1, `${st}: not in the header too`);
root.unmount();
}
diff --git a/frontend/tests/devCards.test.mjs b/frontend/tests/devCards.test.mjs
index 39054e83..c7d79904 100644
--- a/frontend/tests/devCards.test.mjs
+++ b/frontend/tests/devCards.test.mjs
@@ -164,7 +164,7 @@ test('B1: a direct commit (pr null) parses and draws as a normal landed card nam
assert.match(out, /class="kw-chip">Direct push</);
assert.match(out, /<a href="https:\/\/github\.com\/alexsergivan\/kwant\/commit\/c0ffee1"/);
assert.doesNotMatch(out, /PR #/);
- assert.match(out, /Committed 7:02 PM/);
+ assert.match(out, /Committed 7:02\u00a0PM/);
assert.doesNotMatch(out, />Verified</);
assert.doesNotMatch(out, /data-verified/);
assert.doesNotMatch(out, /text-warn|kw-chip-warn|amber/, 'no warning tone: like an old merge with no reviewer');
@@ -203,7 +203,7 @@ test('the landed card: plain words, the details fold, a failed card and day sepa
assert.match(c, /What changes for you/);
assert.match(c, /<details/);
assert.match(c, /Under the hood<\/span><span aria-hidden="true">·<\/span><span class="font-mono[^"]*">4 files<\/span><span role="img" aria-label="249 lines added, 15 removed"/);
- assert.match(c, /Merged 6:48 PM by/);
+ assert.match(c, /Merged 6:48\u00a0PM by/);
assert.match(c, /Pixel<\/span><\/span><span>\(bot · Claude Sonnet\)/);
const f = html(m.LandedCard, { card: landed(fx.LANDED_NO_TEXT) });
assert.match(f, /Bump vite to 6\.4\.4/);
@@ -231,7 +231,7 @@ test('roll-up: title, needs-you tiles, +N more, the empty state, no routine link
assert.match(html(m.Rollup, { ...base, rollup: fx.ROLLUP_MANY }), /\+4 more areas/);
assert.match(html(m.Rollup, { ...base, rollup: fx.ROLLUP_MANY }), /main is red/);
const e = html(m.Rollup, { ...base, rollup: fx.ROLLUP_EMPTY, last_merge: { pr: 290, merged_at: '2026-11-04T19:26:00Z' } });
- assert.match(e, /Nothing landed since you last looked\. Last merge: #290, 7:26 PM\./);
+ assert.match(e, /Nothing landed since you last looked\. Last merge: #290, 7:26\u00a0PM\./);
assert.deepEqual(m.needsYouAreas(fx.LANDED_ROUTE.cards.map((c) => m.parseLanded(c))), ['Chat', 'Live activity']);
const { branch: _b, ...noBranch } = base;
@@ -541,7 +541,7 @@ test('Fix it sends the finding and offers Undo for 10 s', async () => {
});
await click(button(host.querySelector('[data-finding="f1"]'), 'Fix it'));
const row = host.querySelector('[data-finding="f1"]');
- assert.match(row.textContent, /Sent to Pixel as a task · 1:00 AM/);
+ assert.match(row.textContent, /Sent to Pixel as a task · 1:00\u00a0AM/);
assert.match(button(row, 'Undo').textContent, /8 s/);
await click(button(row, 'Undo'));
assert.deepEqual(actions, [['f1', 'fix'], ['f1', 'undo_fix']]);
diff --git a/frontend/tests/devMode.test.mjs b/frontend/tests/devMode.test.mjs
index 567a3575..80d1e623 100644
--- a/frontend/tests/devMode.test.mjs
+++ b/frontend/tests/devMode.test.mjs
@@ -744,7 +744,7 @@ test('round 2: the Dev desk header shows the repo chip and when it was checked;
const chip = host.querySelector('[data-dev-repo-chip]');
assert.equal(chip.textContent, 'demo-org/demo-app · trunk');
assert.ok(chip.classList.contains('hidden') && chip.classList.contains('sm:inline-flex'), 'chip hides at 390');
- assert.match(host.querySelector('[data-dev-checked]').textContent, /^Checked \d{1,2}:\d\d [AP]M$/);
+ assert.match(host.querySelector('[data-dev-checked]').textContent, /^Checked \d{1,2}:\d\d\u00a0[AP]M$/);
// style-v2 §3: tabs are .kw-dv-tab (44 px under 640 px in devStatus.css), active = 2 px underline.
for (const t of host.querySelectorAll('[role="tab"]')) assert.ok(t.classList.contains('kw-dv-tab'));
root.unmount();
diff --git a/frontend/tests/devTeamRepos.test.mjs b/frontend/tests/devTeamRepos.test.mjs
index 2f895d98..b4e3bd75 100644
--- a/frontend/tests/devTeamRepos.test.mjs
+++ b/frontend/tests/devTeamRepos.test.mjs
@@ -153,7 +153,7 @@ test('two repos: "Watching 2 repos" over two rows, open', () => {
const l = m.statusLine(state({ repos: [APP, SITE] }), TEAMS);
assert.equal(text(l), 'Watching 2 repos');
assert.equal(l.collapsed, false);
- assert.deepEqual(l.rows.map((r) => [r.team, r.repo.repo, r.repo.branch, r.state.replace(/\d{1,2}:\d\d( [AP]M)?/, 'HH:MM'), r.origin, r.action]), [
+ assert.deepEqual(l.rows.map((r) => [r.team, r.repo.repo, r.repo.branch, r.state.replace(/\d{1,2}:\d\d(\u00a0[AP]M)?/, 'HH:MM'), r.origin, r.action]), [
['App', 'demo-org/app', 'main', 'Watching · checked HH:MM', 'From App’s folder', null],
['Site', 'demo-org/site', 'trunk', 'Watching · checked HH:MM', 'From Site’s repo link', null],
]);
@@ -169,7 +169,7 @@ test('four rows fold behind the summary; each status has its words, LED and at m
assert.equal(l.collapsed, true);
assert.equal(text(l), 'Watching 1 of 5 repos · 2 need you', 'needs you = not_connected + error');
assert.equal(l.led, 'bad', 'a failing repo lights the line red');
- assert.deepEqual(l.rows.map((r) => [r.state.replace(/\d{1,2}:\d\d( [AP]M)?/, 'HH:MM'), r.led, r.action]), [
+ assert.deepEqual(l.rows.map((r) => [r.state.replace(/\d{1,2}:\d\d(\u00a0[AP]M)?/, 'HH:MM'), r.led, r.action]), [
['Watching · checked HH:MM', 'ok', null],
['Needs your GitHub connection', 'warn', 'connect'],
['Can’t read it right now. Trying again.', 'bad', 'remove'],
@@ -336,12 +336,12 @@ test('Ada (0.7.2): linking a repo while Dev mode is off sends on: false, and the
assert.equal(server.state.on, false);
});
-test('Ada (0.7.2): repo rows say "checked 3:30 PM" in the desk header’s format (the device clock)', () => {
+test('Ada (0.7.2): repo rows say "checked 3:30\u00a0PM" in the desk header’s format (the device clock)', () => {
const at = new Date(2026, 10, 6, 15, 30).toISOString();
const l = m.statusLine(state({ repos: [{ ...APP, polled_at: at }, SITE] }), TEAMS);
- assert.equal(l.rows[0].state, 'Watching · checked 3:30 PM');
+ assert.equal(l.rows[0].state, 'Watching · checked 3:30\u00a0PM');
assert.equal(m.checkedTime(at), m.checkedLabel(Date.parse(at)));
- assert.equal(m.checkedTime(new Date(2026, 10, 6, 9, 5).toISOString()), '9:05 AM');
+ assert.equal(m.checkedTime(new Date(2026, 10, 6, 9, 5).toISOString()), '9:05\u00a0AM');
});
test('DOM: Esc closes the Link field and puts focus back on its button', async () => {
diff --git a/frontend/tests/failover.test.mjs b/frontend/tests/failover.test.mjs
index e3954f25..5e3827cd 100644
--- a/frontend/tests/failover.test.mjs
+++ b/frontend/tests/failover.test.mjs
@@ -40,8 +40,8 @@ test('status words: Ready, Out until a local time, Signed out', () => {
const out = m.priorityStatus(list[0], engine('claude'), NOW);
assert.equal(out.tone, 'warn');
assert.match(out.label, /^Out until /);
- assert.match(out.label, /3:00 AM/);
- assert.match(out.label, /^Out until \w{3} 3:00 AM$/, 'a reset on another day names the day');
+ assert.match(out.label, /3:00\u00a0AM/);
+ assert.match(out.label, /^Out until \w{3} 3:00\u00a0AM$/, 'a reset on another day names the day');
assert.equal(m.priorityStatus(list[3], engine('grok'), NOW).label, 'Signed out');
assert.equal(m.priorityStatus(profile({ last_error: 'auth' }), engine('claude'), NOW).label, 'Signed out');
assert.equal(m.priorityStatus(profile({ enabled: false, limited_until: '2026-11-03T03:00:00' }), engine('claude'), NOW).label, 'Off');
@@ -49,7 +49,7 @@ test('status words: Ready, Out until a local time, Signed out', () => {
// A limit that has passed is Ready again, with no action.
assert.equal(m.priorityStatus(profile({ limited_until: '2026-11-02T19:00:00' }), engine('claude'), NOW).label, 'Ready');
// Same-day reset is the bare time.
- assert.equal(m.priorityStatus(profile({ limited_until: '2026-11-02T23:30:00' }), engine('claude'), NOW).label, 'Out until 11:30 PM');
+ assert.equal(m.priorityStatus(profile({ limited_until: '2026-11-02T23:30:00' }), engine('claude'), NOW).label, 'Out until 11:30\u00a0PM');
});
test('moving rewrites only the priorities that change', () => {
@@ -93,12 +93,12 @@ test('the list groups accounts by how bots use them, titled by the AI, with a st
test('the failover notice is one short line, naming the limit time and the model', () => {
const e = { kwant_id: 'k', from_profile_id: 'c1', from_name: 'Work', to_profile_id: 'x1', to_name: 'Personal', class: 'quota',
retry_at: '2026-11-02T23:30:00', from_engine: 'claude', to_engine: 'codex', to_model: 'GPT-6.1' };
- assert.equal(m.failoverNotice(e, NOW), 'Claude is out until 11:30 PM · answered on Codex (GPT-6.1)');
+ assert.equal(m.failoverNotice(e, NOW), 'Claude is out until 11:30\u00a0PM · answered on Codex (GPT-6.1)');
assert.equal(m.failoverNotice({ ...e, class: 'auth', retry_at: undefined }, NOW), 'Claude is signed out · answered on Codex (GPT-6.1)');
assert.equal(m.failoverNotice({ ...e, retry_at: undefined }, NOW), 'Claude is out of usage · answered on Codex (GPT-6.1)');
// An older server sends no engine or model: the account names stand in.
assert.equal(m.failoverNotice({ ...e, from_engine: undefined, to_engine: undefined, to_model: undefined, retry_at: undefined }, NOW), 'Work is out of usage · answered on Personal');
- assert.equal(m.failoverNotice({ ...e, to_model: undefined, to_model_label: 'GPT-6.1' }, NOW), 'Claude is out until 11:30 PM · answered on Codex (GPT-6.1)');
+ assert.equal(m.failoverNotice({ ...e, to_model: undefined, to_model_label: 'GPT-6.1' }, NOW), 'Claude is out until 11:30\u00a0PM · answered on Codex (GPT-6.1)');
});
test('a chat is told once per outage', () => {
@@ -143,7 +143,7 @@ test('a saved reply reads its notice from meta.failover, so it survives a reload
const sw = { kwant_id: 'k', from_profile_id: 'c1', to_profile_id: 'x1', from_name: 'Work', to_name: 'Personal', class: 'quota', retry_at: '2026-11-03T02:00:00Z', from_engine: 'claude', to_engine: 'codex', to_model: 'gpt-6.1' };
const now = Date.parse('2026-11-02T20:00:00Z');
const line = m.savedFailoverNotice(JSON.stringify({ failover: [sw] }), now);
- assert.match(line, /^Claude is out until .*\d{1,2}:\d\d [AP]M · answered on Codex \(gpt-6\.1\)$/);
+ assert.match(line, /^Claude is out until .*\d{1,2}:\d\d\u00a0[AP]M · answered on Codex \(gpt-6\.1\)$/);
// Already parsed, and a single object, read the same.
assert.equal(m.savedFailoverNotice({ failover: sw }, now), line);
// Two switches in one reply: first account out, last one answered.
diff --git a/frontend/tests/goals.test.mjs b/frontend/tests/goals.test.mjs
index 40ffcb99..5af51c61 100644
--- a/frontend/tests/goals.test.mjs
+++ b/frontend/tests/goals.test.mjs
@@ -31,7 +31,7 @@ const b = await loadBundled(`
export const detailHtml = (p) => renderToStaticMarkup(React.createElement(GoalDetailBody, { busy: false, error: null, onAction() {}, ...p }));
`);
-const text = (html) => html.replace(/<[^>]+>/g, ' ').replace(/&#x27;|&#39;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/\s+/g, ' ').trim();
+const text = (html) => html.replace(/<[^>]+>/g, ' ').replace(/&#x27;|&#39;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/[^\S\u00a0]+/g, ' ').trim();
const settle = async (ms = 0) => {
if (ms) await new Promise((r) => setTimeout(r, ms));
for (let i = 0; i < 10; i++) await new Promise((r) => setTimeout(r, 0));
@@ -623,11 +623,11 @@ test('D1/D3: Not now calls the route once, silently; the goal then reads Failing
const server = goal({ id: 'g1', status: 'needs_you', status_reason: 'declined', checks: [failedCheck()], open_mission: incident().open_mission });
assert.equal(b.displayStatus(server, [], NOW), 'not_met');
assert.equal(b.goalDecision(server, [], NOW).kind, 'declined');
- assert.equal(b.declinedText(minsAgo(0), NOW), 'You chose Not now at ' + new Date(NOW).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + '. The fix waits; it’s dropped if this recovers.');
+ assert.equal(b.declinedText(minsAgo(0), NOW), 'You chose Not now at ' + new Date(NOW).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }).replace(/[\u202f ](AM|PM)/, '\u00a0$1') + '. The fix waits; it’s dropped if this recovers.');
assert.match(b.declinedText(null, NOW), /^Not now\./);
// 18d: a Not now from another day says its day, "on Nov 1 at 9:40 AM", never "at Nov 1, 9:40 AM".
const day = new Date(NOW - 26 * 3600_000);
- const want = `on ${day.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })} at ${day.toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/\u202f/g, ' ')}`;
+ const want = `on ${day.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })} at ${day.toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/[\u202f ](AM|PM)/, '\u00a0$1')}`;
assert.equal(b.declinedText(day.toISOString(), NOW), `You chose Not now ${want}. The fix waits; it’s dropped if this recovers.`);
});
diff --git a/frontend/tests/h5Followups.test.mjs b/frontend/tests/h5Followups.test.mjs
index 2324f1c7..92a20083 100644
--- a/frontend/tests/h5Followups.test.mjs
+++ b/frontend/tests/h5Followups.test.mjs
@@ -85,7 +85,7 @@ test('N2: gave up reads "stopped after 2 tries"; needs-you still beats stuck; st
const needs = m.needsYouRows([item('question', 'lin', { timestamp: at(1) })], {}, all);
const att = m.attentionRows({ kwants, needs, failed: [], finished: [], busy: {}, status: {}, h4, now: NOW });
assert.deepEqual(order(att).slice(0, 3), ['1:Lin', '2:Rigel', '2:Vega']);
- assert.equal(att.find((r) => r.kwant.id === 'veg').line, 'Stuck: stopped after 2 tries · 11:55 AM');
+ assert.equal(att.find((r) => r.kwant.id === 'veg').line, 'Stuck: stopped after 2 tries · 11:55\u00a0AM');
assert.equal(att.find((r) => r.kwant.id === 'rig').line, 'Stuck: the AI stopped answering');
});
@@ -124,11 +124,11 @@ test('N3: a held reply becomes a held line; only gave-up offers Try again', () =
const gaveUp = m.heldLine(hs, st('jun', 'stuck', { reason_code: 'stalled_gave_up', stuck: { gave_up_at: '2026-11-10T11:50:00Z', tries: 2 } }));
assert.equal(gaveUp.tryAgain, true);
- assert.equal(gaveUp.text, 'Waiting for Juno: Juno stopped after 2 tries at 11:50 AM. Your message is kept and goes through when Juno runs again.');
+ assert.equal(gaveUp.text, 'Waiting for Juno: Juno stopped after 2 tries at 11:50\u00a0AM. Your message is kept and goes through when Juno runs again.');
const q = m.heldLine(m.heldFromReply(reply('waits_on_you', { question: { asked_at: '2026-11-10T14:08:00Z' } }), 't2'));
assert.equal(q.tryAgain, false);
- assert.equal(q.text, 'Queued for Juno: Juno is waiting for your answer to its question (2:08 PM). It goes through when you answer.');
+ assert.equal(q.text, 'Queued for Juno: Juno is waiting for your answer to its question (2:08\u00a0PM). It goes through when you answer.');
assert.equal(m.heldLine(m.heldFromReply(reply('paused'), 't3')).tryAgain, false);
});
diff --git a/frontend/tests/heldReload.test.mjs b/frontend/tests/heldReload.test.mjs
index c879c5c8..cae34611 100644
--- a/frontend/tests/heldReload.test.mjs
+++ b/frontend/tests/heldReload.test.mjs
@@ -20,7 +20,7 @@ test('reload with 1 held message: its line comes back from the status, with Try
assert.deepEqual([rows[0].messageId, rows[0].kwantId, rows[0].name, rows[0].reason], ['m-1', 'jun', 'Juno', 'stuck']);
const line = m.heldLine(rows[0], status.jun);
assert.equal(line.tryAgain, true);
- assert.match(line.text, /^Waiting for Juno: Juno stopped after 2 tries at 4:05 AM\. Your message is kept/);
+ assert.match(line.text, /^Waiting for Juno: Juno stopped after 2 tries at 4:05\u00a0AM\. Your message is kept/);
});
test('reload with 3 held messages to one bot: every one gets its own line; hand-offs get none', () => {
@@ -44,7 +44,7 @@ test('a waits_on_you hold rebuilt from the status keeps the question time; unkno
const s = m.parseH4Status({ kwant_id: 'lin', status: 'needs_you', reason_code: 'asked_question', question: { id: 'q', asked_at: '2026-11-11T03:58:00Z' }, held: [msg('m-7', { reason_code: 'waits_on_you' })] });
const [row] = m.heldMessages([], { lin: s }, nameOf);
assert.equal(row.reason, 'waits_on_you');
- assert.match(m.heldLine(row, s).text, /^Queued for Lin: Lin is waiting for your answer to its question \(3:58 AM\)\./);
+ assert.match(m.heldLine(row, s).text, /^Queued for Lin: Lin is waiting for your answer to its question \(3:58\u00a0AM\)\./);
const [anon] = m.heldMessages([], { zed: { ...s, kwant_id: 'zed' } }, nameOf);
assert.equal(anon.name, 'The bot');
});
diff --git a/frontend/tests/inboxAway095.test.mjs b/frontend/tests/inboxAway095.test.mjs
index a5b2460f..9118ae3c 100644
--- a/frontend/tests/inboxAway095.test.mjs
+++ b/frontend/tests/inboxAway095.test.mjs
@@ -70,20 +70,20 @@ test('sections: Needs you holds waiting and failed, Done holds to review and fin
test('meta line: what ran, when, and why; without the run it leaves the why out', () => {
const it = fx.AWAY_ROUTINE_REVIEW;
const SAME_DAY = Date.parse('2026-11-11T23:30:00Z'); // the run's own day
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, fx.AWAY_RUN, SAME_DAY), 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM because you pressed Run now');
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'schedule' }, SAME_DAY), 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM on schedule');
- assert.equal(a.metaLine({ ...it, source: undefined }, null, null, SAME_DAY), 'Ben · routine · ran 10:51 PM');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, fx.AWAY_RUN, SAME_DAY), 'Ben · routine, every Mon 9:00\u00a0AM · ran 10:51\u00a0PM because you pressed Run now');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'schedule' }, SAME_DAY), 'Ben · routine, every Mon 9:00\u00a0AM · ran 10:51\u00a0PM on schedule');
+ assert.equal(a.metaLine({ ...it, source: undefined }, null, null, SAME_DAY), 'Ben · routine · ran 10:51\u00a0PM');
// Part B's source.trigger, when the run isn't loaded; an app event says so (Needs B 5).
- assert.equal(a.metaLine(it, null, null, SAME_DAY), 'Ben · routine · ran 10:51 PM because you pressed Run now');
- assert.equal(a.metaLine({ ...it, source: { ...it.source, trigger: 'event' } }, null, null, SAME_DAY), 'Ben · routine · ran 10:51 PM on an app event');
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'event' }, SAME_DAY), 'Ben · routine, every Mon 9:00 AM · ran 10:51 PM on an app event');
+ assert.equal(a.metaLine(it, null, null, SAME_DAY), 'Ben · routine · ran 10:51\u00a0PM because you pressed Run now');
+ assert.equal(a.metaLine({ ...it, source: { ...it.source, trigger: 'event' } }, null, null, SAME_DAY), 'Ben · routine · ran 10:51\u00a0PM on an app event');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, { ...fx.AWAY_RUN, trigger: 'event' }, SAME_DAY), 'Ben · routine, every Mon 9:00\u00a0AM · ran 10:51\u00a0PM on an app event');
// 18d: read the next day (the fixture's own now), the time says its day; another year adds the year.
const NEXT_DAY = Date.parse(fx.AWAY_INBOX.now);
- assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, fx.AWAY_RUN, NEXT_DAY), 'Ben · routine, every Mon 9:00 AM · ran Nov 11, 10:51 PM because you pressed Run now');
- assert.equal(a.metaLine(fx.AWAY_HANDOFF, null, null, NEXT_DAY), 'Cody · finished Nov 11, 10:45 PM');
- assert.equal(a.metaLine(fx.AWAY_HANDOFF, null, null, Date.parse('2027-01-04T09:00:00Z')), 'Cody · finished Nov 11, 2026, 10:45 PM');
+ assert.equal(a.metaLine(it, fx.AWAY_ROUTINE, fx.AWAY_RUN, NEXT_DAY), 'Ben · routine, every Mon 9:00\u00a0AM · ran Nov 11, 10:51\u00a0PM because you pressed Run now');
+ assert.equal(a.metaLine(fx.AWAY_HANDOFF, null, null, NEXT_DAY), 'Cody · finished Nov 11, 10:45\u00a0PM');
+ assert.equal(a.metaLine(fx.AWAY_HANDOFF, null, null, Date.parse('2027-01-04T09:00:00Z')), 'Cody · finished Nov 11, 2026, 10:45\u00a0PM');
assert.equal(a.metaLine({ ...fx.AWAY_HANDOFF, timestamp: 'nope' }, null, null, NEXT_DAY), 'Cody', 'a bad time drops the time');
- assert.equal(a.scheduleShort({ type: 'daily', time: '08:30', tz: 'UTC' }), 'every day 8:30 AM');
+ assert.equal(a.scheduleShort({ type: 'daily', time: '08:30', tz: 'UTC' }), 'every day 8:30\u00a0AM');
assert.equal(a.scheduleShort({ type: 'interval', every_minutes: 120 }), 'every 2 h');
assert.equal(a.scheduleShort(null), '');
});
@@ -91,10 +91,10 @@ test('meta line: what ran, when, and why; without the run it leaves the why out'
test('trail: tool steps at their own time, thinking left out, then where the answer was written', () => {
const rows = a.trailFrom(fx.AWAY_MESSAGE, '@Spring launch');
assert.deepEqual(rows.map((r) => `${r.at} ${r.what}${r.detail ? ' · ' + r.detail : ''}`), [
- '10:51:02 PM Opened beanline.example.com · found House Blend 1 kg $24.00, 15% off until Mar 31',
- '10:51:05 PM Opened roastco.example.com · found 1 kg $27.00, free shipping over $40',
- '10:51:09 PM Compared with last Monday’s run · nothing changed',
- '10:51:10 PM Wrote the answer in @Spring launch',
+ '10:51:02\u00a0PM Opened beanline.example.com · found House Blend 1 kg $24.00, 15% off until Mar 31',
+ '10:51:05\u00a0PM Opened roastco.example.com · found 1 kg $27.00, free shipping over $40',
+ '10:51:09\u00a0PM Compared with last Monday’s run · nothing changed',
+ '10:51:10\u00a0PM Wrote the answer in @Spring launch',
]);
assert.deepEqual(a.trailFrom({ ...fx.AWAY_MESSAGE, meta: null }, 'x'), [], 'no saved steps: no made-up trail');
assert.deepEqual(a.trailFrom(null, 'x'), []);
@@ -168,7 +168,7 @@ test('pane order: meta, chips, answer with Open in chat, What Ben did, Why, then
for (let i = 1; i < els.length; i++) {
assert.ok(els[i - 1].compareDocumentPosition(els[i]) & Node.DOCUMENT_POSITION_FOLLOWING, `${order[i - 1]} comes before ${order[i]}`);
}
- assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 9:00 AM · ran Nov 11, 10:51 PM because you pressed Run now');
+ assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 9:00\u00a0AM · ran Nov 11, 10:51\u00a0PM because you pressed Run now');
assert.match(q('[data-chip="read-only"]').textContent, /Read only · changed nothing/);
assert.match(q('[data-chip="no-checks"]').textContent, /No checks set · Add one/);
// F2: a neutral chip, not amber; F1: the inline links stay compact and keep the 44 px tap area.
@@ -223,7 +223,7 @@ test('a team job opens in the pane: led-by meta, the lead’s answer, the team
const opened = [];
const { q, qa, root } = await mountInbox({ onOpenMessage: (t) => opened.push(t) });
await click(q('[data-option="tj-spring"]'));
- assert.equal(q('[data-done-meta]').textContent, 'Ann led Ben and Cody · finished Nov 11, 10:45 PM');
+ assert.equal(q('[data-done-meta]').textContent, 'Ann led Ben and Cody · finished Nov 11, 10:45\u00a0PM');
assert.equal(q('[data-done-answer] h3').textContent, 'Ann’s answer');
assert.match(q('[data-answer-text]').textContent, /^Done: Ben checked 2 shops/, 'the served excerpt, as text');
assert.equal(q('[data-done-trail] h3').textContent, 'What the team did');
@@ -258,7 +258,7 @@ test('F7: a finished hand-off with no review and no part B fields: summary answe
const chats = [];
const { q, root } = await mountInbox({ onOpen: (i) => chats.push(i.id) }, data);
await click(q('[data-option="d-spring"]'));
- assert.equal(q('[data-done-meta]').textContent, 'Cody · finished Nov 11, 10:45 PM');
+ assert.equal(q('[data-done-meta]').textContent, 'Cody · finished Nov 11, 10:45\u00a0PM');
assert.match(q('[data-answer-text]').textContent, /Drafted the sale email/);
assert.equal(q('[data-done-trail]'), null, 'no trail for a job the API has no steps for');
assert.equal(q('[data-redo]').textContent.trim(), 'Ask Cody to redo in chat');
@@ -287,7 +287,7 @@ test('the pane loads routine, run and message itself through the done api', asyn
await click(q('[data-option="r-prices"]'));
await settle(20);
assert.deepEqual(calls, ['routines', 'runs:rt-prices', 'message:m-prices']);
- assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 9:00 AM · ran Nov 11, 10:51 PM because you pressed Run now');
+ assert.equal(q('[data-done-meta]').textContent, 'Ben · routine, every Mon 9:00\u00a0AM · ran Nov 11, 10:51\u00a0PM because you pressed Run now');
assert.equal(q('[data-chip="read-only"]') !== null, true);
root.unmount();
});
diff --git a/frontend/tests/jiraSetup.test.mjs b/frontend/tests/jiraSetup.test.mjs
index 69f87093..0c0f4325 100644
--- a/frontend/tests/jiraSetup.test.mjs
+++ b/frontend/tests/jiraSetup.test.mjs
@@ -47,6 +47,7 @@ const m = await loadBundled(`
export { JiraHint, JiraSettings } from './src/components/JiraSettings';
export { devTeamRefs } from './src/devMode';
export { popoverPlace } from './src/components/GitHubConnect';
+ export { atClock, timeText } from './src/clock';
`);
const { React, createRoot, fx } = m;
const h = React.createElement;
@@ -409,7 +410,7 @@ test('errors: a rejected token, an address with no Jira, no projects visible (it
await step1(s);
await click(s.$('[data-jira-check]'));
await settle(20);
- assert.match(s.$('[data-jira-slow]').textContent, /Jira asked us to slow down\. Trying again at 10:09 AM\./);
+ assert.match(s.$('[data-jira-slow]').textContent, /Jira asked us to slow down\. Trying again at 10:09\u00a0AM\./);
s.unmount();
});
@@ -569,6 +570,25 @@ test('23: a key with no name shows alone; names are parsed as untrusted text', a
r.unmount();
});
+test('19d: a rejected token says the day when it was not today; Checked stays a bare time', async () => {
+ const rejected = new Date(Date.now() - 3 * 86_400_000).toISOString();
+ m.jiraStore._reset();
+ form({ site: fx.fxSiteRow({ token_rejected_at: rejected }) });
+ let r = await mount(h(m.JiraSettings, { space: 'spc_demo', teams: [] }));
+ await settle(20);
+ const line = () => r.host.querySelector('[data-jira-status]').textContent;
+ assert.equal(line(), `Jira stopped accepting the token ${m.atClock(rejected)}. Nothing new is picked up.`);
+ assert.match(line(), /^Jira stopped accepting the token on .+ at \S+/, 'another day: "on <day> at <time>"');
+ r.unmount();
+ m.jiraStore._reset();
+ const polled = new Date(Date.now() - 3 * 86_400_000).toISOString();
+ form({ site: fx.fxSiteRow({ polled_at: polled }) });
+ r = await mount(h(m.JiraSettings, { space: 'spc_demo', teams: [] }));
+ await settle(20);
+ assert.ok(line().startsWith(`Checked ${m.timeText(polled)} · `), line());
+ r.unmount();
+});
+
test('23: PUT jira never sends project_names or space_names back', async () => {
const calls = form({});
const f = { jira_url: 'https://yourcompany.atlassian.net', kind: 'cloud', email: '[email protected]', token: 't', projects: ['TRAIL'], handover: 'label', label: 'kwant' };
diff --git a/frontend/tests/missionWatch.test.mjs b/frontend/tests/missionWatch.test.mjs
index e17b3768..f457cc34 100644
--- a/frontend/tests/missionWatch.test.mjs
+++ b/frontend/tests/missionWatch.test.mjs
@@ -113,13 +113,13 @@ test('chipView: every state', () => {
assert.equal(ck.icon, 'loader');
assert.equal(ck.text, 'Rigel is checking the claims');
const dh = v(watch({ state: 'dont_hold', last_check: lastCheck({ claims: 3, dont_hold: 1, needs_you: 1, cant_tell: 0, holds: 1 }) }));
- assert.deepEqual([dh.text, dh.tone, dh.click], ['1 claim doesn’t hold · 6:14 PM', 'rose', 'report']);
- assert.equal(v(watch({ state: 'dont_hold', last_check: lastCheck({ claims: 3, dont_hold: 2, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, '2 claims don’t hold · 6:14 PM');
+ assert.deepEqual([dh.text, dh.tone, dh.click], ['1 claim doesn’t hold · 6:14\u00a0PM', 'rose', 'report']);
+ assert.equal(v(watch({ state: 'dont_hold', last_check: lastCheck({ claims: 3, dont_hold: 2, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, '2 claims don’t hold · 6:14\u00a0PM');
const ah = v(watch({ state: 'all_hold', last_check: lastCheck({ claims: 4, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 4 }) }));
- assert.deepEqual([ah.text, ah.tone], ['All 4 claims hold · 6:14 PM', 'teal']);
+ assert.deepEqual([ah.text, ah.tone], ['All 4 claims hold · 6:14\u00a0PM', 'teal']);
const ct = v(watch({ state: 'cant_tell', last_check: lastCheck({ claims: 4, dont_hold: 0, needs_you: 0, cant_tell: 1, holds: 3 }) }));
- assert.deepEqual([ct.text, ct.tone], ['4 claims checked · 6:14 PM', 'muted']);
- assert.equal(v(watch({ state: 'same_stop', last_check: lastCheck({ claims: 1, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, 'No change since the 6:14 PM check');
+ assert.deepEqual([ct.text, ct.tone], ['4 claims checked · 6:14\u00a0PM', 'muted']);
+ assert.equal(v(watch({ state: 'same_stop', last_check: lastCheck({ claims: 1, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 1 }) })).text, 'No change since the 6:14\u00a0PM check');
const cr = v(watch({ state: 'cant_run', reason: { code: 'no_model', text: 'it has no model' } }));
assert.deepEqual([cr.text, cr.tone], ['Rigel can’t check: it has no model', 'amber']);
assert.equal(v(watch({ state: 'over_limit' })).tone, 'amber');
@@ -145,11 +145,11 @@ test('orderClaims, tints and summary chips follow the design and the server coun
test('chat text, needs-you lines and code parts', () => {
const r = w.parseReport(rawReport());
- assert.equal(w.chatText(r, TZ), 'Checked 3 claims after the mission stopped at 6:10 PM. 1 don’t hold, 1 needs you, 2 hold. I restarted Write the tests with Lin.');
+ assert.equal(w.chatText(r, TZ), 'Checked 3 claims after the mission stopped at 6:10\u00a0PM. 1 don’t hold, 1 needs you, 2 hold. I restarted Write the tests with Lin.');
const all = w.parseReport(rawReport({ counts: { claims: 1, dont_hold: 0, needs_you: 0, cant_tell: 0, holds: 1 }, claims: [claim({ verdict: 'holds' })], actions: [] }));
- assert.equal(w.chatText(all, TZ), 'Checked 1 claim after the mission stopped at 6:10 PM. All hold.');
+ assert.equal(w.chatText(all, TZ), 'Checked 1 claim after the mission stopped at 6:10\u00a0PM. All hold.');
const a = w.firstNeedsYou(r);
- assert.equal(w.youText(r, a, TZ), 'Deploy the site waits for your OK to deploy since 6:12 PM.');
+ assert.equal(w.youText(r, a, TZ), 'Deploy the site waits for your OK to deploy since 6:12\u00a0PM.');
assert.deepEqual(w.codeParts('Ran `npm test` now'), [{ code: false, text: 'Ran ' }, { code: true, text: 'npm test' }, { code: false, text: ' now' }]);
assert.equal(w.failedChatText('the turn timed out'), 'The check failed: the turn timed out. Nothing was restarted.');
});
diff --git a/frontend/tests/oneClock.test.mjs b/frontend/tests/oneClock.test.mjs
index dc5634f6..687d1b25 100644
--- a/frontend/tests/oneClock.test.mjs
+++ b/frontend/tests/oneClock.test.mjs
@@ -22,23 +22,23 @@ const m = await loadBundled(`
export { dayLabel as worktreeDay } from './src/dev/worktrees';
`);
-// Some ICU builds put a narrow no-break space before AM/PM; compare on plain spaces.
-const n = (s) => (typeof s === 'string' ? s.replace(/[  ]/g, ' ') : s);
+// 19d: timeText writes U+00A0 before AM/PM on every runtime, so strings compare exactly as they are.
+const n = (s) => s;
const AT = '2026-11-16T20:15:00Z'; // a Monday
const MORNING = '2026-11-16T08:30:00Z';
const TABLE = [
- ['timeText', () => [m.timeText(AT, { locale: 'en-US' }), m.timeText(AT, { locale: 'en-GB' })], ['8:15 PM', '20:15']],
- ['timeText morning', () => [m.timeText(MORNING, { locale: 'en-US' }), m.timeText(MORNING, { locale: 'en-GB' })], ['8:30 AM', '08:30']],
- ['timeText with a zone', () => [m.timeText(AT, { locale: 'en-US', timeZone: 'Asia/Kolkata' }), m.timeText(AT, { locale: 'en-GB', timeZone: 'Asia/Kolkata' })], ['1:45 AM', '01:45']],
+ ['timeText', () => [m.timeText(AT, { locale: 'en-US' }), m.timeText(AT, { locale: 'en-GB' })], ['8:15\u00a0PM', '20:15']],
+ ['timeText morning', () => [m.timeText(MORNING, { locale: 'en-US' }), m.timeText(MORNING, { locale: 'en-GB' })], ['8:30\u00a0AM', '08:30']],
+ ['timeText with a zone', () => [m.timeText(AT, { locale: 'en-US', timeZone: 'Asia/Kolkata' }), m.timeText(AT, { locale: 'en-GB', timeZone: 'Asia/Kolkata' })], ['1:45\u00a0AM', '01:45']],
['dateText', () => [m.dateText(AT, { locale: 'en-US' }), m.dateText(AT, { locale: 'en-GB' })], ['Nov 16', '16 Nov']],
['dateText weekday + year', () => [m.dateText(AT, { locale: 'en-US', weekday: true, year: true }), m.dateText(AT, { locale: 'en-GB', weekday: true, year: true })], ['Mon, Nov 16, 2026', 'Mon, 16 Nov 2026']],
- ['weekdayClock (a Next line)', () => [m.weekdayClock(MORNING, { locale: 'en-US' }), m.weekdayClock(MORNING, { locale: 'en-GB' })], ['Mon, Nov 16, 8:30 AM', 'Mon 16 Nov, 08:30']],
- ['dateClock', () => [m.dateClock(AT, { locale: 'en-US' }), m.dateClock(AT, { locale: 'en-GB' })], ['Nov 16, 8:15 PM', '16 Nov, 20:15']],
- ['wallClock 08:30', () => [m.wallClock('08:30', 'en-US'), m.wallClock('08:30', 'en-GB')], ['8:30 AM', '08:30']],
- ['wallClock 20:05', () => [m.wallClock('20:05', 'en-US'), m.wallClock('20:05', 'en-GB')], ['8:05 PM', '20:05']],
- ['secondsText (step logs)', () => [m.secondsText(AT, { locale: 'en-US' }), m.secondsText(AT, { locale: 'en-GB' })], ['8:15:00 PM', '20:15:00']],
- ['wallClock midnight', () => [m.wallClock('00:00', 'en-US'), m.wallClock('00:00', 'en-GB')], ['12:00 AM', '00:00']],
+ ['weekdayClock (a Next line)', () => [m.weekdayClock(MORNING, { locale: 'en-US' }), m.weekdayClock(MORNING, { locale: 'en-GB' })], ['Mon, Nov 16, 8:30\u00a0AM', 'Mon 16 Nov, 08:30']],
+ ['dateClock', () => [m.dateClock(AT, { locale: 'en-US' }), m.dateClock(AT, { locale: 'en-GB' })], ['Nov 16, 8:15\u00a0PM', '16 Nov, 20:15']],
+ ['wallClock 08:30', () => [m.wallClock('08:30', 'en-US'), m.wallClock('08:30', 'en-GB')], ['8:30\u00a0AM', '08:30']],
+ ['wallClock 20:05', () => [m.wallClock('20:05', 'en-US'), m.wallClock('20:05', 'en-GB')], ['8:05\u00a0PM', '20:05']],
+ ['secondsText (step logs)', () => [m.secondsText(AT, { locale: 'en-US' }), m.secondsText(AT, { locale: 'en-GB' })], ['8:15:00\u00a0PM', '20:15:00']],
+ ['wallClock midnight', () => [m.wallClock('00:00', 'en-US'), m.wallClock('00:00', 'en-GB')], ['12:00\u00a0AM', '00:00']],
];
for (const [name, run, want] of TABLE) {
@@ -50,19 +50,30 @@ for (const [name, run, want] of TABLE) {
test('clock: atClock says the day when it is not today, in en-US and en-GB', () => {
const NOW = Date.parse('2026-11-16T22:00:00Z');
const at = (t, l) => n(m.atClock(t, NOW, l));
- assert.deepEqual([at(AT, 'en-US'), at(AT, 'en-GB')], ['at 8:15 PM', 'at 20:15']);
- assert.deepEqual([at(MORNING, 'en-US'), at(MORNING, 'en-GB')], ['at 8:30 AM', 'at 08:30']);
+ assert.deepEqual([at(AT, 'en-US'), at(AT, 'en-GB')], ['at 8:15\u00a0PM', 'at 20:15']);
+ assert.deepEqual([at(MORNING, 'en-US'), at(MORNING, 'en-GB')], ['at 8:30\u00a0AM', 'at 08:30']);
const OTHER = '2026-11-10T09:40:00Z';
- assert.deepEqual([at(OTHER, 'en-US'), at(OTHER, 'en-GB')], ['on Nov 10 at 9:40 AM', 'on 10 Nov at 09:40']);
+ assert.deepEqual([at(OTHER, 'en-US'), at(OTHER, 'en-GB')], ['on Nov 10 at 9:40\u00a0AM', 'on 10 Nov at 09:40']);
const YESTERDAY = '2026-11-15T23:59:00Z';
- assert.deepEqual([at(YESTERDAY, 'en-US'), at(YESTERDAY, 'en-GB')], ['on Nov 15 at 11:59 PM', 'on 15 Nov at 23:59']);
+ assert.deepEqual([at(YESTERDAY, 'en-US'), at(YESTERDAY, 'en-GB')], ['on Nov 15 at 11:59\u00a0PM', 'on 15 Nov at 23:59']);
const LAST_YEAR = '2025-11-10T09:40:00Z';
- assert.deepEqual([at(LAST_YEAR, 'en-US'), at(LAST_YEAR, 'en-GB')], ['on Nov 10, 2025 at 9:40 AM', 'on 10 Nov 2025 at 09:40']);
+ assert.deepEqual([at(LAST_YEAR, 'en-US'), at(LAST_YEAR, 'en-GB')], ['on Nov 10, 2025 at 9:40\u00a0AM', 'on 10 Nov 2025 at 09:40']);
for (const bad of [null, undefined, '', 'not a time']) assert.equal(m.atClock(bad, NOW, 'en-US'), null);
// The same day rule as localClock: the two agree on which times are today.
for (const t of [AT, MORNING, OTHER, YESTERDAY, LAST_YEAR]) assert.equal(m.atClock(t, NOW, 'en-US').startsWith('at '), m.localClock(t, NOW, 'en-US') === m.timeText(t, { locale: 'en-US' }));
});
+// 19d (time never splits): AM/PM is held to its time by a no-break space, so a narrow row can't wrap "10:51 / PM".
+test('clock: en-US puts U+00A0 before AM/PM (never U+202F or a plain space); en-GB has none', () => {
+ for (const t of [m.timeText(AT, { locale: 'en-US' }), m.timeText(MORNING, { locale: 'en-US' }), m.secondsText(AT, { locale: 'en-US' }), m.wallClock('20:05', 'en-US')]) {
+ assert.match(t, /\d\u00a0[AP]M$/, JSON.stringify(t));
+ assert.doesNotMatch(t, /[\u202f ][AP]M/, JSON.stringify(t));
+ }
+ assert.equal(m.timeText(AT, { locale: 'en-US' }), '8:15\u00a0PM');
+ assert.equal(m.localClock('2026-11-11T22:51:00Z', Date.parse('2026-11-12T00:50:00Z'), 'en-US'), 'Nov 11, 10:51\u00a0PM', 'only the AM/PM space is held; the date keeps its plain spaces');
+ for (const t of [m.timeText(AT, { locale: 'en-GB' }), m.secondsText(AT, { locale: 'en-GB' }), m.dateClock(AT, { locale: 'en-GB' })]) assert.doesNotMatch(t, /\u00a0|\u202f/, JSON.stringify(t));
+});
+
test('clock: missing or unreadable times give null; wallClock keeps what it cannot read', () => {
for (const f of [m.timeText, m.dateText, m.weekdayClock, m.dateClock]) {
assert.equal(f(null), null);
@@ -75,7 +86,7 @@ test('clock: missing or unreadable times give null; wallClock keeps what it cann
});
test('clock: no locale means the device default, the same as the platform writes it', () => {
- const want = new Date(AT).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
+ const want = new Date(AT).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' }).replace(/[\u202f ](AM|PM)/, '\u00a0$1');
assert.equal(m.timeText(AT), want);
assert.equal(m.wallClock('20:15'), want);
});
@@ -86,25 +97,25 @@ test('routines: the schedule and its Next line use the same clock', () => {
const want = n(m.wallClock('08:30'));
assert.ok(line.includes(`at ${want},`), line);
assert.ok(n(m.formatWhen(MORNING)).endsWith(want), m.formatWhen(MORNING));
- assert.equal(n(m.formatWhen(MORNING, 'en-US')), 'Mon, Nov 16, 8:30 AM');
+ assert.equal(n(m.formatWhen(MORNING, 'en-US')), 'Mon, Nov 16, 8:30\u00a0AM');
assert.equal(n(m.describeSchedule({ type: 'daily', time: '17:00', tz: 'UTC' })).includes(n(m.wallClock('17:00'))), true);
assert.equal(m.formatWhen(null), '—');
});
test('call sites that forced 24 h or en-GB now follow the locale', () => {
- assert.equal(n(m.reviewClock(AT, 'en-US', Date.parse(AT))), '8:15 PM', 'the Inbox');
+ assert.equal(n(m.reviewClock(AT, 'en-US', Date.parse(AT))), '8:15\u00a0PM', 'the Inbox');
assert.equal(m.reviewClock(AT, 'en-GB', Date.parse(AT)), '20:15');
- assert.equal(n(m.callTime(AT, new Date(AT), 'en-US')), '8:15 PM');
- assert.equal(n(m.callTime(AT, new Date('2026-11-17T09:00:00Z'), 'en-US')), 'Nov 16, 8:15 PM');
+ assert.equal(n(m.callTime(AT, new Date(AT), 'en-US')), '8:15\u00a0PM');
+ assert.equal(n(m.callTime(AT, new Date('2026-11-17T09:00:00Z'), 'en-US')), 'Nov 16, 8:15\u00a0PM');
assert.equal(m.callTime(AT, new Date('2026-11-17T09:00:00Z'), 'en-GB'), '16 Nov, 20:15');
assert.equal(m.shortDate(AT, 'en-US'), 'Nov 16, 2026');
assert.equal(m.shortDate(AT, 'en-GB'), '16 Nov 2026');
- assert.equal(n(m.hm(AT, 'UTC', 'en-US')), '8:15 PM', 'missionWatch keeps its zone');
+ assert.equal(n(m.hm(AT, 'UTC', 'en-US')), '8:15\u00a0PM', 'missionWatch keeps its zone');
assert.equal(m.hm(AT, 'UTC', 'en-GB'), '20:15');
assert.equal(m.usageDay('2026-10-20', new Date(AT), 'en-US'), 'Tue, Oct 20', 'DailyUsage stays on the UTC day');
assert.equal(m.usageDay('2026-10-20', new Date(AT), 'en-GB'), 'Tue 20 Oct');
assert.equal(m.devDay('2026-11-03T10:00:00Z', new Date(AT), 'en-GB'), 'Tue 3 Nov');
- assert.equal(n(m.onceWords('2026-11-06T15:00:00Z', 'en-US')), 'once on Fri, Nov 6 at 3:00 PM');
+ assert.equal(n(m.onceWords('2026-11-06T15:00:00Z', 'en-US')), 'once on Fri, Nov 6 at 3:00\u00a0PM');
});
test('one clock: hand-built HH:MM spots now read the device clock (Inbox queue, Done-away, Dev desk, worktrees)', () => {
@@ -122,7 +133,7 @@ test('one clock: the Inbox row and review item carry the date on another day, li
const LATER = Date.parse('2026-11-19T09:00:00Z');
assert.equal(n(m.inboxClock(AT, LATER)), n(m.localClock(AT, LATER)), 'the row follows localClock');
assert.equal(n(m.inboxClock(AT, LATER)), `${n(m.dateText(AT))}, ${want0()}`);
- assert.equal(n(m.reviewClock(AT, 'en-US', LATER)), 'Nov 16, 8:15 PM', 'in Review since … yesterday or earlier');
+ assert.equal(n(m.reviewClock(AT, 'en-US', LATER)), 'Nov 16, 8:15\u00a0PM', 'in Review since … yesterday or earlier');
assert.equal(m.reviewClock(AT, 'en-GB', LATER), '16 Nov, 20:15');
assert.equal(m.reviewClock(null), null);
assert.equal(m.reviewClock('nope'), null);
diff --git a/frontend/tests/postGithub.test.mjs b/frontend/tests/postGithub.test.mjs
index fd43a72a..7dab2503 100644
--- a/frontend/tests/postGithub.test.mjs
+++ b/frontend/tests/postGithub.test.mjs
@@ -71,7 +71,7 @@ const click = async (el) => {
const base = () => review(fx.REVIEW_294);
const LOGIN = 'oleks-i';
const footer = (host) => host.querySelector('[data-review-footer]');
-const flat = (el) => el.textContent.replace(/\s+/g, ' ').trim();
+const flat = (el) => el.textContent.replace(/[^\S\u00a0]+/g, ' ').trim();
const POSTED = { forge: 'github', at: '2026-11-05T19:58:00Z', login: LOGIN, url: 'https://github.com/o/r/pull/294#pullrequestreview-1', comments: 3 };
// ---------------------------------------------------------------------------------------------------
@@ -187,13 +187,13 @@ test('posting: spinner, button disabled and busy, a second press sends nothing;
await settle();
f = footer(host);
assert.equal(f.dataset.postState, 'posted');
- assert.match(flat(f), /^Posted 7:58 PM as @oleks-i · 3 inline comments\s*View on GitHub/);
+ assert.match(flat(f), /^Posted 7:58\u00a0PM as @oleks-i · 3 inline comments\s*View on GitHub/);
assert.equal(f.querySelector('.dv-led').dataset.s, 'ok', 'ok LED');
const a = f.querySelector('a[href="https://github.com/o/r/pull/294#pullrequestreview-1"]');
assert.ok(a, 'View on GitHub links to the review');
assert.equal(a.getAttribute('target'), '_blank');
assert.equal(!!button(f, 'Post to GitHub'), false, 'no button once posted');
- assert.equal(f.querySelector('[role="status"]').textContent, 'Posted 7:58 PM as @oleks-i · 3 inline comments');
+ assert.equal(f.querySelector('[role="status"]').textContent, 'Posted 7:58\u00a0PM as @oleks-i · 3 inline comments');
});
test('posted from the server (SSE refetch): the card prop alone switches the footer', async () => {
@@ -212,7 +212,7 @@ test('posted from the server (SSE refetch): the card prop alone switches the foo
test('posted without a url: "Posted 19:58" and no link', () => {
const out = html(m.ReviewCard, { card: { ...base(), posted: { ...POSTED, url: null } }, onFinding: async () => base(), onPost: async () => base(), now: NOW });
- assert.match(out, /Posted 7:58 PM/);
+ assert.match(out, /Posted 7:58\u00a0PM/);
assert.doesNotMatch(out, /View on GitHub/);
});
@@ -381,7 +381,7 @@ test('F7: forge null shows neither the Post button nor the Open link, in every s
test('forge null but already posted: still says Posted, with the forge from posted', () => {
const out = html(m.ReviewCard, { card: { ...base(), posted: POSTED }, onFinding: async () => base(), now: NOW });
- assert.match(out, /Posted 7:58 PM/);
+ assert.match(out, /Posted 7:58\u00a0PM/);
assert.match(out, /View on GitHub/);
});
diff --git a/frontend/tests/prepush.test.mjs b/frontend/tests/prepush.test.mjs
index e10bb69a..e92e8c21 100644
--- a/frontend/tests/prepush.test.mjs
+++ b/frontend/tests/prepush.test.mjs
@@ -68,7 +68,7 @@ const mount = async (C, props) => {
mounted.add(u);
return { host, rerender: async (p) => { root.render(h(C, p)); await settle(); } };
};
-const text = (el) => el.textContent.replace(/\s+/g, ' ').trim();
+const text = (el) => el.textContent.replace(/[^\S\u00a0]+/g, ' ').trim();
const button = (host, t) => [...host.querySelectorAll('button')].find((b) => text(b).startsWith(t));
const click = async (el) => {
el.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
@@ -133,9 +133,9 @@ test('counts come from the server: open findings are its blockers, never a check
assert.equal(m.inboxLine(card(fx.PP_NEEDS_YOU), 'Pixel'), "Pixel's push is waiting for you: 1 finding open");
assert.equal(m.inboxLine(card(fx.PP_FAILED_NEEDS_YOU), 'Pixel'), "Pixel's push is waiting for you: the checks couldn't run");
assert.equal(m.requiredPassed(card(fx.PP_CLEAR)), 5, 'semgrep not installed is not a passed check');
- assert.equal(m.clearedLine(card(fx.PP_CLEAR)), 'Cleared to push pixel/inbox-empty-state after 5 checks passed · 2:02 PM');
+ assert.equal(m.clearedLine(card(fx.PP_CLEAR)), 'Cleared to push pixel/inbox-empty-state after 5 checks passed · 2:02\u00a0PM');
assert.equal(m.foldLine(card(fx.PP_NEEDS_YOU)), '4 checks passed · registry · tamper · rules · review');
- assert.equal(m.overriddenLine(card(fx.PP_OVERRIDDEN), 'Pixel'), 'You let this push go at 2:09 PM with 1 finding open. It covers this commit only.', 'old server, no grant: unchanged');
+ assert.equal(m.overriddenLine(card(fx.PP_OVERRIDDEN), 'Pixel'), 'You let this push go at 2:09\u00a0PM with 1 finding open. It covers this commit only.', 'old server, no grant: unchanged');
});
test('a check that could not run never reads as passed', () => {
@@ -185,7 +185,7 @@ test('P2 clear: a card seen live shows Clear, then folds to P2b after about 2 s;
const hist = await mount(m.PrepushCard, { card: card(fx.PP_CLEAR), bot: 'Pixel' });
assert.equal(hist.host.querySelector('[data-prepush-phase]').dataset.prepushPhase, 'P2b');
- assert.match(text(hist.host), /Cleared to push pixel\/inbox-empty-state after 5 checks passed · 2:02 PM/);
+ assert.match(text(hist.host), /Cleared to push pixel\/inbox-empty-state after 5 checks passed · 2:02\u00a0PM/);
await click(button(hist.host, 'Show checks'));
assert.equal(hist.host.querySelector('[data-prepush-phase]').dataset.prepushPhase, 'P2');
assert.equal(hist.host.querySelectorAll('[data-check]').length, 6);
@@ -269,7 +269,7 @@ test('P5 shows the server\'s refusal and keeps the reason', async () => {
test('P6 pushed anyway: neutral chip, the time and the quoted reason; open findings stay rose; no actions', () => {
const out = html(m.PrepushCard, { card: card(fx.PP_OVERRIDDEN), bot: 'Pixel', onRetry: async () => {}, onOverride: async () => {} });
assert.match(out, /class="kw-chip shrink-0[^"]*"[^>]*>Pushed anyway/);
- assert.match(out, /You let this push go at 2:09 PM with 1 finding open\./);
+ assert.match(out, /You let this push go at 2:09\u00a0PM with 1 finding open\./);
assert.match(out, /<blockquote[^>]*>.*The key is a revoked test key/);
assert.match(out, /data-check="secrets" data-state="hit"/);
assert.doesNotMatch(out, /<button[^>]*>Push anyway/);
@@ -765,3 +765,13 @@ test('#475 Mira must-fix 1: the branch on one-line cards wraps; "fixing it" with
const many = card(fx.PP_MANY);
if (m.openCount(many) > 1) assert.match(html(m.PrepushCard, { card: many, bot: 'Pixel' }), /Pixel is fixing them\./);
});
+
+test('19d: Pushed · the time today, with the date on another day (localClock), and plain Pushed with no time', () => {
+ const at = Date.UTC(2026, 10, 9, 14, 15);
+ const sameDay = new Date(at); sameDay.setHours(23, 0, 0, 0);
+ assert.equal(m.pushedLine(at, sameDay.getTime()), `Pushed · ${m.hhmm(at)}`);
+ const later = at + 6 * 86_400_000;
+ const day = new Date(at).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
+ assert.equal(m.pushedLine(at, later), `Pushed · ${day}, ${m.hhmm(at)}`);
+ assert.equal(m.pushedLine(null, later), 'Pushed');
+});
diff --git a/frontend/tests/prepushGrant.test.mjs b/frontend/tests/prepushGrant.test.mjs
index 4a6d2c6c..09617029 100644
--- a/frontend/tests/prepushGrant.test.mjs
+++ b/frontend/tests/prepushGrant.test.mjs
@@ -66,7 +66,7 @@ const mount = async (C, props) => {
mounted.add(u);
return { host, rerender: async (p) => { root.render(h(C, p)); await settle(); } };
};
-const text = (el) => el.textContent.replace(/\s+/g, ' ').trim();
+const text = (el) => el.textContent.replace(/[^\S\u00a0]+/g, ' ').trim();
const button = (host, t) => [...host.querySelectorAll('button')].find((b) => text(b).startsWith(t));
const click = async (el) => {
el.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
@@ -82,7 +82,7 @@ const type = async (el, value) => {
// ---------------------------------------------------------------------------------------------------
// 0.9.7 prepush-grant (autonomy/prepush-retry/brief.md, Frontend): the press is the approval.
-const HM = (ms) => new Date(ms).toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/\u202f/g, ' ');
+const HM = (ms) => new Date(ms).toLocaleTimeString(undefined, { timeStyle: 'short' }).replace(/[\u202f ](AM|PM)/, '\u00a0$1');
const all = (...ks) => ks.map((k) => card(fx[k]));
test('grant and superseded parse; pushed is a known status now; a junk grant is dropped', () => {
@@ -466,14 +466,14 @@ test('18d: prepush sentences with "at" say the day when it was not today', () =>
const NEXT = Date.UTC(2026, 10, 10, 9, 0);
const NEXT_YEAR = Date.UTC(2027, 0, 4, 9, 0);
const over = m.parsePrepush(m.fx.PP_OVERRIDDEN);
- assert.equal(m.overriddenHead(over, SAME), 'You let this push go at 2:09 PM with 1 finding open.');
- assert.equal(m.overriddenHead(over, NEXT), 'You let this push go on Nov 9 at 2:09 PM with 1 finding open.');
- assert.equal(m.overriddenHead(over, NEXT_YEAR), 'You let this push go on Nov 9, 2026 at 2:09 PM with 1 finding open.');
+ assert.equal(m.overriddenHead(over, SAME), 'You let this push go at 2:09\u00a0PM with 1 finding open.');
+ assert.equal(m.overriddenHead(over, NEXT), 'You let this push go on Nov 9 at 2:09\u00a0PM with 1 finding open.');
+ assert.equal(m.overriddenHead(over, NEXT_YEAR), 'You let this push go on Nov 9, 2026 at 2:09\u00a0PM with 1 finding open.');
const next = m.parsePrepush(m.fx.PP_NEXT_CHECKING);
- assert.equal(m.afterRetryLine(next, SAME), 'After you asked for a fix at 2:10 PM.');
- assert.equal(m.afterRetryLine(next, NEXT), 'After you asked for a fix on Nov 9 at 2:10 PM.');
+ assert.equal(m.afterRetryLine(next, SAME), 'After you asked for a fix at 2:10\u00a0PM.');
+ assert.equal(m.afterRetryLine(next, NEXT), 'After you asked for a fix on Nov 9 at 2:10\u00a0PM.');
const clear = m.parsePrepush(m.fx.PP_CLEAR);
- assert.equal(m.clearedParts(clear, SAME).after, ' after 5 checks passed · 2:02 PM');
- assert.equal(m.clearedParts(clear, NEXT).after, ' after 5 checks passed · Nov 9, 2:02 PM');
+ assert.equal(m.clearedParts(clear, SAME).after, ' after 5 checks passed · 2:02\u00a0PM');
+ assert.equal(m.clearedParts(clear, NEXT).after, ' after 5 checks passed · Nov 9, 2:02\u00a0PM');
assert.equal(m.overriddenHead({ ...over, override: null }, NEXT), 'You let this push go with 1 finding open.');
});
diff --git a/frontend/tests/profiles.test.mjs b/frontend/tests/profiles.test.mjs
index 953fbb34..d8469f40 100644
--- a/frontend/tests/profiles.test.mjs
+++ b/frontend/tests/profiles.test.mjs
@@ -128,7 +128,7 @@ test('a kwant works until every turn it started has ended, whatever the outcome'
// ---- account-usage: 5-hour and weekly limits on Claude/Codex sign-ins (design.md §3) ----
const at = (d, h, m = 0) => new Date(2026, 10, d, h, m); // local time, Nov 2026 (13th is a Friday)
-const clock = (d) => d.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
+const clock = (d) => d.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' }).replace(/[\u202f ](AM|PM)/, '\u00a0$1');
const wd = (d) => d.toLocaleDateString(undefined, { weekday: 'short' });
const usage = (fiveUsed, weekUsed, over = {}) => ({
checked_at: at(13, 20, 31).toISOString(),
diff --git a/frontend/tests/quickWins.test.mjs b/frontend/tests/quickWins.test.mjs
index d594450c..497bd054 100644
--- a/frontend/tests/quickWins.test.mjs
+++ b/frontend/tests/quickWins.test.mjs
@@ -30,15 +30,15 @@ const m = await loadBundled(`
const NOW = Date.parse('2026-11-02T12:00:00Z');
test('localClock: the time today, the date on another day, the year in another year', () => {
- assert.equal(m.localClock('2026-11-02T20:15:00Z', NOW, 'en-US'), '8:15 PM');
- assert.equal(m.localClock('2026-11-03T08:01:00Z', NOW, 'en-US'), 'Nov 3, 8:01 AM');
- assert.equal(m.localClock('2027-01-05T09:00:00Z', NOW, 'en-US'), 'Jan 5, 2027, 9:00 AM');
+ assert.equal(m.localClock('2026-11-02T20:15:00Z', NOW, 'en-US'), '8:15\u00a0PM');
+ assert.equal(m.localClock('2026-11-03T08:01:00Z', NOW, 'en-US'), 'Nov 3, 8:01\u00a0AM');
+ assert.equal(m.localClock('2027-01-05T09:00:00Z', NOW, 'en-US'), 'Jan 5, 2027, 9:00\u00a0AM');
assert.equal(m.localClock(null, NOW), null);
assert.equal(m.localClock('not a time', NOW), null);
});
test('quotaLine: "Out of quota until …" while the limit lasts, the server words otherwise', () => {
- assert.equal(m.quotaLine('Out of quota', '2026-11-02T20:15:00Z', NOW, 'en-US'), 'Out of quota until 8:15 PM');
+ assert.equal(m.quotaLine('Out of quota', '2026-11-02T20:15:00Z', NOW, 'en-US'), 'Out of quota until 8:15\u00a0PM');
assert.equal(m.quotaLine('Out of quota', '2026-11-02T10:00:00Z', NOW, 'en-US'), 'Out of quota');
assert.equal(m.quotaLine('Not checked yet', null, NOW, 'en-US'), 'Not checked yet');
assert.equal(m.quotaLine(null, undefined, NOW), null);
diff --git a/frontend/tests/reviewItemView.test.mjs b/frontend/tests/reviewItemView.test.mjs
index 51b6c9ca..8c07004a 100644
--- a/frontend/tests/reviewItemView.test.mjs
+++ b/frontend/tests/reviewItemView.test.mjs
@@ -452,7 +452,7 @@ test('18d: "You allowed / denied / sent it back" say the day when it was not tod
const denied = { ...FX.heldDenied, held_actions: FX.heldDenied.held_actions.map((h) => ({ ...h, resolved_at: daysAgo(2) })) };
r = await mount(denied, fakeApi().api);
assert.match(r.qa('[data-held]')[0].textContent.replace(/\s+/g, ' '), new RegExp(`You denied this ${ON_DAY}\\. It didn’t run\\.`));
- assert.doesNotMatch(r.qa('[data-held]')[0].textContent, / at (?:[A-Z][a-z]{2} \d|\d{1,2} [A-Z][a-z]{2}),/, 'never "at Nov 10, 9:40 AM"');
+ assert.doesNotMatch(r.qa('[data-held]')[0].textContent, / at (?:[A-Z][a-z]{2} \d|\d{1,2} [A-Z][a-z]{2}),/, 'never "at Nov 10, 9:40\u00a0AM"');
const back = { ...FX.failRoundLimit, previous_round: { ...FX.failRoundLimit.previous_round, sent_back_at: daysAgo(4) } };
r = await mount(back, fakeApi().api);
assert.match(r.q('[data-round-box]').textContent.replace(/\s+/g, ' '), new RegExp(`You sent it back ${ON_DAY}:`));
@@ -469,11 +469,11 @@ test('18d: the checker line says the day when the check was not today', () => {
const item = (checked_at) => ({ ...FX.heldAllowed, verdict: { ...FX.heldAllowed.verdict, result: 'pass', checker: { engine: 'Codex' }, checked_at } });
const before = m.checkerMeta(item(at955(5)));
assert.match(before, /^Checked by fresh eyes on Codex on (?:[A-Z][a-z]{2} \d{1,2}|\d{1,2} [A-Z][a-z]{2})(?:,? \d{4})? at (?:9:55\s?AM|09:55)/);
- assert.doesNotMatch(before, / at (?:[A-Z][a-z]{2} \d|\d{1,2} [A-Z][a-z]{2}),/, 'never "at Nov 10, 9:55 AM"');
+ assert.doesNotMatch(before, / at (?:[A-Z][a-z]{2} \d|\d{1,2} [A-Z][a-z]{2}),/, 'never "at Nov 10, 9:55\u00a0AM"');
if (Intl.DateTimeFormat().resolvedOptions().locale === 'en-US') {
const d = new Date(at955(5));
const day = d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', ...(d.getFullYear() !== t.getFullYear() ? { year: 'numeric' } : {}) });
- assert.ok(before.startsWith(`Checked by fresh eyes on Codex on ${day} at 9:55 AM`), before);
+ assert.ok(before.startsWith(`Checked by fresh eyes on Codex on ${day} at 9:55\u00a0AM`), before);
}
assert.match(m.checkerMeta(item(at955(0))), /^Checked by fresh eyes on Codex at (?:9:55\s?AM|09:55)(?: ·|$)/);
assert.equal(m.checkerMeta(item(null)).startsWith('Checked by fresh eyes on Codex'), true);
diff --git a/frontend/tests/routinesSetup.test.mjs b/frontend/tests/routinesSetup.test.mjs
index 25d63c04..4b7f99cc 100644
--- a/frontend/tests/routinesSetup.test.mjs
+++ b/frontend/tests/routinesSetup.test.mjs
@@ -18,7 +18,7 @@ const ui = await loadBundled(`
`);
const noop = () => {};
-const text = (html) => html.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ');
+const text = (html) => html.replace(/<[^>]+>/g, '').replace(/[^\S\u00a0]+/g, ' ');
const routine = (over = {}) => ({
id: 'r1', kwant_id: 'k1', channel_id: null, name: 'Competitor prices',
instructions: 'Check Beanline and RoastCo prices and tell me what changed since last week.',
@@ -34,7 +34,7 @@ test('the card says what it does, then when it runs next, then schedule · bot
assert.match(h, /title="Check Beanline/);
assert.match(t, /Next [A-Z][a-z]{2}, Nov 1[56]/);
assert.match(t, /last ran Mon, Nov 9/);
- assert.match(t, /Every Monday at 9:00 AM, Kyiv time · Ben · #spring-launch/);
+ assert.match(t, /Every Monday at 9:00\u00a0AM, Kyiv time · Ben · #spring-launch/);
assert.doesNotMatch(t, /Next run:|\(Europe\/Kyiv\)/);
// Order: name, first line, next, meta.
assert.ok(t.indexOf('Competitor prices') < t.indexOf('Check Beanline'));
@@ -56,7 +56,7 @@ test('a paused routine says Paused and mutes its name and first line', () => {
test('a Mon–Fri routine reads "Weekdays at …"', () => {
const t = text(ui.row(rowProps({ schedule: { type: 'weekly', time: '08:30', weekdays: ['mon', 'tue', 'wed', 'thu', 'fri'], tz: 'Europe/Kyiv' } })));
- assert.match(t, /Weekdays at 8:30 AM, Kyiv time/);
+ assert.match(t, /Weekdays at 8:30\u00a0AM, Kyiv time/);
});
test('phone: the four actions sit in a 4-column grid of 44 px buttons; desktop keeps the indented row', () => {
diff --git a/frontend/tests/tickets.test.mjs b/frontend/tests/tickets.test.mjs
index da2b567b..66beda89 100644
--- a/frontend/tests/tickets.test.mjs
+++ b/frontend/tests/tickets.test.mjs
@@ -396,7 +396,7 @@ test('picking a choice answers that question', async () => {
test('once asked, the card says it waits for the answer on Jira and offers See the comment', () => {
const out = html(m.TicketCard, { ...N, ticket: T('needs_answer'), brief: B(fx.BRIEF_ASKED), onAskPreview: async () => fx.ASK_PREVIEW });
- assert.match(out, /Asked Dana Park on Jira at 10:04 AM\. You can still answer here\./);
+ assert.match(out, /Asked Dana Park on Jira at 10:04\u00a0AM\. You can still answer here\./);
assert.match(out, /Ann checks the Jira comment every 5 minutes\. The first answer wins, here or there\./);
assert.doesNotMatch(out, /data-ask=/);
});
@@ -686,12 +686,12 @@ test('18d: ticket cards say the day when a time was not today', () => {
Date.now = () => Date.parse('2026-11-08T09:00:00Z');
try {
const back = html(m.TicketCard, { ...N, ticket: T('taken_back'), onCloseCard: () => {} });
- assert.match(back, / on Nov 7 at 10:12 AM\. Work paused; nothing was thrown away\./);
+ assert.match(back, / on Nov 7 at 10:12\u00a0AM\. Work paused; nothing was thrown away\./);
assert.doesNotMatch(back, / at Nov 7, /);
const landed = html(m.TicketCard, { ...N, ticket: T('landed'), brief: B(fx.BRIEF_ANSWERED) });
- assert.match(landed, /merged Nov 7, 11:20 AM/);
+ assert.match(landed, /merged Nov 7, 11:20\u00a0AM/);
const asked = html(m.TicketCard, { ...N, ticket: T('needs_answer'), brief: B(fx.BRIEF_ASKED), onAskPreview: async () => fx.ASK_PREVIEW });
- assert.match(asked, /Asked Dana Park on Jira on Nov 7 at 10:04 AM\. You can still answer here\./);
+ assert.match(asked, /Asked Dana Park on Jira on Nov 7 at 10:04\u00a0AM\. You can still answer here\./);
} finally {
Date.now = now;
}
diff --git a/frontend/tests/toolNotes.test.mjs b/frontend/tests/toolNotes.test.mjs
index c7ecb1bb..6b7abd8f 100644
--- a/frontend/tests/toolNotes.test.mjs
+++ b/frontend/tests/toolNotes.test.mjs
@@ -86,7 +86,7 @@ test('an open note: kind tag with icon and word, mono tool, ×3, bots and last t
assert.match(html, /×3/);
assert.match(html, /Pixel/);
assert.match(html, /Iris/);
- assert.match(html, /last \d{1,2}:\d\d [AP]M/);
+ assert.match(html, /last \d{1,2}:\d\d\u00a0[AP]M/);
assert.match(html, /Mark fixed/);
assert.match(html, /aria-label="Edit note"/);
assert.match(html, /aria-label="More actions for this note"/);
@@ -109,7 +109,7 @@ test('edited and person-written notes say so; a removed connection’s tool is g
test('a fixed note: Fixed tag, grey text, when it was fixed, Reopen and a delete icon', () => {
const html = ui.section(props({ initialFilter: 'fixed', initialList: list([note({ state: 'fixed', fixed_at: '2026-11-10T14:20:00Z' })]) }));
assert.match(html, /data-note-kind="fixed"/);
- assert.match(html, /Fixed by you · \d{1,2}:\d\d [AP]M · bots no longer see it/);
+ assert.match(html, /Fixed by you · \d{1,2}:\d\d\u00a0[AP]M · bots no longer see it/);
assert.match(html, /Reopen/);
assert.match(html, /aria-label="Delete note"/);
assert.doesNotMatch(html, /Mark fixed/);
diff --git a/frontend/tests/uiRefreshSignature.test.mjs b/frontend/tests/uiRefreshSignature.test.mjs
index f6c69074..5dec1eea 100644
--- a/frontend/tests/uiRefreshSignature.test.mjs
+++ b/frontend/tests/uiRefreshSignature.test.mjs
@@ -76,7 +76,7 @@ test('selectMood: finished fades after a moment, failed stays until the next tur
});
test('moodLabel: words for the tooltip, "Resting until 03:00" for quota', () => {
const at = new Date(2026, 10, 3, 3, 0);
- assert.equal(m.moodLabel('resting', 'Dev', at, new Date(2026, 10, 3, 1, 0).getTime()), 'Resting until 3:00 AM');
+ assert.equal(m.moodLabel('resting', 'Dev', at, new Date(2026, 10, 3, 1, 0).getTime()), 'Resting until 3:00\u00a0AM');
assert.equal(m.moodLabel('needs_you', 'Dev'), 'Dev needs you');
assert.equal(m.moodLabel('failed', 'Dev'), "Dev's last turn failed");
assert.equal(m.moodLabel('idle', 'Dev'), null);
diff --git a/frontend/tests/waitingChecks.test.mjs b/frontend/tests/waitingChecks.test.mjs
index fb0b7128..56b734f2 100644
--- a/frontend/tests/waitingChecks.test.mjs
+++ b/frontend/tests/waitingChecks.test.mjs
@@ -42,15 +42,15 @@ const task = (over = {}) => ({
test('a waiting check reads as one line with its clock times, the deadline and the last printed line', () => {
const l = w.waitLine(check(), NOW);
- assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 9:12 AM · next look 9:27 AM');
+ assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 9:12\u00a0AM · next look 9:27\u00a0AM');
assert.equal(l.last, 'job 42: in_review (run 2)', "the script's last line, not kwant's run header");
- assert.match(l.deadline, /^If it isn’t ready by \S+ 9:12 AM, it stops and tells you\.$/, 'tells you, as in the 0.9.7 copy');
+ assert.match(l.deadline, /^If it isn’t ready by \S+ 9:12\u00a0AM, it stops and tells you\.$/, 'tells you, as in the 0.9.7 copy');
assert.equal(l.timedOut, false);
});
test('a next look that is already due says soon; an http check waits on its address', () => {
const l = w.waitLine(check({ next_run_at: iso('2026-11-13T09:15:00') }), NOW);
- assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 9:12 AM · next look soon');
+ assert.equal(w.waitLineText(l), 'Waiting on ./gate.sh since 9:12\u00a0AM · next look soon');
const h = w.waitLine(check({ kind: 'http', spec: { url: 'https://status.example/jobs/42', waiting_status: 202 } }), NOW);
assert.match(w.waitLineText(h), /^Waiting on https:\/\/status\.example\/jobs\/42 since/);
});
@@ -68,7 +68,7 @@ test('past its deadline the card line says it did not answer, and the detail say
assert.equal(l.hours, 72);
assert.equal(w.detailLineText(l), 'No answer in 72 h.');
assert.equal(w.detailLineText({ ...l, hours: null }), 'No answer in time.');
- assert.equal(w.detailLineText(w.waitLine(check(), NOW)), 'Waiting since 9:12 AM · next look 9:27 AM');
+ assert.equal(w.detailLineText(w.waitLine(check(), NOW)), 'Waiting since 9:12\u00a0AM · next look 9:27\u00a0AM');
const det = ui.line({ line: l });
assert.ok(!det.includes('./gate.sh'), 'the detail row already shows the label');
assert.ok(!det.includes('<svg'), 'no second warning icon in the detail');
@@ -95,10 +95,10 @@ test('the line is labelled for screen readers and never renders HTML from the sc
const html = ui.line({ line: w.waitLine(check({ output_excerpt: 'run 1: not ready yet\n<img src=x onerror=alert(1)>' }), NOW) });
assert.ok(!html.includes('<img'), 'output is text');
assert.ok(html.includes('&lt;img'));
- assert.ok(html.includes('class="sr-only">Waiting since 9:12 AM, next look 9:27 AM<'));
- assert.ok(html.includes('>Waiting since 9:12 AM · next look 9:27 AM<'));
+ assert.ok(html.includes('class="sr-only">Waiting since 9:12\u00a0AM, next look 9:27\u00a0AM<'));
+ assert.ok(html.includes('>Waiting since 9:12\u00a0AM · next look 9:27\u00a0AM<'));
assert.ok(!html.includes('text-zinc-500'), 'small grey text meets AA');
- assert.ok(ui.line({ line: w.waitLine(check(), NOW), compact: true }).includes('class="sr-only">Waiting on ./gate.sh since 9:12 AM · next look 9:27 AM<'));
+ assert.ok(ui.line({ line: w.waitLine(check(), NOW), compact: true }).includes('class="sr-only">Waiting on ./gate.sh since 9:12\u00a0AM · next look 9:27\u00a0AM<'));
assert.ok(html.includes('It last printed: '));
assert.ok(html.includes('data-waiting-deadline'));
assert.ok(html.includes('aria-hidden="true"'));
diff --git a/frontend/tests/worktrees.test.mjs b/frontend/tests/worktrees.test.mjs
index 4b1d8ff5..61e0ea9a 100644
--- a/frontend/tests/worktrees.test.mjs
+++ b/frontend/tests/worktrees.test.mjs
@@ -99,10 +99,10 @@ const tick = async (el) => {
const row = (host, id) => host.querySelector(`[data-wt-row="${id}"]`);
const text = (el) => {
// Block boundaries read as a space, the way a screen reader or a person reads the row.
- if (!el.querySelectorAll) return el.textContent.replace(/\s+/g, ' ').trim();
+ if (!el.querySelectorAll) return el.textContent.replace(/[^\S\u00a0]+/g, ' ').trim();
const c = el.cloneNode(true);
for (const b of c.querySelectorAll('p, h2, h3, div, li, ul, button, label, select, input, span, code')) { b.before(' '); b.after(' '); }
- return c.textContent.replace(/\s+/g, ' ').replace(/ ([.,?’)])/g, '$1').replace(/\( /g, '(').trim();
+ return c.textContent.replace(/[^\S\u00a0]+/g, ' ').replace(/ ([.,?’)])/g, '$1').replace(/\( /g, '(').trim();
};
// ---------------------------------------------------------------------------------------------------
@@ -121,13 +121,13 @@ test('parseList keeps repos, drops removed and malformed rows, and reads other w
test('row status and time copy', () => {
const W = (o) => m.parseWorktree(o);
assert.deepEqual(m.rowStatus(W(fx.WORKING), fx.NOW), { led: 'run', text: 'is working here', kind: 'working' });
- assert.equal(m.rowStatus(W(fx.FINISHED_DUE), fx.NOW).text, 'finished 1:42 PM');
+ assert.equal(m.rowStatus(W(fx.FINISHED_DUE), fx.NOW).text, 'finished 1:42\u00a0PM');
assert.equal(m.rowStatus(W(fx.FINISHED_DUE), fx.NOW).led, 'ok');
assert.equal(m.rowStatus(W(fx.CLEANED), fx.NOW).text, 'finished yesterday');
assert.equal(m.rowStatus(W(fx.MINE), fx.NOW).text, 'made by you');
assert.equal(m.rowStatus(W(fx.MISSING), fx.NOW).kind, 'missing');
assert.equal(m.rowTime(W(fx.WORKING), fx.NOW), 'active now');
- assert.equal(m.rowTask(W(fx.MINE), fx.NOW), 'No task. Made from the Dev desk 9:12 AM');
+ assert.equal(m.rowTask(W(fx.MINE), fx.NOW), 'No task. Made from the Dev desk 9:12\u00a0AM');
assert.equal(m.rowTask(W({ ...fx.MINE, thread_title: 'lin/search-index' }), fx.NOW), 'Chat: lin/search-index', 'thread_title (contract v3) when there is no task');
assert.equal(m.changesLabel(0), 'No uncommitted changes');
assert.equal(m.changesLabel(1), '1 uncommitted file');
@@ -137,17 +137,17 @@ test('row status and time copy', () => {
test('P3 states: due, kept, cleaning, cleaned with kept notes, failed', () => {
const W = (o) => m.parseWorktree(o);
- assert.deepEqual(m.p3State(W(fx.FINISHED_DUE)), { kind: 'due', at: '2:42 PM', dirs: [] });
+ assert.deepEqual(m.p3State(W(fx.FINISHED_DUE)), { kind: 'due', at: '2:42\u00a0PM', dirs: [] });
assert.deepEqual(m.p3State(W({ ...fx.FINISHED_DUE, keep_build: true })), { kind: 'kept' });
assert.deepEqual(m.p3State(W(fx.FINISHED_DUE), { cleaning: true }), { kind: 'cleaning' });
- assert.deepEqual(m.p3State(W(fx.CLEANED)), { kind: 'cleaned', size: '1.2 GB', at: '6:40 PM', dirs: ['.vite', 'target'] });
+ assert.deepEqual(m.p3State(W(fx.CLEANED)), { kind: 'cleaned', size: '1.2 GB', at: '6:40\u00a0PM', dirs: ['.vite', 'target'] });
assert.deepEqual(m.keptNotes(W(fx.CLEANED)), ['Kept dist: Git tracks a file in it.']);
assert.equal(m.p3State(W(fx.WORKING)), null);
assert.equal(m.p3State(W(fx.MISSING)), null);
assert.deepEqual(m.p3State(W(fx.FINISHED_DUE), { failed: 'Lin is working here' }), { kind: 'failed', reason: 'Lin is working here' });
// D1: Clean now on a kept worktree shows the cleaned result, its kept notes and a toast.
const keptClean = { ...fx.FINISHED_DUE, keep_build: true, clean_at: null, cleaned_at: '2026-11-10T15:10:00Z', cleaned: ['node_modules', 'web/dist'], cleaned_bytes: 300_000, kept: [{ dir: 'dist', why: 'tracked' }] };
- assert.deepEqual(m.p3State(W(keptClean)), { kind: 'cleaned', size: '300 KB', at: '3:10 PM', dirs: ['node_modules', 'dist'] });
+ assert.deepEqual(m.p3State(W(keptClean)), { kind: 'cleaned', size: '300 KB', at: '3:10\u00a0PM', dirs: ['node_modules', 'dist'] });
assert.deepEqual(m.keptNotes(W(keptClean)), ['Kept dist: Git tracks a file in it.']);
assert.equal(m.cleanToast(W(keptClean)), 'Cleaned 300 KB of build output. Kept dist: Git tracks a file in it.');
// A clean from before this finish doesn't hide "kept".
@@ -205,10 +205,10 @@ test('the list groups by repo with counts, rows in every state, and an empty rep
assert.match(text(w1), /↑2/);
assert.equal(w1.querySelector('[data-wt-act="remove"]').getAttribute('aria-disabled'), 'true');
assert.match(text(w1), /Pixel is working here\. Stop Pixel first\./);
- assert.match(text(row(host, 'w2')), /Lin finished 1:42 PM/);
+ assert.match(text(row(host, 'w2')), /Lin finished 1:42\u00a0PM/);
assert.match(text(row(host, 'w2')), /up to date|↑4/);
assert.match(text(row(host, 'w4')), /You made by you try-vite-6/);
- assert.match(text(row(host, 'w4')), /No task\. Made from the Dev desk 9:12 AM/);
+ assert.match(text(row(host, 'w4')), /No task\. Made from the Dev desk 9:12\u00a0AM/);
assert.match(text(row(host, '/home/ann/code/shop-hotfix')), /shop-hotfix made outside kwant hotfix\/1\.4\.2/);
assert.equal(row(host, '/home/ann/code/shop-hotfix').querySelector('[data-wt-act="remove"]'), null, 'outside rows are read-only');
const site = host.querySelector('[data-wt-repo="site"]');
@@ -222,7 +222,7 @@ test('P3 line: Keep it, then Clean now; a refused clean says why and nothing els
const host = await mount();
const p3 = () => row(host, 'w2').querySelector('[data-wt-p3]');
assert.equal(p3().dataset.wtP3, 'due');
- assert.match(text(p3()), /Build output is cleaned at 2:42 PM · Keep it/);
+ assert.match(text(p3()), /Build output is cleaned at 2:42\u00a0PM · Keep it/);
await click(p3().querySelector('[data-wt-keep]'));
assert.deepEqual(calls.at(-2).body ?? calls.find((c) => c.url.endsWith('/keep')).body, { keep: true });
assert.equal(p3().dataset.wtP3, 'kept');
@@ -230,7 +230,7 @@ test('P3 line: Keep it, then Clean now; a refused clean says why and nothing els
assert.equal(p3().dataset.wtP3, 'failed');
assert.match(text(p3()), /Couldn’t clean build output: Lin is working here\. Nothing else was touched\. · Try again/);
const cleaned = row(host, 'w3').querySelector('[data-wt-p3]');
- assert.match(text(cleaned), /Cleaned 1\.2 GB of build output at 6:40 PM \(\.vite, target\) · Kept dist: Git tracks a file in it\./);
+ assert.match(text(cleaned), /Cleaned 1\.2 GB of build output at 6:40\u00a0PM \(\.vite, target\) · Kept dist: Git tracks a file in it\./);
});
test('D1: Clean now on a kept worktree shows the cleaned line, its kept notes and a toast', async () => {
@@ -245,7 +245,7 @@ test('D1: Clean now on a kept worktree shows the cleaned line, its kept notes an
await click(p3().querySelector('[data-wt-clean]'));
assert.ok(calls.some((c) => c.method === 'POST' && c.url.endsWith('/w2/clean')));
assert.equal(p3().dataset.wtP3, 'cleaned');
- assert.match(text(p3()), /Cleaned 300 KB of build output at 3:10 PM \(node_modules\) · Kept dist: Git tracks a file in it\./);
+ assert.match(text(p3()), /Cleaned 300 KB of build output at 3:10\u00a0PM \(node_modules\) · Kept dist: Git tracks a file in it\./);
assert.match(text(host.querySelector('[data-wt-toast]')), /^Cleaned 300 KB of build output\. Kept dist: Git tracks a file in it\.$/);
});