Skip to content

fix(api): Circles.list() unwraps the data envelope; Circles.new() sends tag/parents - #66

Merged
nycomp merged 1 commit into
mainfrom
fix/circles-envelope-55
Oct 3, 2026
Merged

nycomp merged 1 commit into
mainfrom
fix/circles-envelope-55

Conversation

@nycomp

@nycomp nycomp commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #55 (both defects).

Changes

  • Circles.list() unwraps ["data"] — the API's list endpoints return a {"data": [...]} envelope (assignments, submissions, timetable all do); the client looked up a "circles" key that is never sent.
  • Circles.new() now sends tag and parents in the POST payload (parents only when provided) — previously both parameters were silently dropped, so created circles never carried them.
  • description now defaults to "" to match the API, where it is optional server-side (fix(circles): @meta filter in list(), 409 on missing-circle delete (#760) campus#763 made it default "").
  • New tests/unit/test_circles.py: envelope unwrap + payload-carries-tag/parents regressions, in the existing mock-client style.

Notes

Verification

  • poetry run pytest: 118 passed (4 new).
  • ruff check on changed files: clean.

…ds tag/parents

Circles.list() looked up a "circles" envelope key the API never
sends; the list endpoints return {"data": [...]} (assignments,
submissions, timetable all do). Unwrap "data" instead.

Circles.new() accepted tag/parents but built the POST payload from
name/description only, silently dropping them. Send tag and parents
(now only when provided), and default description to "" to match the
API, where description is optional (nyjc-computing/campus#763).

Fixes #55.
@nycomp

nycomp commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Dev E2E verification (nyjc-computing/campus#762 sweep), driven end-to-end through this branch's client against https://campusapi-development.up.railway.app (deploy a5bf25e, campus phases 1–2 live) — 8/8 checks passed:

[PASS] list-200-no-meta-leak: 2 circles: uid-circle-4c2094d0(root), uid-circle-e4f032fc(admin)
[PASS] new-carries-tag-parents: tag='project' root.members[uid-circle-ace50b83]=10
[PASS] patch-name-only-200: name='e2e-p3-a-renamed-e20c10a3'
[PASS] dup-name-create-409: got 409 (want 409): Circle name already exists
[PASS] dup-name-rename-409: got 409 (want 409): Circle name already exists
[PASS] root-plus-parents-409: got 409 (want 409): Root circle cannot have parents
[PASS] patch-missing-409: got 409 (want 409): Circle not found
[PASS] delete-missing-409: got 409 (want 409): Circle not found

Notes:

  • new-carries-tag-parents verified parents as a membership edge in the parent circle's members dict (root.members[scratch_id] == 10) — that is how the server records parentage; the circle record itself has no parents field.
  • All scratch circles deleted after the sweep; dev circles collection back to root + campus-admin.

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.

fix(api): Circles.list() expects a "circles" envelope key the API does not send; Circles.new() drops tag/parents

2 participants