shaft-intellij: unwrap capture_status/capture_api_status union before reading fields#3954
Merged
Merged
Conversation
… reading fields GuidedWorkflowPanel's background status poller (applyStatusPoll and its helpers) read state/active/eventCount/steps directly off the top-level capture_status/capture_api_status JSON. Since #3881, CaptureService#status()/ apiStatus() return a union (McpCaptureUnionStatus/McpCaptureApiUnionStatus) with the real status nested under webStatus/playwrightStatus/mobileStatus -- GuidedWorkflowLiveE2ETest's webStatus()/mobileStatus() helpers already proved this wire shape against a live server. The poller never unwrapped it, so an active recording never rendered as active in the Guided workflow status strip for any backend. Fix: unwrap the union to its populated engine section once, right after parsing the poll response, before any field is read (mirrors the E2E test's unwrap helpers). Added a regression test that feeds applyStatusPoll a real union-shaped fixture and asserts on the rendered status text. Closes #3949 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NDQpYzvnTbDPYwqDwHQoRz
MohabMohie
enabled auto-merge (squash)
July 21, 2026 14:14
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Complexity | 1 medium |
🟢 Metrics 0 complexity
Metric Results Complexity 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This was referenced Jul 21, 2026
MohabMohie
added a commit
that referenced
this pull request
Jul 21, 2026
…agnostic (#3955) (#3975) shaft-intellij: unwrap capture_status union before reading state/outputPath (#3955) ShaftAssistantPanel#showCaptureStartDiagnostic read state/outputPath directly off the raw capture_status/capture_api_status union response (McpCaptureUnionStatus/McpCaptureApiUnionStatus, design doc amendment A3, #3881) instead of the populated webStatus/playwrightStatus/ mobileStatus section, so the diagnostic always saw them as absent or default -- the same bug GuidedWorkflowPanel had before PR #3954. Extract unwrapCaptureStatus into the AssistantMarkdown shared utility (already used by both panels for JSON/markdown helpers) and apply it in showCaptureStartDiagnostic before reading state/outputPath. Claude-Session: https://claude.ai/code/session_01NDQpYzvnTbDPYwqDwHQoRz Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
GuidedWorkflowPanel's background status poller (applyStatusPoll,isRecorderActive,activeStatusText,countText,renderStepsFromStatus/parseSteps) readstate/active/eventCount/stepsoff the top level of the polledcapture_status/capture_api_statusJSON.CaptureService#status()/apiStatus()(shaft-mcp/src/main/java/com/shaft/mcp/CaptureService.java:319-326,:553-558) return a union (McpCaptureUnionStatus/McpCaptureApiUnionStatus) with the real status nested underwebStatus/playwrightStatus/mobileStatus—GuidedWorkflowLiveE2ETest'swebStatus()/mobileStatus()helpers (GuidedWorkflowLiveE2ETest.java:369-382) already prove this wire shape against a live server.applyStatusPolla real union-shaped fixture and watching it fail (status stayed "Recorder idle." instead of rendering "Recording · 2 steps...").GuidedWorkflowPanel#unwrapCaptureStatus, which resolves the union down to whichever ofwebStatus/playwrightStatus/mobileStatusis populated (the union guarantees exactly one is), applied once inapplyStatusPollright after parsing the poll response so every downstream reader sees the correct nested object.Adjacent finding (not fixed here, per issue #3949's scope boundary)
ShaftAssistantPanel#showCaptureStartDiagnostic(ShaftAssistantPanel.java:3934-3955) has the identical bug: it readsstring(statusJson, "state", "")andstring(statusJson, "outputPath", expectedOutputPath)directly off the rawcapture_statusunion without unwrappingwebStatus. Confirmed by reading the code — not fixed here becauseShaftAssistantPanel.javais being actively modified by a concurrent sequential PR chain (#3918-#3922) in the same session; touching it would cause merge conflicts. This should become its own follow-up issue.Test plan
GuidedWorkflowPanelTest#applyStatusPollUnwrapsTheActiveEngineSectionFromTheUnionResponse— watched RED (status stuck at "Recorder idle." against a union fixture), then GREEN after the fix../gradlew test --tests "com.shaft.intellij.ui.GuidedWorkflowPanelTest"— 22/22 tests pass.shaft-intellijmodule./gradlew test— BUILD SUCCESSFUL, no regressions from wideningpollingActive/applyStatusPollvisibility to package-private test seams.Closes #3949
https://claude.ai/code/session_01NDQpYzvnTbDPYwqDwHQoRz