diff --git a/services/platform/app/features/home/components/home-panel.browser.test.tsx b/services/platform/app/features/home/components/home-panel.browser.test.tsx index 8c3f9f7f47..f215bbd2c4 100644 --- a/services/platform/app/features/home/components/home-panel.browser.test.tsx +++ b/services/platform/app/features/home/components/home-panel.browser.test.tsx @@ -1,5 +1,7 @@ import '@testing-library/jest-dom/vitest'; +import { AccentColorProvider } from '@tale/ui/accent-color'; import { Dialog } from '@tale/ui/dialog/dialog'; +import axe from 'axe-core'; import { useState, type AnchorHTMLAttributes, type ReactNode } from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { page, userEvent } from 'vitest/browser'; @@ -1070,6 +1072,275 @@ describe('a long PROJECTS list in Chromium', () => { }); }); +/** + * Task rows use the shared age class and keep their ages visible on hover + * (chat actions replace ages on desktop). The active fill is a sibling + * SlidingHighlight, not a row ancestor. + */ +describe.each(['light', 'dark'] as const)( + 'rendered Home row ages (%s)', + (theme) => { + it.each([ + [1280, undefined], + [1280, '#000000'], + [1280, '#056CFF'], + [390, undefined], + [390, '#000000'], + [390, '#056CFF'], + ] as const)( + 'clears AA and axe for visible row ages at %ipx (accent %s)', + async (width, accent) => { + await resizeViewport(width, 800); + document.documentElement.classList.toggle('dark', theme === 'dark'); + const palette = accent ? deriveAccentPalette(accent, theme) : undefined; + const now = Date.now(); + backend.home = { + ...homeData([], []), + items: Array.from({ length: 3 }, (_, index): HomeItem => ({ + kind: 'task', + id: `task-${index}`, + title: `Task ${index + 1}`, + activityAt: now - index * 60_000, + unread: false, + status: 'in_progress', + awaitingMyReview: false, + })), + } satisfies HomeData; + backend.location = { + pathname: `/dashboard/${ORG}/tasks/task-0`, + search: {}, + }; + localStorage.setItem(`home-view-${ORG}`, JSON.stringify('tasks')); + const { container } = render( + +
+ {width >= 768 ? ( + + + + ) : ( + + )} +
+
, + ); + const current = screen.getByRole('link', { name: /Task 1/ }); + const idle = screen.getByRole('link', { name: /Task 2/ }); + expect(current).toHaveAttribute('aria-current', 'page'); + expect(idle).not.toHaveAttribute('aria-current'); + const scroller = streamRows(); + const highlight = scroller.querySelector( + ':scope > span[aria-hidden="true"]', + ); + if (!(highlight instanceof HTMLElement)) + throw new Error('No Home highlight'); + const highlightElement: HTMLElement = highlight; + + function ageOf(row: HTMLElement) { + const age = row.querySelector('span.tabular-nums'); + if (!(age instanceof HTMLElement)) throw new Error('No Home row age'); + expect(age.textContent).not.toBe(''); + return age; + } + + function statusOf(row: HTMLElement) { + const status = within(row).getByText('In progress'); + expect(status).toHaveClass('truncate'); + return status; + } + + function measuredContrast( + row: HTMLElement, + highlighted: boolean, + text: HTMLElement = ageOf(row), + ) { + const age = text; + const layers: Element[] = []; + for ( + let node: Element | null = age; + node; + node = node.parentElement + ) { + layers.push(node); + } + let background = '#ffffff'; + for (const node of layers.reverse()) { + background = painted( + getComputedStyle(node).backgroundColor, + background, + ); + if (highlighted && node === scroller) { + const style = getComputedStyle(highlightElement); + background = painted( + style.backgroundColor, + background, + Number(style.opacity), + ); + } + } + const style = getComputedStyle(age); + expect(style.opacity).toBe('1'); + expect(box(age).width).toBeGreaterThan(0); + expect(box(age).height).toBeGreaterThan(0); + const ratio = contrastRatio( + painted(style.color, background, Number(style.opacity)), + background, + ); + console.info( + 'TALE-452 rendered contrast', + JSON.stringify({ + theme, + width, + accent: accent ?? null, + state: highlighted + ? 'highlighted' + : row.matches(':hover') + ? 'hovered' + : 'idle', + text: text.textContent, + foreground: style.color, + background, + opacity: style.opacity, + ratio, + }), + ); + return ratio; + } + + async function assertPanel() { + // Wait for the real highlight to settle underneath the current age. + await expect + .poll(() => { + const fill = box(highlightElement); + const age = box(ageOf(current)); + return ( + fill.left <= age.left && + fill.right >= age.right && + fill.top <= age.top && + fill.bottom >= age.bottom && + getComputedStyle(highlightElement).opacity === '1' + ); + }) + .toBe(true); + expect(measuredContrast(idle, false)).toBeGreaterThanOrEqual(4.5); + expect(measuredContrast(current, true)).toBeGreaterThanOrEqual(4.5); + expect( + measuredContrast(idle, false, statusOf(idle)), + ).toBeGreaterThanOrEqual(4.5); + expect( + measuredContrast(current, true, statusOf(current)), + ).toBeGreaterThanOrEqual(4.5); + // Whole neutral Home panel; additional branded coverage targets + // ages, the repaired ink contract, rather than unrelated labels. + const ageNodes = [ageOf(idle), ageOf(current)]; + const checkedNodes = [...ageNodes, statusOf(idle), statusOf(current)]; + const result = await axe.run(palette ? checkedNodes : container, { + runOnly: ['color-contrast'], + elementRef: true, + }); + const plainCheck = (check: axe.CheckResult) => ({ + id: check.id, + impact: check.impact, + message: check.message, + data: check.data, + relatedNodes: check.relatedNodes?.map( + (related: axe.RelatedNode) => ({ + html: related.html, + target: related.target, + }), + ), + }); + const plainNode = (node: axe.NodeResult) => ({ + any: node.any?.map(plainCheck), + all: node.all?.map(plainCheck), + none: node.none?.map(plainCheck), + html: node.html, + impact: node.impact, + target: node.target, + failureSummary: node.failureSummary, + }); + const plainRule = (rule: axe.Result) => ({ + id: rule.id, + impact: rule.impact, + help: rule.help, + helpUrl: rule.helpUrl, + description: rule.description, + tags: rule.tags, + nodes: rule.nodes?.map(plainNode), + }); + console.info( + 'TALE-452 axe', + JSON.stringify({ + theme, + width, + accent: accent ?? null, + hovered: idle.matches(':hover'), + scope: palette ? 'row ages and status' : 'whole Home panel', + violations: result.violations.map(plainRule), + agePasses: result.passes + .flatMap((rule) => rule.nodes) + .filter((node) => ageNodes.includes(node.element!)) + .map(plainNode), + }), + ); + expect(result.violations).toEqual([]); + expect( + result.passes.some((rule) => rule.id === 'color-contrast'), + ).toBe(true); + // A visible age must be evaluated, not deferred to manual inspection. + for (const age of checkedNodes) { + expect( + result.passes + .flatMap((rule) => rule.nodes) + .some((node) => node.element === age), + ).toBe(true); + } + } + + await page + .elementLocator(screen.getByPlaceholderText(/Search/i)) + .hover(); + await assertPanel(); + await page.elementLocator(idle).hover(); + await expect.poll(() => idle.matches(':hover')).toBe(true); + // Wait for the hover fill transition before measuring it. + await expect + .poll(() => getComputedStyle(idle).backgroundColor) + .not.toBe('rgba(0, 0, 0, 0)'); + await expect.poll(() => idle.getAnimations().length).toBe(0); + await assertPanel(); + + if (theme === 'light' && !palette) { + // Negative control: the pre-#4171 age class on the same real DOM + // must fail both the measured AA floor and axe. Restore in finally. + const age = ageOf(idle); + const repairedClass = age.className; + try { + age.className = + 'text-muted-foreground/80 shrink-0 text-[11px] leading-5 tabular-nums transition-opacity duration-150'; + expect(measuredContrast(idle, false)).toBeLessThan(4.5); + const old = await axe.run(age, { + runOnly: ['color-contrast'], + elementRef: true, + }); + expect( + old.violations.some( + (rule) => + rule.id === 'color-contrast' && + rule.nodes.some((node) => node.element === age), + ), + ).toBe(true); + } finally { + age.className = repairedClass; + } + await assertPanel(); + } + }, + 15_000, + ); + }, +); + describe('desktop Home panel resizing', () => { function mountPanel() { backend.home = homeData([], []); diff --git a/services/platform/app/features/home/components/home-rows.tsx b/services/platform/app/features/home/components/home-rows.tsx index 18fcb01a89..9e2e122bdf 100644 --- a/services/platform/app/features/home/components/home-rows.tsx +++ b/services/platform/app/features/home/components/home-rows.tsx @@ -169,7 +169,7 @@ function RowText({ )} - + {draft && ( diff --git a/services/platform/tests/manual/reference/automation.md b/services/platform/tests/manual/reference/automation.md index 2e5adc77a2..e973cc6da2 100644 --- a/services/platform/tests/manual/reference/automation.md +++ b/services/platform/tests/manual/reference/automation.md @@ -1113,6 +1113,7 @@ Legend: โœ… fully automated ยท ๐Ÿ”ถ partially automated ยท โ›” manual-only (no s | [projects](../suites/projects.md) / [tasks](../suites/tasks.md) | REST task lifecycle toggle (contract 1.20.0): `PATCH /api/v1/projects/{id}/tasks/{taskId}` `{archived}` archives or restores the task through the board's own `archiveTask`/`restoreTask` inside the door's serializable transaction โ€” idempotent both ways (a repeat writes nothing), the project write gate first (403 `PROJECT_ARCHIVED` / `RBAC_FORBIDDEN`), the project-scoped lookup next (404 `TASK_NOT_FOUND` for another project's task), the task itself may be archived (that is the restore), a strict `{archived: boolean}` body (400 `INVALID_BODY`), and the task as it now stands answered; the operation, its statuses and its place in the door-wide contract are pinned in the spec guards | โœ… automated | `backend/rest/v1-tasks.test.ts`, `scripts/openapi/spec.test.ts` | | [automations](../suites/automations.md) / [tasks](../suites/tasks.md) | GitHub and GlitchTip imports share labelled source and destination controls; invalid inputs block starts, refused starts retain input, continuation preserves version and scope and resets after source edits, mock results never link fake tasks, and source cards link canonical URLs and show resolution independently of Tale status. | โœ… automated | `app/features/automations/components/automation-run-dialog.test.tsx`, `app/features/automations/components/issue-import-continuation.test.tsx`, `app/features/automations/components/issue-import-result.test.tsx`, `app/features/tasks/components/task-external-issue-card.test.tsx` | | [navigation](../suites/navigation.md) / [tasks](../suites/tasks.md) | Home view labels meet AA contrast on the actual pill track in light and dark themes; arrow keys wrap selection and focus together; task-page headings group the brief, discussion and details; the mobile details opener controls its visible sheet and Escape restores focus | โœ… automated | `app/features/home/components/home-view-switcher.browser.test.tsx` (real Chromium contrast and keyboard), `app/features/tasks/components/task-page-layout.test.tsx` (heading audit and mobile dialog relationship); full-page breakpoint behavior remains browser-reviewed | +| [accessibility](../suites/accessibility.md) / [navigation](../suites/navigation.md) | `A11Y-A8` (the Home rows' half): a task row's age and its status line, on the idle, the hovered and the selected row, measure at least 4.5:1 and pass axe `color-contrast` in light and dark themes, on the desktop panel and the phone screen, in the neutral, black and shipped-blue accents; the selected row's status line stays on the foreground ink so it clears the highlight, and the age class before #4171 fails both the measurement and axe | ๐Ÿ”ถ browser | `app/features/home/components/home-panel.browser.test.tsx` (real Chromium, "rendered Home row ages") โ€” chat and project rows and the rest of `A11Y-A8` stay a manual contrast round | | [notifications](../suites/notifications.md) / [navigation](../suites/navigation.md) / [responsive](../suites/responsive.md) / [tasks](../suites/tasks.md) / [settings](../suites/settings.md) | One count chip on the rail tile, the bell and the phone tab bar (red, capped at 99+, `aria-hidden`), with the bell's accessible name carrying its unread count; the task details panel and create dialog name the priority beside its glyph; a chat, a task comment and an inbox reply share one send button that spins while the send is in flight; Agent runtimes state the missing-credential fix once above the list while each row reads `settings.providers.harnesses.noModel` | โœ… component | `packages/ui/src/components/feedback/count-badge.test.tsx`, `app/features/notifications/components/notification-bell.test.tsx`, `app/features/tasks/components/priority-picker.test.tsx`, `packages/ui/src/components/primitives/send-button.test.tsx`, `app/features/settings/providers/components/harness-status-section.test.tsx` | | [tasks](../suites/tasks.md) / [automations](../suites/automations.md) / [chat](../suites/chat.md) | The Anthropic catalog ships Claude Opus 5.5 and Claude Fable 5.1 with their 1M window, 128K reply ceiling, prices and an effort knob without an off switch, and OpenRouter's defaults carry both spellings; the chat Auto frontier band puts each successor directly ahead of the model it replaces; the shipped entries' Anthropic bodies carry no `thinking`, sampling parameter or `tool_choice` at any effort step; a managed Claude Code exec on either keeps adaptive thinking and the ultrathink prefix, and pins every alias slot and every subagent (`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`) to the served id | โœ… unit + golden | `backend/core/lib/providers/load_system_config.test.ts`, `lib/chat/model-choice.test.ts`, `backend/core/automations_builder/chat_wire.test.ts`, `lib/harnesses/exec-builder.test.ts`, `lib/harnesses/golden-exec.test.ts`, `packages/shared/src/utils/model-ref.test.ts`; a live run of the pinned Claude Code against these models is `TASK-F30` | | [projects](../suites/projects.md) / [chat](../suites/chat.md) | A project member reading a chat shared with the project: the transcript subscribes to the thread (the read-only pill drew over an EMPTY conversation while its data key was withheld to strip the actions), no rating / edit / fork / retry / read-aloud, the message box disabled, **Export** in the menu without **Share**; the message door serves a reader the leaf on the owner's screen under the root's id (a sibling asked for by id is 404, the lineage read stays the owner's, a withdrawn share closes the root) | โœ… component + route + real-Postgres | `app/features/chat/components/chat-surface.test.tsx`, `backend/domains/chat/routes.test.ts`, `backend/domains/chat/threads.test.ts`, the `checkChatThreadSurface` lane in `backend:integration`; the two-session walk stays manual (`PROJ-F31`) |