Skip to content

test(cli): add opt-in live Flutter end-to-end test - #80

Merged
ElbertePlinio merged 3 commits into
mainfrom
feat/64-live-e2e
Sep 4, 2026
Merged

ElbertePlinio merged 3 commits into
mainfrom
feat/64-live-e2e

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Why

The Rust suite is hermetic: every existing test fakes the Flutter project, the
tools on PATH, and the MCP server. Nothing in CI has ever proven that
pickforge works against a real Flutter SDK, a real dart mcp-server, or a
project that flutter create actually produced. This adds that check as an
opt-in local test, so the hermetic suite stays fast and CI stays unchanged.

What

crates/pickforge-cli/tests/live_flutter.rs, one test gated on
PICKFORGE_LIVE_FLUTTER=1. Without the env var, or without flutter and
dart on PATH, it prints why and returns. It is Unix-only (#![cfg(unix)]).

When it runs it:

  • creates a real project with flutter create --offline --platforms=linux,
    falling back to a two-file minimal project only if that fails, and logs which
    path it took;
  • runs pickforge doctor --json and asserts ready, framework == "flutter",
    and that the reported state dir is inside the isolated PICKFORGE_HOME;
  • runs init --harness claude-code --harness codex --harness pi --mobile-integration-alpha --dry-run and asserts the plan writes nothing;
  • applies the same init and checks the generated Claude Code, Codex and Pi MCP
    entries, their per-harness arguments, and both managed skill files;
  • launches the configured dart mcp-server for real and completes an
    initialize plus tools/list handshake over stdio;
  • re-runs init and asserts changed == false with byte-identical files;
  • records evidence containing a planted secret and asserts the outputs land
    under PICKFORGE_HOME, never in the project, with the secret absent from
    both evidence.json and report.md and the copied screenshot hash intact;
  • audits the developer's real $HOME paths (.pickforge, .claude, .codex,
    .pi, config files, and the project's real state dir) before and after, and
    fails if any changed.

Everything runs in a TempDir with HOME, USERPROFILE, XDG_* and
PICKFORGE_HOME redirected. Child processes are spawned in their own process
group and killed on drop, and every step has a deadline under a 300s budget.

One detail worth flagging: the isolated HOME also moves the pub cache, so an
offline resolve would always miss and the fixture would silently degrade to the
minimal fallback. PUB_CACHE from the real environment is passed to
flutter create only, never to the CLI under test.

Also updates AGENTS.md and docs/releases/UNRELEASED.md.

How to run

PICKFORGE_LIVE_FLUTTER=1 cargo test -p pickforge-cli --test live_flutter -- --nocapture

How it was verified

Rebased onto origin/main at ea42c24 first. All commands run from the branch:

  • cargo fmt --all --check — clean.
  • cargo clippy --workspace --all-targets --locked -- -D warnings — clean
    (clippy 0.1.96).
  • cargo test --workspace --locked — 84 passed, 0 failed, 0 ignored.
  • PICKFORGE_LIVE_FLUTTER=1 cargo test -p pickforge-cli --test live_flutter -- --nocapture
    — 1 passed. It logged live Flutter fixture: flutter create --offline, so it
    used a real Flutter project, not the minimal fallback. Flutter 3.41.6
    stable, Dart from the same SDK, Linux.

Rebasing surfaced a real break: #78 made evidence record decode artifacts, and
the test's hand-written 1x1 PNG had a bad IDAT CRC, so the first live run failed
with could not decode image. The fixture now encodes a real PNG with the
image crate, matching tests/evidence.rs.

Not verified

  • macOS and Windows. The test is #![cfg(unix)]; nobody has run it off Linux.
  • CI. The gate is never set in CI, so this test does not run there and the CI
    job time is unchanged. It is a local, opt-in check by design.
  • The fallback branch. Since flutter create succeeded here, the minimal
    fixture path was never exercised.
  • Anything beyond tools/list on the MCP server: no tool is actually called,
    and no app is built, run or hot-reloaded.

Exercise the real doctor/init/evidence flow against a Flutter project
created by the local Flutter SDK, plus a live Dart MCP initialize and
tools/list handshake. The test asserts init is idempotent, evidence
stays outside the project with secrets redacted, and the real home is
never touched.

Gated on PICKFORGE_LIVE_FLUTTER=1 and skipped without flutter/dart on
PATH, so CI and the default suite stay hermetic.
@ElbertePlinio
ElbertePlinio merged commit 2e3c4ad into main Sep 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant