test(parity): add api smoke assertions

This commit is contained in:
2026-06-05 14:22:28 +08:00
parent f5b3279a82
commit 7e920699ac
4 changed files with 284 additions and 42 deletions
+31 -5
View File
@@ -17,9 +17,9 @@ Build GoChat as a Go backend that can directly reuse the frontend from `referenc
## Current Baseline
- Plan freeze checkpoint: 2026-06-05 docs-only tracker landing after `13cb750 feat(captain): align task payload persistence`.
- Latest implementation checkpoint: this checkpoint, prepared as `test(parity): add frontend smoke harness`.
- Latest implementation checkpoint: this checkpoint, prepared as `test(parity): add api smoke assertions`.
- Latest documentation checkpoint before this freeze: `3263ed9 docs: land copilot task execution plan`; this document now carries the active follow-up plan directly.
- Worktree status at this implementation checkpoint: B11.1a aligns Captain assistant CRUD/tools/inbox bindings; B11.1b aligns Captain scenarios and custom tools; B11.1c aligns Captain documents, assistant responses, bulk actions, and custom-tool test payloads; B11.2 aligns Copilot thread/message create/list/get/delete payloads, account/user scoping, and no-LLM fallback persistence; B11.3a aligns Captain preferences show/update payloads and account-level model/feature storage; B11.3b aligns Captain playground request/response payloads, account scoping, v2 history handling, and no-LLM fallback; B11.3c adds the fakeable Captain document sync backend gate with disabled, failed, and fake-success states; B11.3d aligns Captain task request/response payloads, no-provider disabled states, follow-up context, suggestion persistence, and Copilot message tool-call key validation; B11.3e aligns Captain stream DTOs/disabled SSE fallbacks and Copilot push-event payload shapes; B12.1 adds the reusable GoChat server/seed entrypoint plus a Meilisearch-first reused Chatwoot frontend smoke harness and report. Next active implementation slice is B12.2 browser/API path assertions.
- Worktree status at this implementation checkpoint: B11.1a aligns Captain assistant CRUD/tools/inbox bindings; B11.1b aligns Captain scenarios and custom tools; B11.1c aligns Captain documents, assistant responses, bulk actions, and custom-tool test payloads; B11.2 aligns Copilot thread/message create/list/get/delete payloads, account/user scoping, and no-LLM fallback persistence; B11.3a aligns Captain preferences show/update payloads and account-level model/feature storage; B11.3b aligns Captain playground request/response payloads, account scoping, v2 history handling, and no-LLM fallback; B11.3c adds the fakeable Captain document sync backend gate with disabled, failed, and fake-success states; B11.3d aligns Captain task request/response payloads, no-provider disabled states, follow-up context, suggestion persistence, and Copilot message tool-call key validation; B11.3e aligns Captain stream DTOs/disabled SSE fallbacks and Copilot push-event payload shapes; B12.1 adds the reusable GoChat server/seed entrypoint plus a Meilisearch-first reused Chatwoot frontend smoke harness and report; B12.2a adds API smoke assertions for auth/profile, inbox, conversation/messages, contact/company, widget config/message, and public CSAT. Next active implementation slice is B12.2b live browser navigation against the reused frontend.
- `go test ./...` passes.
- Route dump succeeds with `TOTAL: 830` after adding the Chatwoot-compatible applied-SLA index route.
- Route parity artifacts now exist under `docs/parity/` and are generated by `cmd/route_parity`.
@@ -80,7 +80,7 @@ Open work after the current checkpoint:
| Phase 4 | Enterprise feature completion | Doing | B7, B8, B9, B10, and B11 are in Review; B12 reused frontend smoke is the next broad verification gate |
| Phase 5 | Background jobs and integrations | Planned | durable worker choice and job parity are open |
| Phase 6 | Core placeholder burn-down | Doing | account/contact/conversation/message/inbox placeholder groups remain broad |
| Phase 7 | Verification harness | Doing | B12.1 boot/readiness harness exists; browser/API assertions and optional live Meilisearch run remain open |
| Phase 7 | Verification harness | Doing | B12.1 boot/readiness and B12.2a API assertions exist; live browser navigation and optional live Meilisearch run remain open |
## Tracking Artifacts
@@ -101,6 +101,7 @@ This ledger records the committed parity checkpoints that future slices should b
| Commit | Scope | Verification summary | Follow-up state |
| --- | --- | --- | --- |
| `test(parity): add api smoke assertions` | Advances B12.2 with a repeatable `scripts/parity_frontend_smoke.sh --api-smoke` path that seeds deterministic frontend data, signs in through Chatwoot auth headers, asserts current-user/profile, inbox list, conversation/message list and create, contact/company show, widget config/message, and public CSAT show. The seed now includes company, conversation display ID, and CSAT message IDs for smoke assertions. | `bash -n scripts/parity_frontend_smoke.sh`; `scripts/parity_frontend_smoke.sh --print`; `scripts/parity_frontend_smoke.sh --check`; `go test ./cmd/gochat -count=1`; full verification recorded in the B12.2a section. Live API smoke requires a running DB/backend and is not run in default check mode. | Continue B12.2b with live browser navigation/assertions against the reused Vite frontend; B12.3 enterprise screen smoke remains open. |
| `test(parity): add frontend smoke harness` | Completes B12.1 readiness tooling: adds `cmd/gochat` as the reusable server/seed entrypoint, adds `scripts/parity_frontend_smoke.sh` to print/check/boot GoChat plus the reused `reference/chatwoot` Vite frontend, keeps the boot command Meilisearch-first, and writes `docs/parity/frontend_smoke_report.md` with seed credentials, command lines, logs, and the smoke matrix. | `bash -n scripts/parity_frontend_smoke.sh`; `scripts/parity_frontend_smoke.sh --print`; `scripts/parity_frontend_smoke.sh --check`; `go test ./cmd/gochat -count=1`; full verification recorded in the B12.1 section. | Continue B12.2 with browser/API assertions for auth, inbox, conversation, CRM, widget, CSAT, and enterprise screens. |
| `feat(captain): align streaming fallbacks` | Completed B11.3e streaming/realtime compatibility: Captain task stream routes now reuse non-stream request DTOs, resolve conversations by account-scoped display ID or legacy ID, guard missing LLM providers with deterministic SSE `error`/`done` events, validate rewrite operations, and keep stream errors frontend-readable. Copilot message nested thread payloads now use Chatwoot `push_event_data` shape and event payload helpers omit REST-only fields. | Focused CaptainTask/Captain/Copilot handler and service tests passed; Copilot/Captain repository tests passed; full verification recorded below. | B11 moves to Review; start B12 reused frontend smoke. |
| `docs: land parity tracker handoff` | Froze the active tracker after B11.3d, copied the remaining Hermes-derived work into explicit B11.3e/B12/Phase 5/Phase 6 tracking rows, and clarified the commit/update rules for future checkpoints. | Documentation-only checkpoint; `git diff --check` is sufficient. | Start B11.3e streaming/realtime compatibility. |
@@ -453,7 +454,7 @@ Upcoming enterprise task boards:
| B11 | B11.2 | Align Copilot threads, messages, tasks, preferences, playground/tool-call behavior, and disabled-state feature gates. | Copilot controllers/services/frontend clients under `reference/chatwoot`. | Copilot handler/service tests for persistence, disabled LLM state, and frontend payloads. | Review; thread/message payloads, account/user scoping, assistant scope, and no-LLM fallback are landed; tasks/preferences/tool-call/playground depth remains in B11.3 follow-up |
| B11 | B11.3 | Add document sync/embedding/LLM job boundaries where external dependencies are required and finish remaining Copilot task/preference/tool-call/streaming depth. | Captain/Copilot jobs, document services, Copilot controllers/services/frontend clients. | Worker tests or explicit feature-gated fallback tests plus Copilot task/preference/tool-call fixtures. | Doing; B11.3a Captain preferences show/update payloads are landed, while document sync/indexing and remaining Copilot task/tool-call depth remain active |
| B12 | B12.1 | Add a repeatable command to run the reused Chatwoot frontend against GoChat. | `reference/chatwoot` frontend boot/auth/API clients. | Smoke command documented and runnable locally. | Done by `test(parity): add frontend smoke harness` |
| B12 | B12.2 | Cover login, inbox list/settings, conversation list/detail/message send, contact/company views, widget init/message, public CSAT, SLA/CSAT reports, and enterprise admin screens. | Dashboard route usage and frontend stores/API modules. | Smoke report checked into `docs/parity/` with pass/fail gaps. | Todo; next active slice |
| B12 | B12.2 | Cover login, inbox list/settings, conversation list/detail/message send, contact/company views, widget init/message, public CSAT, SLA/CSAT reports, and enterprise admin screens. | Dashboard route usage and frontend stores/API modules. | Smoke report checked into `docs/parity/` with pass/fail gaps. | Doing; B12.2a API assertion command landed, B12.2b browser navigation pending |
B8 CSAT execution breakdown:
@@ -1008,7 +1009,7 @@ B12 reused frontend verification breakdown:
| Step | Implementation target | Reference source | Required tests | Status |
| --- | --- | --- | --- | --- |
| B12.1 | Add a repeatable smoke command that boots GoChat plus the reused `reference/chatwoot` frontend without adapters. | Local app boot scripts, Chatwoot dashboard frontend. | Checked command and gap report under `docs/parity/`. | Done by `scripts/parity_frontend_smoke.sh`, `cmd/gochat seed`, and `docs/parity/frontend_smoke_report.md` |
| B12.2 | Cover login, current user, inbox list, conversation list/detail, message send, contact/company view, and widget init/message. | Dashboard/widget frontend routes and API clients. | Smoke output records pass/fail and links failed API calls to route/serializer tasks. | Todo; next active slice |
| B12.2 | Cover login, current user, inbox list, conversation list/detail, message send, contact/company view, widget init/message, and public CSAT. | Dashboard/widget frontend routes and API clients. | Smoke output records pass/fail and links failed API calls to route/serializer tasks. | Doing; B12.2a API smoke command landed, B12.2b reused-frontend browser navigation pending |
| B12.3 | Add enterprise smoke coverage as B8-B11 land: SLA reports, CSAT public/account reports, automation/macros, audit/custom roles, Captain/Copilot. | Enterprise frontend screens and clients. | Smoke output keeps enterprise failures as named follow-up tasks, not hidden browser-only debt. | Todo |
B12 smoke harness contract:
@@ -1040,6 +1041,30 @@ env TMPDIR=/home/rogee/Projects/gochat/.tmp/test-tmp GOCACHE=/tmp/gochat-gocache
git diff --check
```
B12.2a current checkpoint:
- `scripts/parity_frontend_smoke.sh --api-smoke` now runs against a live GoChat backend. It seeds deterministic data, logs in with `/auth/sign_in`, captures DeviseTokenAuth-compatible headers, and exercises the frontend-critical API paths without frontend adapters.
- Covered API assertions: `/auth/validate_token`, `/api/v1/profile`, inbox list, conversation list/messages/message create, contact show, company show, widget config, widget message create, and public CSAT show.
- `cmd/gochat seed` now emits `company_id`, `conversation_display_id`, and `csat_message_id`; it also creates a deterministic company relation and an `input_csat` message so B12 API smoke can verify CRM and public CSAT surfaces.
- This is still not a browser-navigation pass. B12.2b must drive the reused Vite frontend and capture failed API calls or UI blockers in the report; B12.3 must add enterprise screens.
B12.2a verification:
```bash
bash -n scripts/parity_frontend_smoke.sh
scripts/parity_frontend_smoke.sh --print
scripts/parity_frontend_smoke.sh --check
env GOCACHE=/tmp/gochat-gocache GOMODCACHE=/tmp/gochat-gomodcache go test ./cmd/gochat -count=1
env TMPDIR=/home/rogee/Projects/gochat/.tmp/test-tmp GOCACHE=/tmp/gochat-gocache GOMODCACHE=/tmp/gochat-gomodcache go test ./...
git diff --check
```
Optional live API smoke, when PostgreSQL/Redis/Meilisearch and GoChat are running:
```bash
scripts/parity_frontend_smoke.sh --api-smoke
```
Hermes plan material now mapped:
- `.hermes/plans/2025-05-24-global-search-meilisearch.md` maps to Phase 1/B6. The Meilisearch interface, config, documents, indexing hooks, reindex command, payload shape, and live gate are already tracked here. Remaining search work is only future payload gaps discovered by frontend smoke or route expansion.
@@ -1685,3 +1710,4 @@ Verification milestone gates:
- 2026-06-05: Parity tracker handoff checkpoint prepared as `docs: land parity tracker handoff`; the plan now has a front-loaded handoff contract, explicit open-work table for B11.3e/B12/Phase 5/Phase 2/3/Phase 6, exact Hermes source-plan mapping, and a rule that every future checkpoint updates this tracker before commit. Documentation-only checkpoint; `git diff --check` passed.
- 2026-06-05: B11.3e streaming/realtime checkpoint prepared as `feat(captain): align streaming fallbacks`; Captain stream task routes now share non-stream DTO/account-scope behavior, return deterministic SSE disabled/error states for missing providers and validation errors, and preserve success chunk/done shapes. Copilot message REST payloads now nest thread `push_event_data`, dedicated push payload helpers match Chatwoot event data, and the legacy Copilot SSE route has a no-provider disabled guard. Focused CaptainTask/Captain/Copilot handler/service tests and Copilot/Captain repository tests passed; full verification is recorded in the B11.3e section. B11 moves to Review; next active slice is B12 reused Chatwoot frontend smoke.
- 2026-06-05: B12.1 frontend smoke harness checkpoint prepared as `test(parity): add frontend smoke harness`; `cmd/gochat` now provides `serve` and deterministic `seed`, `.gitignore` no longer hides `cmd/gochat`, `scripts/parity_frontend_smoke.sh` can print/check/boot GoChat plus the reused `reference/chatwoot` Vite frontend with Meilisearch-first defaults, and `docs/parity/frontend_smoke_report.md` records commands, seed data, logs, and pending smoke matrix owners. Verification: `bash -n scripts/parity_frontend_smoke.sh`, `scripts/parity_frontend_smoke.sh --print`, `scripts/parity_frontend_smoke.sh --check`, `go test ./cmd/gochat -count=1`, full `go test ./...`, and `git diff --check`. Next slice is B12.2 browser/API path assertions.
- 2026-06-05: B12.2a API smoke assertion checkpoint prepared as `test(parity): add api smoke assertions`; the smoke script now has `--api-smoke` for live GoChat API checks covering auth/profile, inbox, conversation/message list and create, contact/company show, widget config/message, and public CSAT show. Seed output now includes company, conversation display ID, and CSAT message identifiers. Default verification keeps `--api-smoke` optional because it needs a running backend/DB; `bash -n`, `--print`, `--check`, `go test ./cmd/gochat`, full `go test ./...`, and `git diff --check` passed locally. Next slice is B12.2b reused-frontend browser navigation.
+8 -2
View File
@@ -1,6 +1,6 @@
# Frontend Smoke Report
Updated: 2026-06-05T06:08:51Z
Updated: 2026-06-05T06:19:13Z
## Status
@@ -12,6 +12,12 @@ Harness readiness check passed; live frontend smoke not run in this mode.
scripts/parity_frontend_smoke.sh --boot-only
```
## API Smoke Command
```bash
scripts/parity_frontend_smoke.sh --api-smoke
```
## Backend
- URL: http://127.0.0.1:3000
@@ -36,7 +42,7 @@ GOCHAT_SEED_INBOX_NAME="B12 Smoke Website Inbox" \
go run ./cmd/gochat seed
```
The seed command creates deterministic login/account/inbox/contact/conversation data plus SLA, CustomRole, AgentCapacity, and Captain fixtures for the smoke paths.
The seed command creates deterministic login/account/inbox/contact/company/conversation data plus CSAT, SLA, CustomRole, AgentCapacity, and Captain fixtures for the smoke paths.
## Smoke Matrix