Skip to content

CI + test harness: 35 pre-existing failures on clean main, no automated test gate #586

Closed

Description

@Nuctori

Summary

The repo ships a npm test script (node --experimental-strip-types --test "app/**/*.test.mjs" …) but has no CI and 35 pre-existing test failures on a clean main. The failures are not product bugs — they are test-harness/environment issues that never get caught because nothing runs the suite automatically. This makes "does my change break tests?" unanswerable, which is a governance gap.

This issue (1) documents the failures with evidence, (2) asks for CI to run the suite on every push/PR, and (3) asks for first-class E2E coverage of the session-history paths (#509 / #555).

Evidence

On a clean upstream checkout (2a6e537 Release v0.8.9, no local changes):

npm test
ℹ tests 587
ℹ pass  549
ℹ fail   35

The 35 failures come from two root causes, neither of which touches application logic:

1. Component/hook tests fail with useI18n must be used inside I18nProvider

Affected: components/MermaidBlock.test.mjs, components/CodeBlock*, components/MessageView.test.mjs, components/AppShell.file-viewer-state.test.mjs, components/ChatInput.test.mjs, components/ExtensionStatusBar.test.mjs, components/ExtensionWidgets.test.mjs, components/TurnWrittenFiles.test.mjs, hooks/useAgentSession.test.mjs, …

Tests render with renderToStaticMarkup(<I18nProvider><Component/></I18nProvider>) and the provider is wrapped (e.g. MermaidBlock.test.mjs:21-25). The error is thrown because useContext(I18nContext) returns null — the provider and the consumer resolve two different I18nContext instances.

Root cause: under node --experimental-strip-types, createJiti({ moduleCache: false }) re-instantiates modules, so react / I18nContext loaded by the test entry and by the imported .tsx are separate module instances. The context created by the test's I18nProvider is not the one useI18n() reads. This is a harness incompatibility, not a code defect.

2. lib/project-command-env.test.mjs fails on Windows PATH separator

direct bash updates the platform PATH key expects PATH: '...\bin;/usr/bin' (Windows ;) but gets : (POSIX). Environment-specific assertion, not a logic bug.

Both classes fail identically on the unmodified baseline, so they are pre-existing and unrelated to any feature PR.

What we propose

A. Add CI (GitHub Actions)

A minimal workflow that runs the existing suite so regressions are caught:

# .github/workflows/ci.yml
name: ci
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci
      - run: npm run lint
      - run: npm test
      - run: npm run build

B. Fix the component-test harness (so the 35 become green)

Single shared React instance for the test process — e.g. one createJiti instance without moduleCache: false, or run component tests through tsx/vitest instead of node --experimental-strip-types. This is a small, contained change and would make npm test trustworthy.

C. First-class E2E for session history

#509 (deep linear chains overflowing the stack) and #555 (full-history transfer on open) are exactly the kind of bug that unit tests miss and a real browser catches. We added lib/session-reader.pagination.test.mjs + app/api/sessions/{detail,context}-route.test.mjs covering the data/route boundary (tail window, ?before page dedupe, 1000 cap, string-content guard). A Playwright job that boots the app and opens a >3000-message linear session would cover the remaining UI path (sentinel pagination in ChatWindow). Happy to contribute a .github/workflows/e2e.yml + the Playwright specs we prototyped, if you want E2E in-repo.

Impact on the current fix PR

Our fix/session-history-tail branch adds 16 passing tests and changes the failure count by exactly 0 (587→603 tests, 549→565 pass, 35 fail unchanged), confirming no regression from the pagination work — but we can only claim that because we ran the suite by hand. CI would make that automatic for every contributor.

Ask

  1. Add .github/workflows/ci.yml (lint + npm test + build).
  2. Fix the test harness so component tests share one React instance (turn the 35 red → green).
  3. Consider a Playwright E2E job for session-history paths.

Activity

  1. agegr commented on Sep 5, 2026

    @agegr
    Owner

    Completed by #588 and #722. The React/i18n test harness was repaired, CI now runs lint, TypeScript, unit tests, production build, and Chromium E2E, including 5,000-message desktop/mobile history pagination. Current main CI is green. Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions