mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 18:35:33 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The `@paperclipai/ui` Vitest suite includes 182 component/page test files, many of which boot full jsdom and React module graphs with 6–19 mocks solely to verify wiring that Playwright E2E specs already exercise end-to-end. > - Auth, security, permission, privacy, error-boundary, pure-logic `ui/src/lib` / `ui/src/hooks` / `ui/src/api` suites, and complex interactive client logic must stay intact. > - This pull request removes 36 thin mocked/E2E-duplicated/synthetic-perf jsdom component/page test files (-17,367 LOC), consolidates 7 tiny single-purpose session-replay privacy tests into `ui/src/lib/analytics/replay-masking.test.tsx` with 100% of assertions preserved, converts 2 pure-logic suites from `jsdom` to `node`, and updates affected feature/agent-access map references plus `.github/workflows/ci-incremental-qualification.yml`. > - The benefit is cutting full `@paperclipai/ui` suite execution to ~36s locally (~42s fewer raw test seconds and 42 fewer jsdom boots) while preserving 100% of auth, permission, privacy, and pure-logic coverage. ## Linked Issues or Issue Description Refs #22804 **What existing behavior does this improve?** UI Vitest runtime, signal-to-noise ratio, and jsdom boot overhead in `ui/src/`. **Subsystem affected** ui/ — React + Vite board UI **Current behavior** 36 thin mocked/E2E-duplicated/synthetic-perf jsdom component/page tests and 7 tiny single-purpose session-replay privacy files pay full jsdom+React boot overhead on every UI PR despite duplicate Playwright E2E and pure-logic coverage. **Proposed behavior** Remove the 36 thin mocked/E2E-duplicated jsdom suites, consolidate the 7 session-replay privacy suites into `ui/src/lib/analytics/replay-masking.test.tsx`, convert 2 pure-logic suites to `node`, and keep all maps and incremental qualification checks aligned. ## What Changed - **Deleted 36 thin mocked / E2E-duplicated / synthetic-perf jsdom suites (`-17,367 LOC`):** - Mocked chat-adapter setup & banner wiring (4 files), heavily mocked `Inbox.test.tsx` shell (1 file, 19 mocks; pure logic in `ui/src/lib/inbox.test.ts` and browser E2E retained), synthetic jsdom microbenchmarks & mocked app/browse/connector wiring (9 files), mocked AI-connection & agent-config wiring (6 files), and thin presentational/mocked component wiring (16 files). - **Consolidated 7 tiny session-replay privacy tests into `ui/src/lib/analytics/replay-masking.test.tsx` (498 LOC, 100% of assertions preserved):** `AccountQuotaPanels`, `WebhookFields`, `AiConnectionPicker`, `AiConnectionAccountControls`, `AiConnectionIdentity`, `AiConnectionPoolRunDetails`, and `AgentSetupPrompt`. - **Converted 2 pure-logic suites from `jsdom` to `node` (0 assertions lost):** `ui/src/pages/Secrets.test.ts` and `ui/src/pages/tools/ProfilesTab.test.ts`. - **Retained 100% of high-signal UI coverage:** all 276 `ui/src/lib`, 56 `ui/src/hooks`, 19 `ui/src/context`, 26 `ui/src/api`, 14 `ui/src/adapters`, 6 `ui/src/plugins`, all 94 pure-logic `node` component/page tests, and all auth/security/permission/privacy/error-boundary/complex-interactive suites. - **Updated references:** updated the 7 affected `maps/` files to reference current canonical suites and updated `.github/workflows/ci-incremental-qualification.yml` (`ui/src/pages/Inbox.tsx → Inbox.test.tsx` to `ui/src/pages/Auth.tsx → Auth.test.tsx`). ## Verification - `pnpm exec vitest run --project @paperclipai/ui` — **557/557 files, 6,916 passed | 1 skipped (`36.14s`)** - `pnpm --filter @paperclipai/ui typecheck` — **PASS (0 errors)** - `node scripts/storybook-catalog.mjs` — **PASS (371 files, 3,480 stories)** - `node scripts/check-maps.mjs` — **PASS (35 areas, 192 capability IDs)** - `node scripts/check-query-error-rendering.mjs` — **PASS (0 findings)** - `node scripts/check-test-budget.mjs --base origin/master` — **PASS (588 nightly suites validated)** - Verified `.github/workflows/ci-incremental-qualification.yml` `qualify_test_selection` check locally (`Auth.tsx → Auth.test.tsx`) — **PASS** ## Risks - Low risk: zero production UI code changed; all auth, permission, privacy, replay-masking, error-boundary, pure-logic, and Playwright E2E behavioral checks remain intact. ## Model Used - Google Gemini (Antigravity agent swarm) with extended reasoning, tool use, and local test execution (`e2e-opt`, `verifier`, `ci-pipeline`). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge
117 lines
5.4 KiB
YAML
117 lines
5.4 KiB
YAML
name: Incremental CI qualification
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- package.json
|
|
- turbo.json
|
|
- .github/ci-task-matrix.json
|
|
- .github/scripts/ci-plan.mjs
|
|
- .github/scripts/ci-diff.mjs
|
|
- .github/scripts/ci-inputs.mjs
|
|
- .github/scripts/tests/ci-plan.test.mjs
|
|
- .github/actions/run-ci-task/**
|
|
- .github/workflows/ci-routing.yml
|
|
- .github/workflows/pr-trusted.yml
|
|
- .github/workflows/ci-incremental-qualification.yml
|
|
- scripts/ci/**
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: incremental-ci-proof-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
qualify_test_selection:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86
|
|
with:
|
|
version: 9.15.4
|
|
- uses: ./.github/actions/setup-ci-dependencies
|
|
- name: Prove conservative graphs, exact partitions, manifests and failure fallbacks
|
|
run: node --test scripts/ci/test-selection*.test.mjs scripts/ci/vitest-impact-report.integration.test.mjs
|
|
- name: Qualify selection against the real Paperclip workspace
|
|
env:
|
|
NODE_ENV: test
|
|
VITEST: 'true'
|
|
run: |
|
|
node --input-type=module <<'NODE'
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { execFileSync } from 'node:child_process';
|
|
import { planTasks } from './.github/scripts/ci-plan.mjs';
|
|
import { createTestSelection } from './scripts/ci/select-tests.mjs';
|
|
const config = JSON.parse(readFileSync('turbo.json', 'utf8'));
|
|
const lanes = JSON.parse(readFileSync('.github/ci-task-matrix.json', 'utf8'));
|
|
const head = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim();
|
|
for (const [file, project, related] of [
|
|
['ui/src/pages/Auth.tsx', '@paperclipai/ui', 'ui/src/pages/Auth.test.tsx'],
|
|
['server/src/middleware/auth.ts', '@paperclipai/server', 'server/src/__tests__/agent-auth-middleware.test.ts'],
|
|
['server/src/storage/config.test.ts', '@paperclipai/server', 'server/src/storage/config.test.ts'],
|
|
]) {
|
|
const selected = await createTestSelection(planTasks({ config, lanes, paths: [file, "doc/DEVELOPING.md", "doc/plans/2026-10-30-ci-proof.md"] }), head);
|
|
const graph = selected.graphs.find(graph => graph.project === project);
|
|
assert.ok(graph.related.includes(related));
|
|
assert.ok(graph.alwaysRun.length > 0, 'Filesystem contracts must remain covered');
|
|
assert.ok(graph.selected.length < graph.inventory.length, 'The real workspace must support narrowing');
|
|
console.log(file, JSON.stringify(selected.plan.testSelection.stats, null, 2));
|
|
}
|
|
NODE
|
|
|
|
qualify:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
with:
|
|
node-version: 24
|
|
package-manager-cache: false
|
|
- name: Install isolated qualification tools
|
|
run: npm install --prefix "$RUNNER_TEMP/ci-tools" --no-audit --no-fund turbo@2.11.10 pnpm@9.15.4
|
|
- name: Prove planning and required checks
|
|
run: node --test .github/scripts/tests/ci-plan.test.mjs .github/scripts/tests/ci-routing.test.mjs
|
|
- name: Prove real cache reuse and invalidation
|
|
env:
|
|
PAPERCLIP_CI_TEST_TURBO: ${{ runner.temp }}/ci-tools/node_modules/.bin/turbo
|
|
run: PATH="$RUNNER_TEMP/ci-tools/node_modules/.bin:$PATH" node --test scripts/ci/cache.integration.test.mjs
|
|
- name: Check the real repository task graph
|
|
env:
|
|
CI_TURBO_BIN: ${{ runner.temp }}/ci-tools/node_modules/.bin/turbo
|
|
run: |
|
|
node --input-type=module <<'NODE'
|
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
import { execFileSync } from 'node:child_process';
|
|
import assert from 'node:assert/strict';
|
|
import { executionPlan } from './scripts/ci/execution-plan.mjs';
|
|
const config = JSON.parse(readFileSync('turbo.json', 'utf8'));
|
|
for (const task of ['ci:server', 'ci:db', 'ci:runner-rust']) {
|
|
const plan = executionPlan(config, task, []);
|
|
const file = process.env.RUNNER_TEMP + '/ci-task-config.json';
|
|
writeFileSync(file, JSON.stringify(plan.config));
|
|
const result = execFileSync(process.env.CI_TURBO_BIN, ['run', plan.target, '--root-turbo-json', file,
|
|
'--dry=json', '--cache-dir=.turbo/cache', '--', ...plan.args], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
|
|
assert.ok(JSON.parse(result).tasks.some((task) => task.taskId === plan.target));
|
|
}
|
|
NODE
|
|
- name: Explain this pull request's plan
|
|
env:
|
|
CI_INCREMENTAL_MODE: shadow
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
MERGE_SHA: ${{ github.sha }}
|
|
run: node .github/scripts/ci-plan.mjs "$BASE_SHA" "$MERGE_SHA"
|