fix(data-products): transition status on request-certify#549
Merged
Conversation
On a successful certification request, a pre-review data product (draft/sandbox) now transitions to 'proposed' so it surfaces in the review/approvals queue. Previously request-certify returned 202 but the product stayed in 'draft' (the documented Draft -> Proposed transition never occurred). The ONT-NEG-008 zero-deliverable guard is preserved and still runs before the transition. Fixes ONT-CUJ-019.
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.
CUJ
ONT-CUJ-019
Observed failure
On the live CUJ regression (ontos-dev),
POST /api/data-products/{id}/request-certify(e.g. requesting a Gold certification level) returned 202 but the product status stayeddraft. A follow-up GET confirmed the documented Draft -> Proposed transition never occurred, so the product never surfaced in the review/approvals queue.Root cause
The
request_certify_productroute insrc/backend/src/routes/data_product_routes.pyvalidated deliverables (the ONT-NEG-008 zero-deliverable guard added in #532), wrote a change-log entry, fired theon_request_certifyworkflow trigger, audited the action, and returned 202 — but it never advanced the product's lifecycle status. PR #532 only added the deliverable guard; it did not implement the state transition. The 202 payload{"status": "requested"}describes the workflow request, not the product lifecycle status, which is a separate dimension and was left untouched.Fix
After the deliverable guard passes, the route now advances a pre-review product (
draft/sandbox) toproposedvia the existingmanager.submit_for_review(...)path (which already validates the transition againstDATA_PRODUCT_TRANSITIONS, persists it, logs the timeline change, notifies subscribers, fireson_status_change, and updates the search index). Products already in-flight keep their current status. The ONT-NEG-008 deliverable guard is unchanged and still runs first, and the 202 response shape is preserved.Testing
test_submit_for_review_transitions_draft_to_proposed(backend unit test) asserting a draft product moves toproposedand the change persists (a GET would now confirmproposed).cd src/backend && hatch -e dev run pytest src/tests/unit/test_data_products_manager.py -q