Skip to content

fix(spaces): send visibility instead of the legacy is_public field - #22

Merged
MantisCartography merged 1 commit into
mainfrom
fix/visibility-contract
Sep 28, 2026
Merged

MantisCartography merged 1 commit into
mainfrom
fix/visibility-contract

Conversation

@MantisCartography

Copy link
Copy Markdown
Contributor

Summary

The backend hard-rejects the legacy is_public field on /synthesis/landscape and /synthesis/github (CreateMapSerializer raises Use visibility instead.) since the Unified Space Visibility change (MantisAPI #1958, Jul 2026). The SDK still sends is_public on both creation paths, so every SDK-driven space creation against prod has been 400-ing for over two months.

Most visible symptom: the repo_radar daily Celery task (MantisAPI #1627) runs "green" every morning at 06:00 UTC while all its map-refresh calls fail with {'is_public': [ErrorDetail(string='Use visibility instead.', code='invalid')]} — the per-source try/except in examples/repo_radar/repo_radar.py swallows the 400s and the container exits 0. The "Mantis Radar" space (alias m4m) still holds data from June 20.

Changes

  • New _visibility_from_privacy_level() helper: maps SpacePrivacy.PUBLIC -> unlisted ('public' is backend-set-only, not user-settable — Space.USER_SETTABLE_VISIBILITIES = (private, unlisted)), PRIVATE/SHARED -> private. Explicit visibility= kwarg wins over privacy_level=.
  • create() and from_github() now send visibility and never is_public.
  • New optional visibility= kwarg on both methods for callers that want the exact tier.
  • Docstrings updated to document the contract.
  • 4 new tests in tests/test_create_space.py asserting is_public is absent and visibility is correct (default private, public->unlisted mapping, explicit override, from_github path).

Verification

Full test suite locally: 72 passed (68 pre-existing + 4 new), including the existing sanitize/poll/error tests. No runtime behavior changes beyond the request payload field.

Semantics note

SpacePrivacy.PUBLIC previously requested is_public=true; the closest user-settable equivalent is unlisted (link-shareable, not discoverable). If a true public space is needed, that's a backend-side action now.

Downstream: once merged, MantisAPI's SDK_COMMIT pin in src/mantis4mantis/repo_radar_task.py needs bumping to the merge SHA (tracked separately).

The backend hard-rejects the legacy is_public field on
/synthesis/landscape and /synthesis/github (CreateMapSerializer,
'Use visibility instead.') since the Unified Space Visibility change
(#1958, Jul 2026). Every SDK-driven space creation against prod has
been 400-ing since.

- add _visibility_from_privacy_level(): maps SpacePrivacy.PUBLIC ->
  'unlisted' (public is backend-set-only), PRIVATE/SHARED -> 'private';
  an explicit visibility= kwarg wins over privacy_level=
- both create() and from_github() now send 'visibility' and never
  'is_public'
- new visibility= kwarg on both methods for callers that want the
  exact tier
- 4 new tests asserting is_public is absent and visibility is correct

Verified: full test suite 72 passed (was 68).

Fixes the repo_radar daily task silent no-op (MantisAPI #1627
automation refreshing the Mantis Radar space since June).
@MantisCartography
MantisCartography merged commit 0544dba into main Sep 28, 2026
4 checks passed
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