Skip to content

feat!: echo the query and return the answer under a in batch results - #10

Merged
dragonee merged 1 commit into
mainfrom
feat/batch-echo-query
Jul 8, 2026
Merged

feat!: echo the query and return the answer under a in batch results#10
dragonee merged 1 commit into
mainfrom
feat/batch-echo-query

Conversation

@dragonee

@dragonee dragonee commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

Batch-style results now echo their query and carry the answer under a, instead of the lean {"username": ...}:

{"u":"test@example.org","s":"jira","q":"slack","a":"U123456"}

This makes each result self-describing — clients can correlate by content, not only by position.

Changes

  • POST /api/whose-name/query/batch — each item echoes u, s, q and the answer a:
    [{"u":"test@example.org","s":"jira","q":"slack","a":"U123456"},
     {"u":"unknown","s":"unknown","q":"unknown","a":null}]
    
  • GET /api/whose-name/pool — same shape per member, with the pool mapping: u = member name, s = the pool's field, q = asked service, a = answer:
    ?p=Slackers&q=email →
    [{"u":"U123456","s":"slack","q":"email","a":"single@example.org"},
     {"u":"U234567","s":"slack","q":"email","a":["other@example.org","new@example.org"]}]
    

Status semantics are unchanged: 200 all resolved · 207 any null · 422 malformed body · 404 unknown pool.

Design

  • Presentation only. The /pool route reads the pool (for its members/field) and zips it with PoolService::whatAreTheNamesOf, which still returns a plain list — so whoseNamesAreThere and the flattened /pool/names endpoint ({"names":[...]}) are unaffected.
  • The single GET /query endpoint is intentionally left as {"username": ...}.

Docs

  • README batch and pool examples updated.
  • The 2026-07-06 batch ADL is marked superseded for its response shape (its status/validation decisions still hold); new ADL 2026-07-08-batch-query-echoes-input.md records the echo decision and /pool adopting the same shape.

Testing

Full suite passes via ./vendor/bin/sail test51 passed, 2 skipped (pre-existing filesystem-atime skips). Batch and pool endpoint tests updated to assert the {u,s,q,a} shape across 200/207/404 and the same-field shortcut.

⚠️ Breaking change

Batch (/query/batch) and pool (/pool) result items changed their key from username to a and gained u, s, q. Clients of those endpoints must migrate — notably whose-name-client (not touched here). The single /query endpoint is unchanged.

🤖 Generated with Claude Code

Batch-style results now echo their query and carry the answer under `a`
instead of a lean `{"username": ...}`:

  {"u":"test@example.org","s":"jira","q":"slack","a":"U123456"}

- POST /whose-name/query/batch: each item echoes u, s, q and the answer a.
- GET /whose-name/pool: same shape per member, mapping u = member name,
  s = the pool's field, q = the asked service, a = the answer.

Status semantics are unchanged (200 all resolved / 207 any null / 422
malformed body; 404 for an unknown pool). Results are now self-describing,
so clients can correlate by content rather than only by order.

Presentation only: the route reads the pool for its members/field and zips
it with PoolService::whatAreTheNamesOf, which still returns a plain list, so
whoseNamesAreThere and the flattened /pool/names endpoint are unaffected.
The single GET /query endpoint is intentionally left as {"username": ...}.

Docs: README examples updated; the 2026-07-06 batch ADL is superseded for
its response shape (status/validation decisions still hold) by a new ADL.

BREAKING CHANGE: batch (/query/batch) and pool (/pool) result items changed
their key from `username` to `a` and gained `u`, `s`, `q`. Clients of those
endpoints must migrate. The single /query endpoint is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dragonee
dragonee merged commit 582408e into main Jul 8, 2026
1 check passed
@dragonee
dragonee deleted the feat/batch-echo-query branch July 8, 2026 20:35
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