diff --git a/cmd/route_parity/main.go b/cmd/route_parity/main.go index 5b1d279a..607a5f8c 100644 --- a/cmd/route_parity/main.go +++ b/cmd/route_parity/main.go @@ -231,6 +231,7 @@ var criticalRoutes = []route{ {Method: "GET", Path: "/api/v1/accounts/:account_id/teams/", Controller: "api/v1/accounts/teams#index", Source: "routes.rb:296"}, {Method: "POST", Path: "/api/v1/accounts/:account_id/teams/", Controller: "api/v1/accounts/teams#create", Source: "routes.rb:296"}, {Method: "GET", Path: "/api/v1/accounts/:account_id/teams/:team_id", Controller: "api/v1/accounts/teams#show", Source: "routes.rb:296"}, + {Method: "PATCH", Path: "/api/v1/accounts/:account_id/teams/:team_id", Controller: "api/v1/accounts/teams#update", Source: "routes.rb:296"}, {Method: "PUT", Path: "/api/v1/accounts/:account_id/teams/:team_id", Controller: "api/v1/accounts/teams#update", Source: "routes.rb:296"}, {Method: "DELETE", Path: "/api/v1/accounts/:account_id/teams/:team_id", Controller: "api/v1/accounts/teams#destroy", Source: "routes.rb:296"}, {Method: "GET", Path: "/api/v1/accounts/:account_id/teams/:team_id/team_members/", Controller: "api/v1/accounts/teams/team_members#index", Source: "routes.rb:297"}, diff --git a/docs/CHATWOOT_PARITY_DEVELOPMENT_PLAN.md b/docs/CHATWOOT_PARITY_DEVELOPMENT_PLAN.md index 7953708b..08f62722 100644 --- a/docs/CHATWOOT_PARITY_DEVELOPMENT_PLAN.md +++ b/docs/CHATWOOT_PARITY_DEVELOPMENT_PLAN.md @@ -49,15 +49,15 @@ Hermes task landing checklist: ## Current Baseline -- Current tracking checkpoint: 2026-06-06 notification subscriptions implementation checkpoint, prepared as `feat(notifications): align subscription payloads`. -- Latest implementation checkpoint: this checkpoint, prepared as `feat(notifications): align subscription payloads`. +- Current tracking checkpoint: 2026-06-06 teams frontend route checkpoint, prepared as `feat(teams): align frontend update routes`. +- Latest implementation checkpoint: this checkpoint, prepared as `feat(teams): align frontend update routes`. - Latest documentation/tooling checkpoint: this tracker landing update plus `e8d08bb docs: track canned response parity`; this document is the active follow-up plan and supersedes `.hermes/plans/*`. - Plan landing status: complete for the current known Hermes plans and user-confirmed scope. Future work should update this file directly instead of opening a parallel tracker. -- Worktree status at this implementation checkpoint: notification subscriptions from `reference/chatwoot/config/routes.rb:440` are implemented for the reused dashboard push helper. `POST/DELETE /api/v1/notification_subscriptions` now track the Rails singular resource route shape, accept raw frontend bodies plus Rails-style wrappers, derive identifiers from browser push endpoints or FCM device/push tokens, return raw subscription objects, and make destroy an empty `200 OK` no-op when no matching subscription exists. Live API/browser/enterprise smoke still needs the full PostgreSQL/Redis/Meilisearch/GoChat/Vite/Chrome stack. +- Worktree status at this implementation checkpoint: teams from `reference/chatwoot/config/routes.rb:296-300` and reused dashboard `api/teams.js` are implemented for the frontend route shape. `PATCH /api/v1/accounts/:account_id/teams/:team_id` now reaches the normal update action used by `TeamsAPI.update`, and no-trailing-slash aliases are registered for frontend team index/create plus team member list/create/update/delete calls. Live API/browser/enterprise smoke still needs the full PostgreSQL/Redis/Meilisearch/GoChat/Vite/Chrome stack. - `go test ./...` passes. -- Route dump succeeds with `TOTAL: 912` after adding the notification subscription singular `DELETE` route plus the existing compatibility aliases. +- Route dump succeeds with `TOTAL: 919` after adding frontend teams/team-members aliases and `PATCH` team update. - Route parity artifacts now exist under `docs/parity/` and are generated by `cmd/route_parity`. -- Tracked frontend-critical route audit covers 373 Chatwoot routes: 360 exact, 0 method-compatible, 13 parameter-compatible, 0 missing. The 13 parameter-compatible routes are Gin-internal parameter-name differences for nested AgentCapacityPolicy users/inbox limits, dashboard app member `:id` names, plus the public article `.md`/`.png` suffixes served through the same external article route dispatcher. +- Tracked frontend-critical route audit covers 374 Chatwoot routes: 361 exact, 0 method-compatible, 13 parameter-compatible, 0 missing. The 13 parameter-compatible routes are Gin-internal parameter-name differences for nested AgentCapacityPolicy users/inbox limits, dashboard app member `:id` names, plus the public article `.md`/`.png` suffixes served through the same external article route dispatcher. - `/api/v1/widget` stubs are burned down and public inbox/contact/conversation/message core flows are backed by real handlers. - Handler test stability fixes are committed into the baseline before feature parity work continues. - `.codegraph/` is generated indexing output and is not part of tracked product code. @@ -140,7 +140,7 @@ This table is the shortest authoritative handoff view. If an older lower section | Priority | Workstream | Current state | Next checkpoint | Commit close rule | | --- | --- | --- | --- | --- | | 1 | P3.2a invitation/confirmation mail parity | Implemented for current non-SSO reference behavior: profile resend is no longer a TODO-only log, new invited agents and unconfirmed invited profile resends generate reset-password invitation links, normal unconfirmed profile resends generate confirmation links, `users.unconfirmed_email` is modeled for email-update routing, and fakeable/environment SMTP mailers keep default tests offline. | Keep in Review; reopen only if reused frontend smoke or fresh reference evidence exposes additional Devise confirmation states outside excluded SSO/SAML/LDAP/OIDC variants. | Focused profile and agent invitation tests, combined handler/service/repository/router/migrate/app tests, full `go test ./...`, and `git diff --check` passed. | -| 2 | Phase 2/3 drift | Tracked route parity is 0 missing for the current 371-route critical set; dashboard `/app` shell routes from `routes.rb:19-20`, `.well-known` app association and custom-domain challenge routes from `routes.rb:657-660`, Twilio callback routes from `routes.rb:639-640`, enterprise Twilio voice routes from `routes.rb:643-646`, root Linear/Shopify/Notion OAuth callback routes from `routes.rb:630/634/654`, root Twitter/Google/Microsoft/Instagram/TikTok callback routes from `routes.rb:626/649-652`, assignment policy routes from `routes.rb:306-313`, help-center portal/category/article routes from `routes.rb:385-404`, public help-center portal/sitemap/article/category/search/article-detail routes from `routes.rb:590-601`, enterprise contact outbound voice call from `routes.rb:216`, account agent-bot routes from `routes.rb:94-97`, account webhook routes from `routes.rb:342`, account integration app/hook routes from `routes.rb:345-348`, account Dyte routes from `routes.rb:357-358`, dashboard app routes from `routes.rb:130`, and canned response routes from `routes.rb:114` are now explicitly tracked. Notification list/action serializers, user notification-settings raw payloads, campaigns raw payload/display-id routes, Devise password reset/confirmation payloads, CRM shared attachment payloads plus fixed 100-row attachment pagination, account/settings payloads, assignable-agent payloads, agent index full-list behavior, agent create/update/delete defaults/errors/scope, account agent-bot route/payload/mutation behavior, account webhook payload/mutation behavior, integration app/hook payload behavior, account Dyte create/join payload behavior, dashboard app raw payload/serializer behavior, canned response raw payload/search/delete behavior, label CRUD payloads, custom filters, custom attribute definitions, contact outbound voice calls, assignment policy CRUD and inbox binding payloads, Twilio inbound/status callbacks, enterprise Twilio voice callbacks, Linear/Shopify/Notion root integration callbacks, Shopify OAuth auth redirects, root channel OAuth callbacks, help-center portal/category/article payloads, dashboard app shell route behavior, app association JSON payloads, Cloudflare custom hostname verification, public widget popular-article lists, public help-center category list/show payloads, public portal show/default-locale payloads, public portal search payloads, public article show/markdown/tracking routes, and public sitemap XML now match the inspected Chatwoot contract. | Continue the next evidence-backed route/controller/serializer drift after canned response parity or from B12 findings. | Regenerate parity artifacts when routes change and add endpoint-family fixture tests. | +| 2 | Phase 2/3 drift | Tracked route parity is 0 missing for the current 374-route critical set; dashboard `/app` shell routes from `routes.rb:19-20`, `.well-known` app association and custom-domain challenge routes from `routes.rb:657-660`, Twilio callback routes from `routes.rb:639-640`, enterprise Twilio voice routes from `routes.rb:643-646`, root Linear/Shopify/Notion OAuth callback routes from `routes.rb:630/634/654`, root Twitter/Google/Microsoft/Instagram/TikTok callback routes from `routes.rb:626/649-652`, assignment policy routes from `routes.rb:306-313`, help-center portal/category/article routes from `routes.rb:385-404`, public help-center portal/sitemap/article/category/search/article-detail routes from `routes.rb:590-601`, enterprise contact outbound voice call from `routes.rb:216`, account agent-bot routes from `routes.rb:94-97`, account webhook routes from `routes.rb:342`, account integration app/hook routes from `routes.rb:345-348`, account Dyte routes from `routes.rb:357-358`, dashboard app routes from `routes.rb:130`, canned response routes from `routes.rb:114`, notification subscription routes from `routes.rb:440`, and team/team-member routes from `routes.rb:296-300` are now explicitly tracked. Notification list/action serializers, user notification-settings raw payloads, campaigns raw payload/display-id routes, Devise password reset/confirmation payloads, CRM shared attachment payloads plus fixed 100-row attachment pagination, account/settings payloads, assignable-agent payloads, agent index full-list behavior, agent create/update/delete defaults/errors/scope, account agent-bot route/payload/mutation behavior, account webhook payload/mutation behavior, integration app/hook payload behavior, account Dyte create/join payload behavior, dashboard app raw payload/serializer behavior, canned response raw payload/search/delete behavior, notification subscription payload behavior, team update/frontend route behavior, label CRUD payloads, custom filters, custom attribute definitions, contact outbound voice calls, assignment policy CRUD and inbox binding payloads, Twilio inbound/status callbacks, enterprise Twilio voice callbacks, Linear/Shopify/Notion root integration callbacks, Shopify OAuth auth redirects, root channel OAuth callbacks, help-center portal/category/article payloads, dashboard app shell route behavior, app association JSON payloads, Cloudflare custom hostname verification, public widget popular-article lists, public help-center category list/show payloads, public portal show/default-locale payloads, public portal search payloads, public article show/markdown/tracking routes, and public sitemap XML now match the inspected Chatwoot contract. | Continue the next evidence-backed route/controller/serializer drift after teams route parity or from B12 findings. | Regenerate parity artifacts when routes change and add endpoint-family fixture tests. | | 3 | Phase 6 placeholder audit | Widget/public/webhook critical placeholders are burned down; inbox WhatsApp health/register-webhook and sync-template drift are closed; refreshed `docs/parity/placeholder_audit.md` shows only webhook nil-handler fallbacks still call `chatwootParityStub`; dashboard conversation transcript/custom-attribute response drift and message retry status drift are closed. | Keep in Review; reopen only if fresh `rg`, route smoke, or B12 finds a frontend-reachable placeholder/stub in account/contact/conversation/message/inbox/widget/public paths. | `rg` placeholder audit and `scripts/parity_frontend_smoke.sh --check` are recorded; no reused-frontend blocker is ownerless. | | 4 | P3.9 account agent-bot API | Implemented for the reused dashboard AgentBots settings route with no-trailing-slash routes, PATCH update, raw Jbuilder-style payloads, account mutation scope, system-bot show/list visibility, empty `200 OK` delete, and full reset/avatar action payloads. | Keep in Review; reopen only if live settings smoke exposes avatar upload storage or administrator-secret gating drift. | Focused AgentBot handler tests, service/router focused tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | | 5 | P3.10 account webhooks API | Implemented for the reused dashboard Webhooks settings route with PATCH update, Chatwoot `{ payload }` list/mutation serializers, nested `{ webhook: ... }` bodies, generated secret, account-scoped mutations, URL/subscription validation, optional inbox serialization, and empty `200 OK` delete. | Keep in Review; reopen only if live settings smoke exposes audit writer or delivery-signature drift beyond the existing delivery service boundary. | Focused webhook handler/service/router tests, migration test, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | @@ -149,10 +149,11 @@ This table is the shortest authoritative handoff view. If an older lower section | 8 | P3.13 dashboard apps API | Implemented for the reused dashboard integration settings route: dashboard app CRUD routes are tracked, raw frontend bodies and Rails-style wrappers are accepted, list/show/create/update return the Chatwoot dashboard-app partial fields only, show/update/delete are account-scoped, content validation requires at least one `{ type: "frame", url: "http(s)://..." }`, and delete returns `204`. | Keep in Review; reopen if live settings smoke exposes error-body wording or iframe content validation drift beyond the current reference schema. | Focused dashboard app handler/service tests, combined handler/service/repository/router/route-parity tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | | 9 | P3.14 canned responses API | Implemented for the reused dashboard canned-response settings flow: raw frontend bodies and Rails-style wrappers are accepted, no-trailing-slash frontend aliases and `PATCH` update are registered, list/search return raw arrays, create/update/show return raw Chatwoot fields, search uses `search=` and Chatwoot ranking, update/delete are account-scoped, and delete returns empty `200 OK`. | Keep in Review; reopen only if live settings smoke exposes validation/error wording or non-frontend compatibility alias drift beyond the current reference contract. | Focused canned handler/service tests, combined handler/canned/router/route-parity tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | | 10 | P3.15 notification subscriptions API | Implemented for the reused dashboard push helper: user-scoped singular `POST/DELETE /api/v1/notification_subscriptions` is tracked, raw frontend bodies plus `{ notification_subscription: ... }` wrappers are accepted, browser push identifiers derive from `subscription_attributes.endpoint`, FCM identifiers derive from `device_id`/`push_token`, existing identifiers move/update to the current user, create returns raw Chatwoot subscription JSON with string `subscription_type`, and destroy returns empty `200 OK` whether or not a matching `push_token` exists. | Keep in Review; reopen only if live browser push smoke exposes service-worker registration or mobile FCM attribute drift beyond the current reference builder/controller contract. | Focused notification subscription handler tests, service/repository/router/route-parity tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | -| 11 | P6.8 contact outbound voice call | Implemented for the reused dashboard route with Twilio voice-enabled inbox validation, assigned-inbox check, open-conversation reuse, ContactInbox/conversation/call/message persistence, and Chatwoot response shape. | Keep in Review; reopen only if live smoke exposes provider initiation/status-update drift beyond the fakeable persisted boundary. | Focused contact call tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | -| 12 | B12 optional live smoke | API/browser/enterprise smoke commands are checked in; live runs need PostgreSQL, Redis, Meilisearch, Vite, and Chrome. | Run full live smoke when environment is available and map failures to the board. | `docs/parity/frontend_smoke_report.md` records pass/fail and linked owners. | -| 13 | B9.3 delayed automation actions | Current reference exposes no delayed automation action params; scheduled-item work is already P5.12; `send_email_to_team` is durable and `add_sla` mutates conversation/applied SLA state. | Keep automation drift closed if future reference/smoke exposes delayed params or unsupported action shapes. | Automation worker/action fixtures verify queued team email replay, retry visibility through worker jobs, and SLA action idempotency. | -| 14 | P5.13 reports/analytics | P5.13a derives visible report aggregates from persisted rows; P5.13b adds lazy rollup freshness, durable day rollup jobs, and `/reports` metric timeseries. | Keep report drift closed as frontend smoke or reference inspection exposes additional metrics. | Report fixtures verify timeseries values, cache/freshness behavior, and no hidden placeholder JSON. | +| 11 | P3.16 teams frontend routes | Implemented for reused dashboard team settings: no-trailing-slash `GET/POST /teams` and `GET/POST/PATCH/DELETE /teams/:team_id/team_members` aliases are registered, and frontend `PATCH /teams/:team_id` update now reaches the Chatwoot team serializer response. | Keep in Review; reopen only if live team settings smoke exposes team show/store payload drift or team-member authorization/status-code differences beyond the inspected controller/Jbuilder contract. | Focused TeamHandler PATCH test, router/route-parity tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | +| 12 | P6.8 contact outbound voice call | Implemented for the reused dashboard route with Twilio voice-enabled inbox validation, assigned-inbox check, open-conversation reuse, ContactInbox/conversation/call/message persistence, and Chatwoot response shape. | Keep in Review; reopen only if live smoke exposes provider initiation/status-update drift beyond the fakeable persisted boundary. | Focused contact call tests, route dump/parity regeneration, full `go test ./...`, and `git diff --check` passed. | +| 13 | B12 optional live smoke | API/browser/enterprise smoke commands are checked in; live runs need PostgreSQL, Redis, Meilisearch, Vite, and Chrome. | Run full live smoke when environment is available and map failures to the board. | `docs/parity/frontend_smoke_report.md` records pass/fail and linked owners. | +| 14 | B9.3 delayed automation actions | Current reference exposes no delayed automation action params; scheduled-item work is already P5.12; `send_email_to_team` is durable and `add_sla` mutates conversation/applied SLA state. | Keep automation drift closed if future reference/smoke exposes delayed params or unsupported action shapes. | Automation worker/action fixtures verify queued team email replay, retry visibility through worker jobs, and SLA action idempotency. | +| 15 | P5.13 reports/analytics | P5.13a derives visible report aggregates from persisted rows; P5.13b adds lazy rollup freshness, durable day rollup jobs, and `/reports` metric timeseries. | Keep report drift closed as frontend smoke or reference inspection exposes additional metrics. | Report fixtures verify timeseries values, cache/freshness behavior, and no hidden placeholder JSON. | ## Open Checkpoint Contracts @@ -179,6 +180,7 @@ These rows are the executable development plan from this point forward. A checkp | P3.13 dashboard apps API parity | `internal/router/router.go`, `internal/handler/api/v1/dashboard_app_handler.go`, `internal/service/dashboard_app_service.go`, `internal/model/dashboard_app.go`, `internal/repository/dashboard_app_repo.go`, dashboard app handler/service tests, `cmd/route_parity` | `reference/chatwoot/config/routes.rb:130`, `reference/chatwoot/app/controllers/api/v1/accounts/dashboard_apps_controller.rb`, `reference/chatwoot/app/views/api/v1/accounts/dashboard_apps/*.json.jbuilder`, `reference/chatwoot/app/views/api/v1/models/_dashboard_app.json.jbuilder`, `reference/chatwoot/app/models/dashboard_app.rb`, `reference/chatwoot/app/javascript/dashboard/api/dashboardApps.js`, `reference/chatwoot/app/javascript/dashboard/store/modules/dashboardApps.js`, dashboard integrations DashboardApps modal/index components | Dashboard app APIs now match the reused settings flow: the full Chatwoot resource route set is tracked; create/update accept raw frontend bodies and Rails-style `{ dashboard_app: ... }` wrappers; create returns `200 OK`; list returns a raw array; show/create/update return raw dashboard app objects containing only `id`, `title`, `content`, and `created_at`; show/update/delete are scoped by current account; delete returns `204`; and content validation requires at least one frame widget with an HTTP(S) URL. | Review by `feat(dashboard-apps): align chatwoot payloads`; focused dashboard app handler/service tests, combined handler/service/repository/router/route-parity tests, route dump/parity regenerated to `TOTAL: 907` and `357 exact, 13 parameter-compatible, 0 missing out of 370`, full `go test ./...`, and `git diff --check` passed. | | P3.14 canned responses API parity | `internal/router/router.go`, `internal/handler/api/v1/canned_response_handler.go`, `internal/canned/service.go`, `internal/canned/model.go`, canned handler/service tests, `cmd/route_parity` | `reference/chatwoot/config/routes.rb:114`, `reference/chatwoot/app/controllers/api/v1/accounts/canned_responses_controller.rb`, `reference/chatwoot/app/models/canned_response.rb`, `reference/chatwoot/db/schema.rb`, `reference/chatwoot/app/javascript/dashboard/api/cannedResponse.js`, `reference/chatwoot/app/javascript/dashboard/store/modules/cannedResponse.js` | Canned responses now match the reused dashboard API: frontend `PATCH /api/v1/accounts/:account_id/canned_responses/:id` and no-trailing-slash index/create aliases are registered; the tracked critical route set includes Rails `PATCH`; create/update accept raw frontend bodies plus Rails-style `{ canned_response: ... }`; list/search return raw arrays; `search=` filters and ranks by short-code prefix, short-code contains, then content contains; create/update/show return raw objects with `id`, `account_id`, `short_code`, `content`, `created_at`, and `updated_at`; update/delete are account-scoped; delete returns empty `200 OK`; legacy `q` and `/search` remain only compatibility aliases. | Review by `feat(canned-responses): align chatwoot payloads`; focused canned handler tests cover list/search/raw create/PATCH update/delete/cross-account `404`, service tests cover account-scoped get/update/delete and ranking, route dump/parity regenerated to `TOTAL: 910` and `358 exact, 13 parameter-compatible, 0 missing out of 371`, full `go test ./...`, and `git diff --check` passed. | | P3.15 notification subscriptions API parity | `internal/router/router.go`, `internal/handler/api/v1/notification_subscription_handler.go`, `internal/service/notification_subscription_service.go`, `internal/repository/notification_subscription_repo.go`, notification subscription handler tests, `cmd/route_parity` | `reference/chatwoot/config/routes.rb:440`, `reference/chatwoot/app/controllers/api/v1/notification_subscriptions_controller.rb`, `reference/chatwoot/app/builders/notification_subscription_builder.rb`, `reference/chatwoot/app/models/notification_subscription.rb`, `reference/chatwoot/db/schema.rb`, dashboard `api/notificationSubscription.js`, `helper/pushHelper.js` | Notification subscriptions now match the reused dashboard push registration boundary: singular user-scoped `POST/DELETE /api/v1/notification_subscriptions` routes are tracked; create accepts raw frontend bodies plus Rails-style wrappers; browser push identifiers derive from `endpoint`; FCM identifiers derive from `device_id` or `push_token`; duplicate identifiers update/move to the current user; create serializes raw Chatwoot subscription fields with string enum values; and destroy deletes by `push_token`/endpoint while returning empty `200 OK` for missing matches. | Review by `feat(notifications): align subscription payloads`; focused notification subscription handler tests, combined handler/service/repository/router/route-parity tests, route dump/parity regeneration to `TOTAL: 912` and `360 exact, 13 parameter-compatible, 0 missing out of 373`, full `go test ./...`, and `git diff --check` passed. | +| P3.16 teams frontend route parity | `internal/router/router.go`, `internal/handler/api/v1/team_handler.go`, team handler/router tests, `cmd/route_parity` | `reference/chatwoot/config/routes.rb:296-300`, `reference/chatwoot/app/controllers/api/v1/accounts/teams_controller.rb`, `reference/chatwoot/app/controllers/api/v1/accounts/team_members_controller.rb`, `reference/chatwoot/app/views/api/v1/accounts/teams/*.json.jbuilder`, `reference/chatwoot/app/views/api/v1/accounts/team_members/*.json.jbuilder`, dashboard `api/teams.js`, `store/modules/teams/actions.js`, `store/modules/teamMembers.js` | Team routes now match reused dashboard call sites: no-trailing-slash `GET/POST /teams` aliases are registered for `CacheEnabledApiClient`, frontend `PATCH /teams/:team_id` update is registered alongside Rails `PUT`, and no-trailing-slash team-member list/create/update/delete aliases are registered for `TeamsAPI.getAgents/addAgents/updateAgents`. Team update continues to accept raw frontend bodies and `{ team: ... }` wrappers and returns raw Chatwoot team fields. | Review by `feat(teams): align frontend update routes`; focused TeamHandler PATCH test, router/route-parity tests, route dump/parity regeneration to `TOTAL: 919` and `361 exact, 13 parameter-compatible, 0 missing out of 374`, full `go test ./...`, and `git diff --check` passed. | | P6.8 contact outbound voice call parity | `internal/router/router.go`, `internal/handler/api/v1/contact_handler.go`, `internal/service/contact_service.go`, `internal/model/call.go`, contact handler tests | `reference/chatwoot/config/routes.rb:216`, `reference/chatwoot/enterprise/app/controllers/api/v1/accounts/contacts/calls_controller.rb`, `reference/chatwoot/enterprise/app/services/voice/outbound_call_builder.rb`, `reference/chatwoot/enterprise/app/services/voice/call_message_builder.rb`, `reference/chatwoot/enterprise/app/models/call.rb`, dashboard `api/contacts.js`, `store/modules/contacts/actions.js`, `api/channel/voice/voiceAPIClient.js` | Contact outbound calls now match the Chatwoot enterprise route boundary: account contact lookup, current user's assigned `Channel::TwilioSms` inbox lookup, `voice_enabled` guard, phone-number guard, open display-ID conversation reuse only for same inbox/contact, new ContactInbox/open conversation creation when needed, persisted outgoing Twilio call metadata, linked `voice_call` message content attributes, and raw `{ conversation_id, inbox_id, call_sid, conference_sid }` response. | Review by `feat(contacts): initiate voice calls`; focused contact call tests cover success/reuse/resolved-hint ignored/no-phone/non-voice/unassigned cases; route dump/parity regenerated to `TOTAL: 861` and `299 exact, 7 parameter-compatible, 0 missing out of 306`; full `go test ./...` and `git diff --check` passed. | | P6 conversation transcript response parity | `internal/handler/api/v1/conversation_handler.go`, conversation handler tests | `reference/chatwoot/app/controllers/api/v1/accounts/conversations_controller.rb`, dashboard `api/inbox/conversation.js` | Account conversation transcript now follows Chatwoot's controller contract: missing email returns `422 { error: "email param missing" }`, nonblank email schedules through the existing service boundary and returns empty `200 OK`, and invalid-looking but nonblank email values are not rejected by local email format validation. | Review by `feat(conversations): align transcript responses`; focused transcript handler/service tests, combined handler/service/router tests, full `go test ./...`, and `git diff --check` must pass. | | P6 conversation custom attributes response parity | `internal/handler/api/v1/conversation_handler.go`, conversation handler tests | `reference/chatwoot/app/controllers/api/v1/accounts/conversations_controller.rb`, `app/views/api/v1/accounts/conversations/custom_attributes.json.jbuilder`, dashboard `api/inbox/conversation.js`, conversation store action | Account conversation custom attribute updates now return Chatwoot `{ custom_attributes: ... }` only, matching the store action that reads `response.data.custom_attributes`, instead of returning the full conversation serializer with unrelated fields. Empty/null JSON serializes as `{}`. | Review by `feat(conversations): align custom attribute response`; focused handler tests, combined handler/service/router tests, full `go test ./...`, and `git diff --check` passed. | @@ -220,6 +222,7 @@ This ledger records the committed parity checkpoints that future slices should b | Commit | Scope | Verification summary | Follow-up state | | --- | --- | --- | --- | +| `feat(teams): align frontend update routes` | Advances P3.16 team route parity by matching Chatwoot `TeamsController`, `TeamMembersController`, their Jbuilder serializers, routes `296-300`, and reused dashboard `api/teams.js`/team store callers. GoChat now registers frontend no-trailing-slash aliases for team index/create and team-member list/create/update/delete, tracks the Rails `PATCH /api/v1/accounts/:account_id/teams/:team_id` route, routes frontend team updates through the existing Chatwoot-shaped update serializer, and keeps raw frontend bodies plus `{ team: ... }` wrappers accepted. | `go test ./internal/handler/api/v1 -run TeamHandler -count=1`; `go test ./internal/handler/api/v1 ./internal/router ./cmd/route_parity -run 'TeamHandler\|Router\|RouteParity' -count=1`; `go run ./cmd/dump_routes > docs/parity/gochat_routes.txt`; `go run ./cmd/route_parity`; full `go test ./...`; `git diff --check`. Route dump is `TOTAL: 919`; tracked route parity is `361 exact, 0 method-compatible, 13 parameter-compatible, 0 missing out of 374`. | P3.16 moves to Review for current team settings route evidence; continue Phase 2/3 drift audit, Phase 6 placeholder audit, B12 live smoke, or fresh reference/smoke drift. | | `feat(notifications): align subscription payloads` | Advances P3.15 notification subscription parity by matching Chatwoot `NotificationSubscriptionsController`, `NotificationSubscriptionBuilder`, the `NotificationSubscription` enum model, schema fields, and reused dashboard `pushHelper`/`notificationSubscription` API. GoChat now registers the singular user-scoped `DELETE /api/v1/notification_subscriptions`, tracks `POST/DELETE` route parity, accepts raw frontend bodies and Rails-style wrappers, derives browser push identifiers from `subscription_attributes.endpoint`, derives FCM identifiers from `device_id` or `push_token`, updates/moves duplicate identifiers to the current user, returns raw subscription objects with string `subscription_type`, and makes destroy an empty `200 OK` no-op for missing matches like the reference controller. | `go test ./internal/handler/api/v1 -run NotificationSubscription -count=1`; `go test ./internal/service ./internal/repository -run NotificationSubscription -count=1`; `go test ./internal/router ./cmd/route_parity -run 'Router\|RouteParity' -count=1`; `go run ./cmd/dump_routes > docs/parity/gochat_routes.txt`; `go run ./cmd/route_parity`; full `go test ./...`; `git diff --check`. Route dump is `TOTAL: 912`; tracked route parity is `360 exact, 0 method-compatible, 13 parameter-compatible, 0 missing out of 373`. | P3.15 moves to Review for current browser push registration evidence; continue Phase 2/3 drift audit, Phase 6 placeholder audit, B12 live smoke, or fresh reference/smoke drift. | | `4e0113a feat(canned-responses): align chatwoot payloads` | Advances P3.14 canned response parity by matching Chatwoot `CannedResponsesController`, `CannedResponse#order_by_search`, schema fields, and reused dashboard `cannedResponse` API/store. GoChat now registers frontend no-trailing-slash index/create aliases plus `PATCH` update, accepts raw frontend bodies and Rails-style wrappers, returns raw arrays/objects with Chatwoot fields instead of local `{ success, data }` envelopes, supports `search=` ranking by short-code prefix/contains/content, scopes show/update/delete by account, and returns empty `200 OK` deletes while keeping legacy `q` and `/search` as compatibility aliases only. | `go test ./internal/handler/api/v1 -run CannedResponse -count=1`; `go test ./internal/canned -count=1`; `go test ./internal/handler/api/v1 ./internal/canned ./internal/router ./cmd/route_parity -run 'CannedResponse\|Router\|RouteParity' -count=1`; `go run ./cmd/dump_routes > docs/parity/gochat_routes.txt`; `go run ./cmd/route_parity`; full `go test ./...`; `git diff --check`. Route dump is `TOTAL: 910`; tracked route parity is `358 exact, 0 method-compatible, 13 parameter-compatible, 0 missing out of 371`. | P3.14 moves to Review for current canned response settings evidence; continue Phase 2/3 drift audit, Phase 6 placeholder audit, B12 live smoke, or fresh reference/smoke drift. | | `docs: track canned response parity` | Documentation-only checkpoint requested before continuing implementation. It records the already-clean `75f0e80 feat(dashboard-apps): align chatwoot payloads` baseline and lands fresh canned-response reference/frontend drift as P3.14, with owner files, reference files, required request/response/status contracts, route artifact rules, and test gates. | `git diff --check`. No Go code changed and no route artifacts changed. | Start `feat(canned-responses): align chatwoot payloads`, then continue Phase 2/3 drift audit, Phase 6 placeholder audit, or B12 live smoke from concrete reference/smoke evidence. | @@ -2401,3 +2404,4 @@ Verification milestone gates: - 2026-06-06: P3.14 canned response checkpoint prepared as `feat(canned-responses): align chatwoot payloads`; audited Chatwoot canned responses controller/model/schema and reused dashboard API/store. GoChat now exposes no-trailing-slash index/create aliases and `PATCH` update, accepts raw and wrapped bodies, returns raw Chatwoot arrays/objects, supports `search=` with Chatwoot ranking, scopes mutations by account, and returns empty `200 OK` delete. Focused canned handler/service tests, combined handler/canned/router/route-parity tests, route dump/parity regeneration (`TOTAL: 910`, `358 exact`, `13 parameter-compatible`, `0 missing out of 371`), full `go test ./...`, and `git diff --check` passed; continue Phase 2/3 drift audit, Phase 6 placeholder audit, or B12 live smoke. - 2026-06-06: Documentation checkpoint prepared as `docs: record committed parity tracker`; confirms `4e0113a feat(canned-responses): align chatwoot payloads` is the current committed implementation baseline, marks this master plan as the landed tracker for known Hermes plans and user-confirmed scope, and keeps the next executable queue limited to Phase 2/3 drift audit, Phase 6 placeholder audit, or B12 live smoke. Verification for this docs-only checkpoint: `git diff --check`. - 2026-06-06: P3.15 notification subscription checkpoint prepared as `feat(notifications): align subscription payloads`; audited Chatwoot notification subscriptions controller, builder, model/schema, and reused dashboard push helper/API. GoChat now exposes the singular user-scoped `DELETE /api/v1/notification_subscriptions`, tracks `POST/DELETE` route parity, accepts raw and wrapped create bodies, derives identifiers from browser endpoints or FCM device/push tokens, updates/moves duplicate identifiers to the current user, returns raw subscription JSON with string enum values, and makes destroy an empty `200 OK` no-op for missing matches. Focused notification subscription handler tests, service/repository/router/route-parity tests, route dump/parity regeneration (`TOTAL: 912`, `360 exact`, `13 parameter-compatible`, `0 missing out of 373`), full `go test ./...`, and `git diff --check` passed; continue Phase 2/3 drift audit, Phase 6 placeholder audit, or B12 live smoke. +- 2026-06-06: P3.16 teams frontend route checkpoint prepared as `feat(teams): align frontend update routes`; audited Chatwoot teams/team-members controllers, Jbuilder serializers, routes `296-300`, and reused dashboard teams API/store callers. GoChat now exposes the frontend `PATCH /api/v1/accounts/:account_id/teams/:team_id` update path, registers no-trailing-slash team index/create aliases, and registers no-trailing-slash team-member list/create/update/delete aliases used by the dashboard. Focused TeamHandler PATCH test, router/route-parity tests, route dump/parity regeneration (`TOTAL: 919`, `361 exact`, `13 parameter-compatible`, `0 missing out of 374`), full `go test ./...`, and `git diff --check` passed; continue Phase 2/3 drift audit, Phase 6 placeholder audit, or B12 live smoke. diff --git a/docs/parity/gochat_routes.txt b/docs/parity/gochat_routes.txt index a5d13e48..35fbf201 100644 --- a/docs/parity/gochat_routes.txt +++ b/docs/parity/gochat_routes.txt @@ -94,6 +94,7 @@ DELETE /api/v1/accounts/:account_id/sla_policies/:id DELETE /api/v1/accounts/:account_id/sla_policies/:id/inboxes/:inbox_id DELETE /api/v1/accounts/:account_id/tags/:tag_id DELETE /api/v1/accounts/:account_id/teams/:team_id +DELETE /api/v1/accounts/:account_id/teams/:team_id/team_members DELETE /api/v1/accounts/:account_id/teams/:team_id/team_members/ DELETE /api/v1/accounts/:account_id/twitter_channels/:twitter_id DELETE /api/v1/accounts/:account_id/users/:user_id @@ -362,8 +363,10 @@ GET /api/v1/accounts/:account_id/summary_reports/team GET /api/v1/accounts/:account_id/tags/ GET /api/v1/accounts/:account_id/tags/:tag_id GET /api/v1/accounts/:account_id/tags/:tag_id/conversations +GET /api/v1/accounts/:account_id/teams GET /api/v1/accounts/:account_id/teams/ GET /api/v1/accounts/:account_id/teams/:team_id +GET /api/v1/accounts/:account_id/teams/:team_id/team_members GET /api/v1/accounts/:account_id/teams/:team_id/team_members/ GET /api/v1/accounts/:account_id/tiktok_channels/ GET /api/v1/accounts/:account_id/twilio_sms_channels/ @@ -530,6 +533,8 @@ PATCH /api/v1/accounts/:account_id/portals/:portal_id/articles/:article_id PATCH /api/v1/accounts/:account_id/portals/:portal_id/articles/bulk_actions/update_category PATCH /api/v1/accounts/:account_id/portals/:portal_id/articles/bulk_actions/update_status PATCH /api/v1/accounts/:account_id/portals/:portal_id/categories/:category_id +PATCH /api/v1/accounts/:account_id/teams/:team_id +PATCH /api/v1/accounts/:account_id/teams/:team_id/team_members PATCH /api/v1/accounts/:account_id/teams/:team_id/team_members/ PATCH /api/v1/accounts/:account_id/webhooks/:webhook_id PATCH /api/v1/widget/contact @@ -729,7 +734,9 @@ POST /api/v1/accounts/:account_id/saml_settings/:id/toggle_active POST /api/v1/accounts/:account_id/sla_policies POST /api/v1/accounts/:account_id/sla_policies/:id/inboxes POST /api/v1/accounts/:account_id/tags/ +POST /api/v1/accounts/:account_id/teams POST /api/v1/accounts/:account_id/teams/ +POST /api/v1/accounts/:account_id/teams/:team_id/team_members POST /api/v1/accounts/:account_id/teams/:team_id/team_members/ POST /api/v1/accounts/:account_id/tiktok_channels/ POST /api/v1/accounts/:account_id/twilio_sms_channels/ @@ -910,4 +917,4 @@ PUT /public/api/v1/csat_survey/:id PUT /public/api/v1/inboxes/:inbox_id/contacts/:contact_id PUT /public/api/v1/inboxes/:inbox_id/contacts/:contact_id/conversations/:conversation_id/messages/:message_id PUT /widget/direct_uploads/:upload_uuid -TOTAL: 912 +TOTAL: 919 diff --git a/docs/parity/route_parity.md b/docs/parity/route_parity.md index 4b01b81a..ed284255 100644 --- a/docs/parity/route_parity.md +++ b/docs/parity/route_parity.md @@ -7,7 +7,7 @@ Generated from: This report covers tracked frontend-critical Chatwoot routes from `reference/chatwoot/config/routes.rb`, including API v1 account routes, Captain/Copilot, assignment policies, widget/public APIs, and API v2 reports. Ruby is not installed in the workspace, so Chatwoot routes are sourced from static route declarations instead of `bin/rails routes`. -Summary: 360 exact, 0 method-compatible, 13 parameter-compatible, 0 missing out of 373 tracked critical routes. +Summary: 361 exact, 0 method-compatible, 13 parameter-compatible, 0 missing out of 374 tracked critical routes. ## Missing Critical Routes @@ -257,6 +257,7 @@ These routes exist with equivalent method and path shape but different parameter | PATCH | `/api/v1/accounts/:account_id/portals/:portal_id/articles/bulk_actions/update_category` | `/api/v1/accounts/:account_id/portals/:portal_id/articles/bulk_actions/update_category` | `api/v1/accounts/articles/bulk_actions#update_category` | `routes.rb:399` | exact | | PATCH | `/api/v1/accounts/:account_id/portals/:portal_id/articles/bulk_actions/update_status` | `/api/v1/accounts/:account_id/portals/:portal_id/articles/bulk_actions/update_status` | `api/v1/accounts/articles/bulk_actions#update_status` | `routes.rb:398` | exact | | PATCH | `/api/v1/accounts/:account_id/portals/:portal_id/categories/:category_id` | `/api/v1/accounts/:account_id/portals/:portal_id/categories/:category_id` | `api/v1/accounts/categories#update` | `routes.rb:392` | exact | +| PATCH | `/api/v1/accounts/:account_id/teams/:team_id` | `/api/v1/accounts/:account_id/teams/:team_id` | `api/v1/accounts/teams#update` | `routes.rb:296` | exact | | PATCH | `/api/v1/accounts/:account_id/teams/:team_id/team_members/` | `/api/v1/accounts/:account_id/teams/:team_id/team_members/` | `api/v1/accounts/teams/team_members#update` | `routes.rb:300` | exact | | PATCH | `/api/v1/accounts/:account_id/webhooks/:webhook_id` | `/api/v1/accounts/:account_id/webhooks/:webhook_id` | `api/v1/accounts/webhooks#update` | `routes.rb:342` | exact | | PATCH | `/api/v1/widget/contact/set_user` | `/api/v1/widget/contact/set_user` | `api/v1/widget/contact#set_user` | `routes.rb:461` | exact | diff --git a/internal/handler/api/v1/team_handler_test.go b/internal/handler/api/v1/team_handler_test.go index 7587501f..04b97215 100644 --- a/internal/handler/api/v1/team_handler_test.go +++ b/internal/handler/api/v1/team_handler_test.go @@ -160,6 +160,31 @@ func (s *TeamHandlerTestSuite) TestUpdate_Success() { assert.Equal(s.T(), false, payload["allow_auto_assign"]) } +func (s *TeamHandlerTestSuite) TestUpdate_PatchRawPayloadSuccess() { + team := &model.Team{AccountID: s.account.ID, Name: "patch-test-team", AllowAutoAssignment: true} + s.Require().NoError(s.db.Create(team).Error) + + r := gin.New() + r.PATCH("/api/v1/accounts/:account_id/teams/:team_id", func(c *gin.Context) { + s.authMiddleware(c) + s.handler.Update(c) + }) + + w := httptest.NewRecorder() + body := `{"name":"patched-team","description":"patched description","allow_auto_assign":false}` + req, _ := http.NewRequest("PATCH", fmt.Sprintf("/api/v1/accounts/%d/teams/%d", s.account.ID, team.ID), bytes.NewBufferString(body)) + req.Header.Set("Content-Type", "application/json") + r.ServeHTTP(w, req) + + assert.Equal(s.T(), http.StatusOK, w.Code) + var payload map[string]any + assert.NoError(s.T(), json.Unmarshal(w.Body.Bytes(), &payload)) + assert.NotContains(s.T(), payload, "success") + assert.NotContains(s.T(), payload, "data") + assert.Equal(s.T(), "patched-team", payload["name"]) + assert.Equal(s.T(), false, payload["allow_auto_assign"]) +} + func (s *TeamHandlerTestSuite) TestDelete_Success() { team := &model.Team{AccountID: s.account.ID, Name: "delete-test-team"} s.Require().NoError(s.db.Create(team).Error) diff --git a/internal/router/router.go b/internal/router/router.go index 6eff8feb..1f768366 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -1138,17 +1138,24 @@ func registerV1Routes(g *gin.RouterGroup, h *Handlers) { // Team routes (ref: Chatwoot resources :teams) teams := accountScoped.Group("/teams") { + teams.GET("", h.Team.List) teams.GET("/", h.Team.List) + teams.POST("", h.Team.Create) teams.POST("/", h.Team.Create) teams.GET("/:team_id", h.Team.Get) + teams.PATCH("/:team_id", h.Team.Update) teams.PUT("/:team_id", h.Team.Update) teams.DELETE("/:team_id", h.Team.Delete) // Team members (ref: Chatwoot nested resources :team_members) teamMembers := teams.Group("/:team_id/team_members") { + teamMembers.GET("", h.Team.ListMembers) teamMembers.GET("/", h.Team.ListMembers) + teamMembers.POST("", h.Team.AddMembers) teamMembers.POST("/", h.Team.AddMembers) + teamMembers.PATCH("", h.Team.UpdateMembers) teamMembers.PATCH("/", h.Team.UpdateMembers) + teamMembers.DELETE("", h.Team.RemoveMembers) teamMembers.DELETE("/", h.Team.RemoveMembers) } }