Skip to content

fix: use 'query' field for name search in query_members/query_teams#45

Merged
ysyneu merged 1 commit intomainfrom
fix/member-team-query-param
Apr 14, 2026
Merged

fix: use 'query' field for name search in query_members/query_teams#45
ysyneu merged 1 commit intomainfrom
fix/member-team-query-param

Conversation

@ysyneu
Copy link
Copy Markdown
Collaborator

@ysyneu ysyneu commented Apr 14, 2026

Summary

  • Backend /member/list and /team/list declare the search keyword as query (fc-pgy/cmd/server/controller/member/member.go:38-45, fc-pgy/cmd/server/controller/team/team.go:311-318), but the MCP server was sending member_name / team_name.
  • The unknown fields were silently dropped → query_members {name: "alice"} and query_teams {name: "ops"} returned all members/teams instead of fuzzy-matched results.
  • Same class of silent-mismatch bug as fix: use plural channel_ids in query_incidents/query_changes #43.

Root cause

Backend structs:

// member.go
type memberListInput struct {
    ...
    Query string `json:"query"`
}

// team.go
type listTeamInput struct {
    ...
    Query string `json:"query"`
}

Change

Wire-only — change request body keys member_name/team_namequery. The MCP-side name parameter, tool descriptions, and any other public-facing surface are unchanged, so this is not a breaking change for callers.

Test plan

  • go build ./... — passes locally.
  • query_members {name: "<known-substring>"} returns only matches (not the full list). Confirm outbound body in logs contains "query":"...", not "member_name":"...".
  • query_teams {name: "<known-substring>"} — same check against /team/list.
  • query_members {person_ids: "..."} regression: ID-direct path still works (it bypasses /member/list).

Related

Surfaced by the audit captured in TEST_PLAN_param_audit.md (added in #44).

🤖 Generated with Claude Code

…d /team/list

Backend input structs (fc-pgy/cmd/server/controller/member/member.go:38-45 and
fc-pgy/cmd/server/controller/team/team.go:311-318) declare the search keyword
field as 'query', not 'member_name'/'team_name'. Our previous payload was
silently dropped, so name-based search returned all members/teams unfiltered.

Wire-only fix; the MCP-side 'name' parameter and tool descriptions are unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ysyneu ysyneu merged commit 20912e0 into main Apr 14, 2026
13 checks passed
ysyneu added a commit that referenced this pull request Apr 14, 2026
The audit surfaced two real bugs (channel_ids in #43, query field in #45) and
a glossary drift fix (this PR). With those landing, the planning artifact has
served its purpose and shouldn't live in the repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ysyneu added a commit that referenced this pull request Apr 14, 2026
Backend /member/list and /team/list expect the search keyword as 'query'
(fc-pgy memberListInput.Query / listTeamInput.Query). The previous
member_name / team_name keys were silently ignored so name-based filtering
returned every member/team unfiltered.
ysyneu added a commit that referenced this pull request Apr 14, 2026
… tests (#44)

* fix: send channel_ids array to backend in query_incidents/query_changes

Backend /incident/list and /change/list expect channel_ids ([]int64),
not channel_id (int). The singular field was silently dropped, causing
the channel filter to leak incidents/changes from every channel.

Renames the MCP tool parameter channel_id → channel_ids (comma-separated
string), parsed via the existing parseCommaSeparatedInts helper, and
supports filtering by multiple channels in one call.

BREAKING: callers passing channel_id: <n> must switch to channel_ids: "<n>".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: align tool descriptions with glossary and document supported transports

Replace "collaboration space" with "channel" in tool descriptions, parameter
descriptions, and READMEs to match the canonical Flashduty glossary
(flashduty-docs/glossary.md). User-facing strings only — wire-level identifiers,
JSON tags, and MCP parameter names are unchanged.

Also add a "Supported Transports" table to README.md / README_zh.md clarifying:
- stdio: supported
- Streamable HTTP (/mcp, /flashduty): supported
- Standalone SSE (legacy GET /sse): not supported (server returns 405 by design)

Adds TEST_PLAN_param_audit.md capturing the wider audit sweep that surfaced this
glossary drift.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: send 'query' instead of member_name/team_name to /member/list and /team/list

Backend input structs (fc-pgy/cmd/server/controller/member/member.go:38-45 and
fc-pgy/cmd/server/controller/team/team.go:311-318) declare the search keyword
field as 'query', not 'member_name'/'team_name'. Our previous payload was
silently dropped, so name-based search returned all members/teams unfiltered.

Wire-only fix; the MCP-side 'name' parameter and tool descriptions are unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: drop TEST_PLAN_param_audit.md — audit complete

The audit surfaced two real bugs (channel_ids in #43, query field in #45) and
a glossary drift fix (this PR). With those landing, the planning artifact has
served its purpose and shouldn't live in the repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(e2e): add live-API regression tests for channel and name filters

Three new tests under the existing e2e build tag exercise the bugs fixed in
this PR end-to-end against a real Flashduty cluster:

- TestQueryIncidentsChannelFilter — picks the channel with the most recent
  incidents in an unfiltered query, then re-queries with channel_ids=that and
  asserts every returned incident matches. Catches the channel_id (singular)
  → channel_ids (array) wire-format bug.
- TestQueryMembersNameFilter — pulls a substring from a real member's name
  (rune-aware so non-ASCII names work), filters with name=substring, asserts
  the result narrowed and each member matches. Catches the member_name →
  query bug.
- TestQueryTeamsNameFilter — same shape as the members test against /team/list.

The existing TestQueryIncidents/Members/Teams in the suite call the tools
without filter args, so they could not have caught these bugs. Skips
gracefully when there isn't enough data (no incidents in window, ≤1
member/team).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (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