Files
PaperClipAI/doc/testing/onboarding-first-chat-test-drive.md
T
Devin FoleyandPaperclip 90bf446ad5 Guard release onboarding with scoped source E2E (#23432)
## Thinking Path

> - Paperclip helps people manage work with AI agents.
> - A release must pass onboarding before it reaches nightly.
> - Onboarding changes already run source browser tests on PRs.
> - The published release smoke used a separate scenario, which could
drift from those tests.
> - That drift blocked the December 1 nightly after onboarding
succeeded.
> - This PR fixes the stale welcome assertion and shares the scenario
between release smoke and relevant PR E2E runs.

## Linked Issues or Issue Description

Refs #23334 and #22259.

**What happened?**

[The December 1 nightly
release](https://github.com/paperclipai/paperclip/actions/runs/46614290688)
failed twice at `The onboarding chat must queue the lead's live
welcome`. PR #23334 changed the welcome to a saved message and a
question card. The greeting endpoint succeeded with `started: true` and
`runId: null`, but the release test still required a model run. PR
browser tests did not run those release expectations against the changed
source.

**Expected behavior**

Onboarding PRs and changes to their shared dependencies must run the
release scenario before merge. Known unrelated leaf-page changes and
source-unit-test-only changes can omit the extra case. Shared and
unfamiliar source paths must keep coverage. The scenario must check the
lead's welcome and all three first-chat choices, with no model run
before the user sends a choice or message. A mismatch must fail the
required `ci / e2e` check.

**Steps to reproduce**

1. Start the Docker onboarding harness with
`PAPERCLIPAI_VERSION=2026.1130.0-canary.873300` and its provider
verification mock.
2. Run the original release smoke test.
3. Observe successful login, setup, hire, and chat entry, followed by a
timeout because the run list stays empty.

**Paperclip version or commit**

Failed release source: `7ce7d99f8af81ae90f97650ef7a8692a86c63a35`.
Published package: `2026.1130.0-canary.873300`.

**Deployment mode**

The release test uses authenticated private Docker mode. The new PR test
uses the existing disposable source E2E instance and provider
verification fixture.

## What Changed

- Check the saved welcome and the three visible choices, then require an
empty agent run list.
- Move the complete wizard, hire, and chat assertions into one shared
onboarding scenario. Keep sign-in in the authenticated release wrapper.
- Add the shared scenario to the normal PR E2E suite. Omit only this
extra case when eligible source changes are confined to the Costs or
Approvals UI page, source unit tests, and audited prose. Shared
components, hooks, libraries, server code, mixed changes, and unfamiliar
source paths keep it. The repository rules require `ci / e2e` before
merge.
- Pass the trusted CI change plan to shard selection and bind it to the
checked-out commit. Reuse the existing lightweight source-diff
eligibility gate for both Vitest and E2E, with the old Vitest export
preserved. Full and shadow CI, broad or deleted inputs, invalid plans,
and stale plans keep the case. No extra browser job or matrix is added.
- Add release smoke files to the E2E and typecheck task inputs. Test
that onboarding changes select E2E and that smoke-only changes select
their two owners without forcing unrelated lanes.
- Document the shared test command and the source and installation
coverage.

## Verification

The shared browser scenario is unchanged from
`2044ada98e953504af68febe4c196f414d0bb1ae`. The selector review fix is
based on master’s hosted-shard speed improvement. Selector and
eligibility verification covers
`236640e419d1177aafb64f3f7dd1ee49848ee707`.

- Reproduced the original nightly timeout locally against the exact
published canary.
- The extracted release scenario passed against that canary in 22.1
seconds.
- The new source E2E passed against PR source and the built UI in 32.3
seconds.
- Restored the obsolete model-run assertion temporarily. The new source
E2E failed with the same `Expected: > 0 / Received: 0` timeout. Restored
the correct assertion. The final source confirmation passed in 31.7
seconds.
- `node --test scripts/__tests__/e2e-shard.test.mjs
.github/scripts/tests/ci-plan.test.mjs
scripts/ci/test-selection-workflow.test.mjs`: all 52 tests passed after
rebase. Coverage includes unrelated changes, relevant dependencies,
rename paths, full/invalid/stale plans, exact CLI shard partitions, and
both hosted shard policies. The unrelated-change and wiring tests failed
before the filter was implemented.
- Regression selection tests failed on `TaskChatComposer.tsx` and shadow
mode before this review fix. They now keep the composer, new-agent
runtime configuration, AI connection components, hooks, libraries, and
mixed source changes.
- The 3 existing source-diff eligibility contract tests passed after
extraction into the shared module.
- `actionlint .github/workflows/pr-trusted.yml` passed.
- `node --test scripts/ci/test-selection-inputs.test.mjs`: 4 tests
passed.
- The Playwright program and focused source scenario typechecks passed.
The test-budget check and `git diff --check` passed.
- The default local source bootstrap could not load the macOS embedded
PostgreSQL binary because its distribution lacked `libzstd.1.dylib`.
Source browser verification used a separate disposable Docker PostgreSQL
16 instance. Linux CI will cover the normal embedded database path.
- Earlier [hosted release
smoke](https://github.com/paperclipai/paperclip/actions/runs/46776940022)
passed both Docker onboarding and Linux background-service onboarding at
the first fix commit. The service job first hit npm package propagation
and passed on retry after publication completed.
- `pnpm verify --explain` requested broader CI coverage because the CI
task inputs changed. The focused checks above passed; the required CI
jobs will provide broad coverage.
- [Final-revision
CI](https://github.com/paperclipai/paperclip/actions/runs/46782167000)
passed on `236640e419d1177aafb64f3f7dd1ee49848ee707`. Both required
aggregates, all 16 browser shards, and all selected typecheck, build,
server, Runner, and canary dry-run jobs passed. [Incremental CI
qualification](https://github.com/paperclipai/paperclip/actions/runs/46782166749)
also passed.
- [The new source onboarding
case](https://github.com/paperclipai/paperclip/actions/runs/46782167000/job/143123174120)
ran on the hosted Linux runner and passed in 20.8 seconds.
- [Greptile
review](https://github.com/paperclipai/paperclip/pull/23432#issuecomment-7330325410)
scored `236640e419d1177aafb64f3f7dd1ee49848ee707` 5/5 and confirmed the
shared-dependency finding is fixed. There are no unresolved review
threads.

## Risks

- This changes test coverage and CI selection. It does not change
application behavior, release permissions, or publication rules.
- The source case stays on for shared and unfamiliar source changes. It
skips only the documented leaf pages and source-unit-test-only edits in
eligible plans. Local full E2E still includes it. Extend exclusions only
after checking that a path cannot affect onboarding.
- The trusted PR workflow is loaded from master. Before merge, the
current workflow keeps the full fallback because it does not yet pass
the change plan to the shard command. The unit and CLI tests qualify the
filtered path; after merge, the new workflow environment activates it.
- The source test uses local trusted authentication. The authenticated
published-package test remains responsible for login and installation
checks. Neither run needs paid model completions.
- GitHub master rules require code-owner approval for the protected CI
changes. Those review requests are already open. There are no conflicts
or unresolved review threads.
- A replacement nightly still needs a successful release run after this
reaches master. This PR does not bypass qualification or promote beta or
stable.

## Model Used

OpenAI Codex, `gpt-6.1-sol`, with xhigh reasoning effort, terminal
tools, GitHub CLI, and Playwright. The harness does not report the
context window size.

## 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

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-12-01 17:23:13 -08:00

65 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# First agent chat: manual test drive
Run this prototype from the first-chat greeting worktree, on a fresh loopback instance. Do not use your normal Paperclip database.
```sh
pnpm install --frozen-lockfile
PAPERCLIP_TELEMETRY_DISABLED=1 PORT=3812 pnpm dev:once --data-dir ./tmp/first-chat-preview
```
Open the `/onboarding` route in the local instance. If the local instance has not been set up, use the repository's normal local setup, or use the credential-free fixture below. Only enter model credentials on a trusted instance you control.
## Fast and slow arrival
1. Create a fresh organization and name the first agent. Connect a test model. On **Review**, leave the wizard open for a few seconds. There should be no welcome text or question card on that screen.
2. Click **Get started**. Watch the chat surface as it opens. After a short beat, the welcome should type into its agent bubble, a few characters at a time. Once the last character is visible, the native question card should fade and rise separately. The composer stays available throughout.
3. Verify that the choices appear in this order: **Interview me about my goals**, **Tell me what Paperclip can do**, and **Help me accomplish a task**.
4. Pick **Interview me about my goals** and **Continue**. The answer should be recorded once and the agent should start the interview, not create a task. Reload. The transcript should still show the welcome, your selection, and the agent’s reply in that order, with one copy of each. The intro plays once.
5. Create another organization and click **Get started** immediately. The welcome uses the name you entered. The app saves it and the card together, with zero agent runs. Select **Help me accomplish a task**. A text field appears. Entering a description keeps the agent idle. Clicking **Continue** sends the selection to the connected agent for its first reply.
6. Repeat with the system's reduced-motion preference turned on. The greeting and card should appear in that order with motion disabled.
To inspect timing, open DevTools → Network and filter for `onboarding/greeting`. The first POST should happen on Review, before you click **Get started**. A second POST after chat paints is an idempotent retry.
## Credential-free interactive fixture
Run from the repository root.
```sh
PAPERCLIP_TELEMETRY_DISABLED=1 PAPERCLIP_FIRST_CHAT_MANUAL=1 pnpm exec playwright test --config tests/e2e/playwright.config.ts conference-room-typing-intro.spec.ts -g 'warms the welcome' --debug
```
The script starts a separate loopback app and opens a headed browser with scripted model sign-in and scripted replies after submission. It uses the actual wizard, built-in personalized greeting, saved thread, and question response handler. When Playwright pauses, use the browser to follow the steps above. All three choices have scripted replies. After choosing one, type a follow-up such as “build a website” to receive the scripted acknowledgment. Reload and check that the messages keep their order. The fixture stops when Playwright exits.
To run the automated fast-arrival and delayed/reduced-motion checks without the inspector, omit `PAPERCLIP_FIRST_CHAT_MANUAL` and `--debug`, and select both tests with `-g 'warms the welcome|welcome request is pending'`.
## PR and release smoke coverage
The required `ci / e2e` check runs `tests/e2e/release-onboarding.spec.ts` against
the PR's source and built UI. It uses the same `completeOnboarding` scenario as
the authenticated Docker release smoke. Keep wizard, hire, welcome, and choice
assertions in `tests/release-smoke/onboarding-scenario.ts` so both gates change
together. Changes to the release smoke files also select the source E2E lane.
The shard planner omits this extra case only for changes confined to the Costs
or Approvals UI pages, source unit tests, and audited prose. Shared components,
hooks, libraries, server code, and new source paths keep the case by default.
Mixed changes keep it when any source file falls outside the known unrelated
set. The skip set lives in `scripts/e2e-shard.mjs`; extend it only after checking
that the new path cannot affect onboarding.
The browser and Vitest selectors share the source-diff eligibility check. Full
or shadow CI, missing or malformed change plans, deleted or non-source inputs,
and plans for a different checkout keep the case. Local unfiltered E2E runs also
keep it. No separate browser job is added.
Run the shared scenario before submitting onboarding changes:
```sh
pnpm exec playwright test --config tests/e2e/playwright.config.ts release-onboarding.spec.ts
```
The source run uses a disposable local instance and simulates only the upstream
API key check with the existing provider fixture. It does not need model
credentials. The release run also checks authentication and the published npm
installation. A source E2E pass does not replace that installation check.