[Backend APIs] Implement Summary Suggestion GET/PATCH CRUD API with OCC Version Token Enforcement - #6672
Open
jcscottiii wants to merge 1 commit into
Conversation
jcscottiii
force-pushed
the
jcscottiii/pr8-summary-suggestions-crud
branch
5 times, most recently
from
July 28, 2026 17:10
e7fe33c to
2a08ba6
Compare
…CC Version Token Enforcement ## Summary Implements `GET` and `PATCH /api/v0/summary-suggestions/<int:feature_id>` for retrieving and updating AI summary suggestions, progress steps timelines, and editorial access levels. Enforces Optimistic Concurrency Control (OCC) via `version_token` during `PATCH` operations to prevent concurrent edit overwrites. Validates string status updates against `SummarySuggestionStatus` enums and checks feature edit permissions. ## Key Changes - **Controller (`api/summary_suggestion_api.py`)**: Adds `SummarySuggestionAPI` handling `do_get` and `do_patch`. Returns `access_level` (`CAN_EDIT` vs `READ_ONLY`) and orders progress steps timeline by `start_timestamp`. Validates OCC `version_token` matching (HTTP 409 Conflict on mismatch) and assigns updated UTC timestamps. - **Route (`main.py`)**: Registers `GET` and `PATCH /api/v0/summary-suggestions/<int:feature_id>`. - **Testing (`api/summary_suggestion_api_test.py`)**: Added `SummarySuggestionAPITest` suite verifying read-only and editable GET access, status updates, OCC version token conflict handling (HTTP 409), invalid enum validation (HTTP 400), and BOLA permission checks (HTTP 403). TAG=agy CONV=86f63625-bdb5-4d50-ac8d-2f8ca5128ca9
jcscottiii
force-pushed
the
jcscottiii/pr8-summary-suggestions-crud
branch
from
July 28, 2026 17:14
2a08ba6 to
2d36511
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Backend APIs] Implement Summary Suggestion GET/PATCH CRUD API with OCC Version Token Enforcement
Summary
Implements
GETandPATCH /api/v0/summary-suggestions/<int:feature_id>for retrieving and updating AI summary suggestions, progress steps timelines, and editorial access levels.Enforces Optimistic Concurrency Control (OCC) via
version_tokenduringPATCHoperations to prevent concurrent edit overwrites. Validates string status updates againstSummarySuggestionStatusenums and checks feature edit permissions.Key Changes
api/summary_suggestion_api.py): AddsSummarySuggestionAPIhandlingdo_getanddo_patch. Leverages repository helpersself.get_specified_feature(**kwargs)for feature retrieval & view authorization, andself.get_int_paramfor OCCversion_tokenextraction. Returns dynamically computedaccess_level(CAN_EDITvsREAD_ONLY, evaluated per request based on user permissions rather than stored in Datastore) and orders progress steps timeline bystart_timestamp. Validates OCCversion_tokenmatching (HTTP 409 Conflict on mismatch) and assigns updated UTC timestamps.api/converters.py): DefinesOpenAPISummarySuggestionAccessLevelenum andSUMMARY_SUGGESTION_ACCESS_LEVEL_TO_APImapping proxy (converting boolean edit permissions directly to API response strings), verified via bidirectional OpenAPI schema parity unit tests.main.py): RegistersGETandPATCH /api/v0/summary-suggestions/<int:feature_id>.api/summary_suggestion_api_test.py,api/converters_test.py): AddedSummarySuggestionAPITestsuite verifying read-only and editable GET access, status updates, OCC version token conflict handling (HTTP 409), invalid enum validation (HTTP 400), and BOLA permission checks (HTTP 403) isolated via@mock.patch.TAG=agy
CONV=86f63625-bdb5-4d50-ac8d-2f8ca5128ca9