UN-2190 [FEAT] Auto-capture execution ID in the API deployment Postman collection#2031
UN-2190 [FEAT] Auto-capture execution ID in the API deployment Postman collection#2031athul-rs wants to merge 3 commits into
Conversation
Add a post-response script to the 'Process document' request that stores message.execution_id into a collection variable, and point the 'Execution status' request's execution_id query param at that variable. Users no longer copy-paste execution IDs between requests (mirrors the LLMWhisperer collection's whisper_hash pattern). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughAdds constants and DTOs for Postman script events and collection variables, extends collection/item models, seeds collection variables via APIBase, and wires a test event on the execute request to capture execution_id for use in status requests. ChangesPostman Execution ID Variable Flow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| backend/api_v2/postman_collection/dto.py | Core change: adds new dataclasses, attaches a try/catch-guarded Postman test script to the execute item, seeds a collection variable with a fallback default, and strips null event blocks in to_dict(). Logic is sound after previous-round fixes. |
| backend/api_v2/serializers.py | Adds execution_id = CharField() to APIExecutionResponseSerializer; additive and non-breaking since ExecutionResponse.execution_id is always a non-null UUID string. |
| backend/api_v2/postman_collection/constants.py | Adds two constants (EXEC_ID_VARIABLE_NAME and STATUS_EXEC_ID_VARIABLE) used to avoid magic strings; straightforward and correct. |
Sequence Diagram
sequenceDiagram
participant User as Postman User
participant Execute as Process Document Request
participant Script as Post-Response Script
participant CollVar as Collection Variable (execution_id)
participant Status as Execution Status Request
participant API as Unstract API
User->>Execute: "POST /api/{name} (multipart file)"
Execute->>API: HTTP POST
API-->>Execute: "{"message": {"execution_id": "uuid", "execution_status": "..."}}"
Execute->>Script: Run test script
Script->>Script: "try { pm.response.json() }"
Script->>CollVar: pm.collectionVariables.set("execution_id", uuid)
User->>Status: "GET /api/{name}?execution_id={{execution_id}}"
Status->>CollVar: "Resolve {{execution_id}} to uuid"
Status->>API: HTTP GET with resolved UUID
API-->>User: Execution status response
Reviews (3): Last reviewed commit: "UN-2190 Expose execution_id in the API e..." | Re-trigger Greptile
…PI deployments - Wrap pm.response.json() in try/catch so error pages (non-JSON) don't surface a Postman test error - Move collection variables behind APIBase.get_collection_variables() so Pipeline collections (no status request) stay variable-free Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The ExecutionResponse DTO carries execution_id but APIExecutionResponseSerializer dropped it, so the Postman capture script (and any API consumer) had to parse it out of status_api. Add it as a first-class response field; the collection script's message.execution_id lookup now matches the real payload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Unstract test resultsPer-group results
Critical paths
|



What
execution_idfrom its response into a collection variable via a post-response script, and the Execution status request reads{{execution_id}}from that variable. No more manual copy-pasting of execution IDs.Why
UN-2190 — minor UX gap: after executing a document asynchronously, users had to copy the execution ID from the response and paste it into the status request's
REPLACE_WITH_EXECUTION_IDplaceholder. The LLMWhisperer Postman collection already does this withwhisper_hash; this applies the same pattern.How
postman_collection/dto.py: newScriptItem/EventItem/VariableItemdataclasses;PostmanItemgets an optionalevent; the execute request carries a post-response script (pm.collectionVariables.set("execution_id", ...), guarded so non-JSON/error responses are ignored); the status URL uses{{execution_id}}(urlencode withsafe="{}"so Postman's braces survive); collection-levelvariableblock added with aREPLACE_WITH_EXECUTION_IDdefault so manual use still works.to_dict()stripsevent: nullfrom items that have no scripts.Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
REPLACE_WITH_EXECUTION_IDdefault — identical to today's placeholder. The script is defensive (checksresponse.message.execution_idexists before setting).Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Notes on Testing
execution_id={{execution_id}}unescaped, and the collection-level variable is present.Screenshots
N/A
Checklist
I have read and understood the Contribution Guidelines.
🤖 Generated with Claude Code