-
Notifications
You must be signed in to change notification settings - Fork 152
feat(workflow): connect workflow visualizer with live data #4153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(workflow): connect workflow visualizer with live data #4153
Conversation
PR Review: feat(workflow): connect workflow visualizer with live dataSummaryThis PR connects the workflow visualizer to live data from the actor inspector, replacing mock data with real workflow history. The implementation adds new query infrastructure, data transformation logic, and UI improvements. ✅ Positives
🐛 Potential Issues1. Missing input/output handling in transformationLocation: The // Current code returns:
return {
workflowId: entries[0]?.id ?? "unknown",
state,
nameRegistry: [...nameRegistry],
history,
// Missing: input and output
};Impact: Input/output visualization features may not work correctly. 2. Unsafe array accessLocation: workflowId: entries[0]?.id ?? "unknown",This assumes 3. Inconsistent state derivation logicLocation: The state derivation has a subtle issue: let state: WorkflowHistory["state"] = "pending";
if (allCompleted) {
state = "completed";
} else if (hasFailed) {
state = "failed";
} else if (hasRunning) {
state = "running";
} else if (hasPending && history.some((h) => h.entry.status === "completed")) {
state = "running";
}The last condition checks if there are both pending and completed entries to mark as "running", but this seems arbitrary. This doesn't handle other workflow states defined in the types: Recommendation: Check if the transport data includes an overall workflow state field that should be used directly instead of deriving it. 4. Type casting without validationLocation: originalType: kind.val.originalType as EntryKindType,This casts to Fix: Add validation: const validTypes: EntryKindType[] = ["step", "loop", "sleep", "message", "rollback_checkpoint", "join", "race", "removed"];
const originalType = validTypes.includes(kind.val.originalType as EntryKindType)
? kind.val.originalType as EntryKindType
: "removed";5. Error swallowing in transformationLocation: } catch (error) {
console.warn("Failed to decode workflow history", error);
return { history: null, isEnabled: true };
}Errors are logged but swallowed. The UI will show "No workflow history available yet" which doesn't indicate an error occurred. Consider differentiating between "no data" and "error decoding data" states. 6. Query configuration concernsLocation: Both workflow queries use
The 7. Potential memory leak in wheel event listenerLocation: The wheel event listener is added with Fix: Use functional setState to make the callback stable: const handleWheel = useCallback((e: WheelEvent) => {
e.preventDefault();
if (e.ctrlKey || e.metaKey) {
// ... zoom logic using setTransform(prev => ...)
} else {
setTransform((prev) => ({
...prev,
x: prev.x - e.deltaX,
y: prev.y - e.deltaY,
}));
}
}, []); // Now stable8. Long import lineLocation: import type { WorkflowHistory, EntryKind, EntryStatus, Location, SleepState, BranchStatus, BranchStatusType, EntryKindType } from "./workflow-types";This 183-character import line is hard to read. Should be split across multiple lines per the project's style guidelines. 🔒 Security Considerations
⚡ Performance Considerations
📝 Code QualityFormattingMost formatting changes appear to be from Prettier/auto-formatting. The code is generally well-formatted after the changes. Missing TestsThis is a significant feature addition but no test files are included. Consider adding:
DocumentationThe transformation function has a good JSDoc comment, but consider adding:
🎯 Recommendations
✨ Overall AssessmentThis is a solid implementation that successfully connects the workflow visualizer to live data. The code is well-structured with good separation of concerns. The main concerns are around edge cases, state handling completeness, and testing coverage. The issues identified are mostly minor and can be addressed in follow-up PRs if needed. Recommendation: Approve with suggestions for follow-up improvements, especially around testing and the state derivation logic. |
Graphite Automations"Test" took an action on this PR • (02/06/26)1 assignee was added to this PR based on Kacper Wojciechowski's automation. |
b392e46 to
f4bf14b
Compare
3065b04 to
c8b012a
Compare
f4bf14b to
b5d19c7
Compare
Merge activity
|
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes
c8b012a to
cef229d
Compare
b5d19c7 to
061bcbc
Compare
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: