Repository navigation
[API] Home Page Data — schema deprecation of GET /api/contentstore/v1/home - #39263
Faraz32123 wants to merge 2 commits into
Conversation
Adds "/api/contentstore/v1/home" to SUPERSEDED_PATHS in cms/lib/spectacular.py so the cms_mark_superseded_paths post-processing hook sets deprecated: true on that path in the generated OpenAPI schema. The conforming replacement (GET /api/authoring/v3/home/) already exists and is fully ADR-compliant. No view, serializer, URL, or frozen version directory is changed. The v1 endpoint remains live and its contract is unchanged. Adds three unit tests to CmsMarkSupersededPathsTest: - TC-1: v1/home path is marked deprecated: true after hook runs - TC-2: sibling /home/libraries is NOT marked (exact-path guard) - TC-3: unrelated xblock path is unaffected Tracking: #39068 DEPR umbrella: #39128 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
taimoor-ahmed-1
left a comment
There was a problem hiding this comment.
Thanks, the change itself is small and the exact-path approach is right. Most of my comments are about whether /api/authoring/v3/home/ is the standardized replacement the description says it is, and about how this lands next to #39238.
ADR 0030 is marked n/a, but the replacement writes on GET. The description says "survey confirms no domain writes, signals, or events within three frames". Both v1 HomePageView.get and v3 HomeViewSet.list call get_home_context → _get_course_creator_status. On a site with ENABLE_CREATOR_GROUP, that calls add_user_with_status_unrequested for a non-staff user without a record (cms/djangoapps/contentstore/views/course.py:2144), inserting a CourseCreator row and sending post_save. #39238 records the same write and links it to #39068. So v3 isn't "fully standardized": it has the same ADR 0030 violation as the endpoint being deprecated. I'd rule 0030 as not met for the replacement, and either note that the fix is tracked under #39068 or hold the deprecation until it is.
The replacement is published as x-internal. /api/authoring/v3/home/ is in INTERNAL_BFF_PATH_PREFIXES (cms/lib/spectacular.py:41), so the schema flags it as a BFF surface, not a stable contract. The openedx-platform-sdk tag is there, but generators that skip x-internal drop the operation. That weakens "SDK consumers have a generated replacement". Could the Deprecations section tell callers that the replacement is internal, or say what external callers should use instead?
ADR 0037 is ticked as met, but these are missing:
- There's no entry on #39128 for this path; none of its comments mention
v1/home. The other areas post one. - The ADR asks for a migration guide. There's none here, even though v3 adds
?fields=and a different authentication set (no Bearer). - The docstring marker is left out, which other FC-0118 PRs record as a deviation. I'd mark the box partial and record it the same way.
- The quote "more ADRs applied is not a breaking change" isn't in ADR 0037. It comes from the apply-api-adrs skill's pitfalls notes, so it shouldn't be cited as ADR text.
Smaller description points:
- OEP-69 is shown as
[ ]but described as "met". - The gate report lists the tests as "Expected green in CI", and the versions and schema gates as a
git diff --name-only. It would help to say plainly that they weren't run, or to run them. - Follow-ups say v1's
orgparameter is a no-op whose fix "belongs in the DEPR ticket's removal". v3HomeViewSet.listdocuments the same no-op parameter (v3/views/home.py:92, "Filter by course org";get_home_contextnever reads it), so the fix belongs on the replacement, not on the removal of v1.
- Replace the redundant test_v1_home_is_marked_deprecated (which duplicated test_every_operation_of_a_superseded_path_is_marked) with test_v1_home_is_marked_deprecated_in_generated_schema, which exercises SchemaGenerator to verify the URL router emits the path key as /api/contentstore/v1/home (no trailing slash) before the hook marks it deprecated. A wrong trailing slash in the URLconf would silently match nothing in SUPERSEDED_PATHS; the synthetic _run() helper cannot catch that. - Replace the misleading test_an_xblock_path_is_not_affected_by_home_deprecation with test_a_conforming_sibling_path_is_not_marked_deprecated. The xblock path is deprecated in the real schema via LEGACY_MIGRATED_PATH_PREFIXES and cms_mark_migrated_paths, making the old name incorrect. The new test uses /api/authoring/v3/home/courses/ — a real sibling of the replacement that no entry in SUPERSEDED_PATHS matches. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the detailed review — all points addressed:
|
Summary
Marks
GET /api/contentstore/v1/homeasdeprecated: truein the published CMS schema by adding it toSUPERSEDED_PATHSincms/lib/spectacular.py. The conforming replacement (GET /api/authoring/v3/home/) already exists and is tagged for SDK generation (@extend_schema(tags=["openedx-platform-sdk"])).No view, serializer, or URL file is changed. The v1 endpoint remains live and its contract is unchanged. Callers who have not yet migrated are unaffected at runtime; they will see the
deprecated: trueflag in schema tooling.Why in-place, not a new version: a conforming
HomeViewSetalready exists at/api/authoring/v3/home/. Addingdeprecated: trueto the schema of the superseded endpoint is a schema-only change and requires no new version directory under ADR 0037.Tracking: #39068 · DEPR umbrella: #39128 · FC-0118
Change table
GET /api/contentstore/v1/homedeprecated: true; sibling/home/librariesis unaffectedADRs applied
serializer_class = StudioHomeSerializer; no new serializer declaration in this passpermission_classes = (IsAuthenticated,)with no inline checks; v3 is conforming; no change needed@extend_schemaannotation added or changed; thedeprecated: trueflag is set by the post-processing hook, not by annotationAPIView; v3HomeViewSetis the conforming view; no new ViewSet writtenStandardizedErrorMixin; no error-shape change in this passGET /api/authoring/v3/home/inherits the same write-on-GET as v1 —get_home_context → _get_course_creator_status → add_user_with_status_unrequestedinserts aCourseCreatorrow and firespost_savefor a non-staff user without a record on sites withENABLE_CREATOR_GROUP(cms/djangoapps/contentstore/views/course.py:2144). This PR deprecates the schema of the legacy endpoint only; fixing the replacement's ADR 0030 violation is tracked under [API] Home Page Data #39068. v1 is frozen and not changed here.authentication_classesdeclaration in this passrest_api/v{0..4}/; deprecation carried by schema hook and DEPR ticket only; conforming version is the existing v3HomeViewSet; seetest_v1_home_is_marked_deprecated_in_generated_schema. Deviations recorded: (1) no docstring marker on the superseded view — v1 is frozen; this matches the pattern other FC-0118 PRs record as a deviation; (2) no migration guide — v3 introduces?fields=query filtering and drops Bearer authentication; callers should consult the v3 schema. Pending: entry on [DEPR]: Contentstore and enrollment API versions superseded by FC-0118 #39128 not yet posted; will be posted after approval./api/authoring/v3/home/already exists; no new URL work in this passget_queryset(), no ORM-backed record setCompliance matrix
git diff --name-only origin/mastershows onlycms/lib/spectacular.pyand its test file; hygiene gate PASS/api/contentstore/v1/homeadded toSUPERSEDED_PATHS; exact-path hook setsdeprecated: true;test_v1_home_is_marked_deprecated_in_generated_schemaverifies path key is emitted without trailing slashtest_v1_home_libraries_sibling_is_not_marked_deprecatedtest_a_conforming_sibling_path_is_not_marked_deprecatedtest_both_spellings_of_each_superseded_path_are_listedfails if entry is missingGET /api/authoring/v3/home/is tagged@extend_schema(tags=["openedx-platform-sdk"]); replacement is markedx-internal(BFF surface); see Deprecations sectionBackward compatibility
git diff --name-only origin/master—cms/djangoapps/contentstore/rest_api/v{0..4}/absent from diff.cms/djangoapps/contentstore/rest_api/v1/views/tests/test_home.py— 4HomePageViewTestmethods unchanged.deprecated: trueonGET /api/contentstore/v1/home. No path removed, no response shape changed.SUPERSEDED_PATHSis consumed only by the drf-spectacular post-processing hook; no effect on routing or response handling.Deprecations
GET /api/contentstore/v1/homeis superseded byGET /api/authoring/v3/home/and markeddeprecated: truein the published CMS schema. The superseded view is unchanged: no response header and no deprecation notices in code.Note on replacement availability:
/api/authoring/v3/home/is inINTERNAL_BFF_PATH_PREFIXES(cms/lib/spectacular.py:41) and is markedx-internalin the schema. Schema generators that skipx-internaloperations will not include it. Callers that are not BFF consumers and whose tooling skipsx-internaloperations should coordinate with the team on an external-facing replacement; progress is tracked under #39068.Tracked on the FC-0118 umbrella DEPR ticket #39128, which removes it one named release after the release this ships in.
Authorization
No permission mapping changed. E1 keeps
permission_classes = (IsAuthenticated,).HomePageViewTest(existing, unmodified)HomePageViewTest(existing, unmodified)Gate report
check_code_hygiene.py)git diff --name-only)cms/lib/spectacular.pyandcms/lib/tests/test_spectacular.pyin diffHomePageViewTest(4 tests) unmodifiedCmsMarkSupersededPathsTestmethodsSequencing
This PR and #39238 both write to
cms/lib/spectacular.py. #39238 appends entries toSUPERSEDED_PATHSand its testtest_the_legacy_library_lists_are_marked_and_their_neighbours_are_notlists/api/contentstore/v1/homeas a neighbour expected to remain unmarked. With both merged, that test will fail. Whichever lands second must drop the/api/contentstore/v1/homeneighbour guard from #39238's test and merge the twoSUPERSEDED_PATHSadditions. cc #39238.Follow-ups
orgparam no-op bug: both v1 and v3 document anorgquery parameter that has no effect —get_home_contextnever reads it (v3/views/home.py:92). v1 is frozen; the v3 fix belongs on the replacement, not on the DEPR removal. Tracked separately.GET /api/authoring/v3/home/has the same write-on-GET as v1; fix tracked under [API] Home Page Data #39068.🤖 Generated with Claude Code