Skip to content

test(e2e): real-CLI e2e for data-layout migration (#374) and multi-project (#375) - #531

Merged
jeff-r2026 merged 1 commit into
mainfrom
feature/e2e-datalayout-multiproject
Sep 12, 2026
Merged

jeff-r2026 merged 1 commit into
mainfrom
feature/e2e-datalayout-multiproject

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

What

Adds the two missing real-command end-to-end tests for features that
previously had only function-level unit coverage:

No production code changes — tests only.

Why

Audit of #374/#375 coverage found: migration's "legacy → real pull →
partition" path was never asserted through the actual CLI, and the multi-project
user commands (projects set, pull --project isolation, push --project) had
zero real-CLI e2e. These two files close both gaps.

How it's tested (mechanism)

  • spawn('node', [dist/index.js, ...]) — runs the compiled binary, exactly
    like a user shell, not imported functions.
  • Sandbox HOME → partition (~/.teamai/projects/<slug>) is confined to a
    mkdtemp dir, torn down after; never touches the real ~/.teamai.
  • Local bare git remote (provider: git) → pull/push are real git ops
    with no network, no tokens, no PR creation. Hermetic; runs on fork PRs too.

Test Plan

Check Result
npx tsc --noEmit ✅ pass
npm run build ✅ pass
New e2e via real dist/index.js (vitest --config vitest.e2e.config.ts) ✅ 3/3 pass
Negative control: invert the "alpha is pruned" assertion ✅ fails as expected, then restored & green (proves assertions verify behavior, not a no-op)
Adjacent unit tests (migrate / projects / members / partition / pull-project-cleanup) ✅ 76/76 unaffected
$ npx vitest run --config vitest.e2e.config.ts \
    src/__tests__/e2e/data-layout-migration.test.ts \
    src/__tests__/e2e/multi-project.test.ts
 ✓ multi-project ... deploys only the active project's skills and prunes an inactivated project
 ✓ multi-project ... routes push --project into the project skills namespace on the remote
 ✓ data-layout ... migrates a legacy .teamai into the partition and pulls through it
 Test Files  2 passed (2)
      Tests  3 passed (3)

Notes

  • Both files live in src/__tests__/e2e/, so vitest.e2e.config.ts's include
    picks them up and CI's "Run E2E (full surface)" job runs them automatically.
  • macOS /tmp → /private/tmp symlink: the migration test realpathSyncs its
    sandbox so the slug it computes matches the CLI's (realpath-based) one.

…i-project (#375)

Cover the two gaps in real-command e2e:

- data-layout-migration.test.ts: seed a legacy <repo>/.teamai (real
  team-repo clone + plaintext env + localPath into legacy), run the
  compiled CLI 'pull --force', and assert the preAction hook migrated
  data into ~/.teamai/projects/<slug>/, kept the git clone intact,
  rebased repo.localPath onto the partition, retired the source to
  .teamai.bak, and pulled through the migrated clone.
- multi-project.test.ts: 'projects set' + 'pull --force' deploys only
  the active project's skills and prunes an inactivated one; 'push
  --project' routes a skill into the project's skills/<ns>/ on the
  remote, matching what pull reads.

Hermetic: sandbox HOME + local bare remote (provider: git), no network,
tokens, or PR creation. Land in src/__tests__/e2e/ so vitest.e2e.config
picks them up.
@jeff-r2026
jeff-r2026 merged commit a29e5ef into main Sep 12, 2026
7 checks passed
@jeff-r2026
jeff-r2026 deleted the feature/e2e-datalayout-multiproject branch September 12, 2026 06:09
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…nd multi-project (Tencent#375) (Tencent#531)

Cover the two gaps in real-command e2e:

- data-layout-migration.test.ts: seed a legacy <repo>/.teamai (real
  team-repo clone + plaintext env + localPath into legacy), run the
  compiled CLI 'pull --force', and assert the preAction hook migrated
  data into ~/.teamai/projects/<slug>/, kept the git clone intact,
  rebased repo.localPath onto the partition, retired the source to
  .teamai.bak, and pulled through the migrated clone.
- multi-project.test.ts: 'projects set' + 'pull --force' deploys only
  the active project's skills and prunes an inactivated one; 'push
  --project' routes a skill into the project's skills/<ns>/ on the
  remote, matching what pull reads.

Hermetic: sandbox HOME + local bare remote (provider: git), no network,
tokens, or PR creation. Land in src/__tests__/e2e/ so vitest.e2e.config
picks them up.
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