Skip to content

feat: aimock scaffold generator + helper consolidation (Task #15)#472

Merged
blove merged 3 commits into
mainfrom
claude/aimock-scaffold-gen
May 19, 2026
Merged

feat: aimock scaffold generator + helper consolidation (Task #15)#472
blove merged 3 commits into
mainfrom
claude/aimock-scaffold-gen

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 19, 2026

Summary

  • Adds `scripts/generate-aimock-scaffold.ts` — single-cap throwaway generator. `npx tsx scripts/generate-aimock-scaffold.ts --cap ` reads the registry, emits 5 e2e/ files, adds the e2e Nx target to `project.json`, and appends a matrix entry to `.github/workflows/ci.yml`.
  • Consolidates the duplicate submit-and-wait helpers in `libs/e2e-harness/src/`. Migrates 3 cap specs (`streaming`, `c-tool-calls`, `c-subagents`) from `sendPromptAndWait` to `submitAndWaitForResponse`. Removes `sendPromptAndWait` from the harness.
  • All-or-nothing generator semantics: validates every precondition (missing cap, no pythonDir, pre-existing files, pre-existing project.json target, pre-existing ci.yml matrix entry) before writing.

Wins

  • Task feat: autogenerated API reference from JSDoc #4 batching becomes: `generator --cap c-input` → fixture + spec assertions → commit. No copy-paste from c-interrupts each time.
  • One canonical submit-and-wait helper in the harness instead of two leaky-vs-durable variants.

Files

  • New: `scripts/generate-aimock-scaffold.ts`.
  • Modified: 3 cap specs (find/replace import + call), 2 harness files (delete `sendPromptAndWait` + `SendPromptAndWaitOptions`), 1 harness README (drop stale refs).

Test plan

  • CI `Cockpit — e2e` matrix passes (4 expansions) — migrated specs still pass.
  • CI `Cockpit — build / test` passes.
  • `git grep 'sendPromptAndWait\b' cockpit libs` returns nothing.
  • Manual proof completed locally: `npx tsx scripts/generate-aimock-scaffold.ts --cap c-messages` wrote the expected files; second run refused; revert clean.

Follow-ups (out of scope)

🤖 Generated with Claude Code

blove and others added 3 commits May 19, 2026 12:29
Task #15 in the pre-batching cleanup arc. Single-cap throwaway
generator (scripts/generate-aimock-scaffold.ts) reads the registry
and emits e2e/ files + project.json edit + ci.yml matrix entry. Also
consolidates the duplicate submit-and-wait helpers in libs/e2e-harness/
— migrate 3 cockpit cap specs to submitAndWaitForResponse and remove
sendPromptAndWait. After this PR, Task #4 batching becomes mechanical.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7-task plan: migrate 3 specs, delete sendPromptAndWait from harness +
barrel, create generator script, verify via c-messages generation +
revert, commit/push/PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ships scripts/generate-aimock-scaffold.ts — a single-cap throwaway
generator that reads apps/cockpit/scripts/capability-registry.ts and
emits a cap's e2e/ directory (5 files) plus the project.json e2e
target plus a ci.yml matrix entry. Validates all preconditions before
writing; refuses on any pre-existing target. Unblocks Task #4 batch.

Consolidates the duplicate submit-and-wait helpers:
- Migrate streaming.spec.ts, c-tool-calls.spec.ts, c-subagents.spec.ts
  from sendPromptAndWait → submitAndWaitForResponse (mechanical swap;
  semantically equivalent for composed-<chat> caps).
- Remove sendPromptAndWait + SendPromptAndWaitOptions from
  libs/e2e-harness/src/{test-helpers,index}.ts.
- Keep sendPromptAndWaitForInterrupt + clickInterruptActionAndWaitFinal
  (interrupt-flow specific; c-interrupts depends on them).
- Update libs/e2e-harness/README.md to drop stale references.

After this PR, batching the 7 chat caps in Task #4 is mechanical:
run the generator per cap → hand-author fixture + spec assertions.

Note: examples/chat/angular/e2e/test-helpers.ts has its own local
sendPromptAndWait — left untouched (separate ownership boundary;
follow-up task if consolidation desired).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment May 19, 2026 7:52pm

Request Review

@blove blove merged commit 5c7724a into main May 19, 2026
22 checks passed
blove added a commit that referenced this pull request May 21, 2026
…egy (#499)

The spec imported `SendPromptAndWaitOptions` which was removed in PR #472
(harness helper consolidation), leaving a tsc error in the lint target
that has been silently failing the Library — lint gate. The chat-sidenav-
scrim no-output-native noise (resolved by #485) was masking it; subsequent
admin-merges let it through.

Two-part fix:

1. Delete the spec. Its original purpose ("locks in the type contract")
   was already covered by tsc itself; the deleted type meant the spec
   was just verifying a removed API.

2. Document the testing strategy in a header block on test-helpers.ts
   so future contributors know the absence of unit tests is intentional:
   - The 3 Playwright-dependent helpers are exercised end-to-end by the
     24 cockpit cap aimock e2es in the matrix.
   - `startAimock` (the only helper testable without a Page) has its own
     aimock-runner.spec.ts in the same directory.

Identified during the post-Task-#4 e2e audit (item #8).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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