PR-time diff-based lint: when a PR adds a NEW commit-status emission, the workflow file must carry one of three directives adjacent to the new job: - `# bp-required: yes` AND the context is in BP - `# bp-required: pending #NNN` acknowledged asymmetry + tracker - `# bp-exempt: <reason>` informational job, not a gate Default (no directive on a new emitter) = FAIL with 3-option hint. The class this prevents ----------------------- PR#656 added `CI / all-required (pull_request)` as a sentinel context that workflows emit, but BP did NOT list it. When platform-build failed, all-required failed, but BP let the PR merge anyway → mc#664. Cousin to Tier 2f ----------------- Tier 2g blocks at PR-time (diff-based); Tier 2f files a drift issue at scheduled-time. They share enumeration helpers (workflow_contexts, event-map) but the semantics differ — Tier 2g is PR-time block, Tier 2f is scheduled audit + issue. Co-design documented in #350. Why the directive lives in the YAML, not the PR body ---------------------------------------------------- PR-body claim evaporates on merge; the directive must persist with the emitter so Tier 2f's daily audit reads the same contract. Implementation -------------- - `.gitea/scripts/lint_required_context_exists_in_bp.py` — git diff base..head, enumerate emitted contexts on each side via PyYAML AST (mirror Tier 2f), `new = head - base`. For each new context resolve back to (file, job-key), scan ±3 lines above the job-key line for a directive comment. Validate against BP context list when directive is `bp-required: yes`. Graceful-degrade 403/404 per Tier 2a. - `.gitea/workflows/lint-required-context-exists-in-bp.yml` — pull_request with paths-filter on .gitea/workflows/**. Phase 3 (continue-on-error: true). - `tests/test_lint_required_context_exists_in_bp.py` — 11 unit tests: no new emissions skip, bp-required:yes+in-BP pass, bp-required:yes not-in-BP fail, bp-required:pending pass, bp-exempt pass, no-directive fail, new-job-in-existing-workflow flagged, job-rename flagged, comment-only edit no-flag, 403 graceful, PR-body directive insufficient. Refs: #350
Tests
This repo uses the standard monorepo testing convention: unit tests live with their package, cross-component E2E tests live here.
Where to find tests
| Scope | Location |
|---|---|
| Go unit + integration (platform, CLI, handlers) | workspace-server/**/*_test.go — run with cd workspace-server && go test -race ./... |
| TypeScript unit (canvas components, hooks, store) | canvas/src/**/__tests__/ — run with cd canvas && npm test -- --run |
| TypeScript unit (MCP server handlers) | mcp-server/src/__tests__/ — run with cd mcp-server && npx jest |
| Python unit (workspace runtime, adapters) | workspace/tests/ — run with cd workspace && python3 -m pytest |
| Python unit (SDK: plugin + remote agent) | sdk/python/tests/ — run with cd sdk/python && python3 -m pytest |
| Cross-component E2E (spans platform + runtime + HTTP) | tests/e2e/ ← you are here |
Why split this way
- Go requires co-located
_test.gofiles to access unexported symbols. - Per-package test commands keep the inner loop fast — changing canvas doesn't re-run Go tests.
tests/e2e/covers scenarios that no single package owns: a full workspace lifecycle, A2A across two provisioned agents, delegation chains, bundle round-trips.
Running E2E
Every E2E script here assumes the platform is running at localhost:8080 and (where noted) provisioned agents are online. See the header comment of each .sh for specifics.
Cleaning up rogue test workspaces
If an E2E run aborts before its teardown runs (Ctrl-C, crash, CI timeout),
the platform can be left with workspaces whose config volume is stale or
empty — Docker's unless-stopped restart policy then spins those
containers in a FileNotFoundError loop. The platform's pre-flight check
(#17) marks such workspaces failed on the next restart, but a manual
cleanup is useful:
bash scripts/cleanup-rogue-workspaces.sh # deletes ws with id/name starting aaaaaaaa-, bbbbbbbb-, cccccccc-, test-ws-
MOLECULE_URL=http://host:8080 bash scripts/cleanup-rogue-workspaces.sh
The script DELETEs each matching workspace via the API and
force-removes the ws-<id[:12]> container as a belt-and-suspenders
fallback.