🐛 Write session breadcrumb for plugin-created builds#228
Conversation
Plugins that create builds through TestRunner.createBuild now persist .vizzly/session.json for preview auto-detection. Adds service and preview workflow regression tests to prevent this from regressing.
Vizzly - Visual Test ResultsCLI Reporter - 1 change needs review
|
Code ReviewSummaryThis PR successfully addresses the issue where ✅ Strengths
🔍 Observations & Suggestions1. Redundant fallback check (line 112)let writeSession = this.deps.writeSession || defaultWriteSession;This fallback is redundant because if (\!tdd && buildId) {
this.deps.writeSession({
buildId,
branch: options?.branch,
commit: options?.commit,
parallelId: options?.parallelId,
});
}2. Error handling considerationThe
This is not a blocker, just something to consider for future robustness. 3. Test assertion style (minor)In assert.strictEqual(writtenSessions.length, 1);
let session = writtenSessions[0];
assert.strictEqual(session.buildId, 'api-build-123');
assert.strictEqual(session.branch, 'feature/session');
assert.strictEqual(session.commit, 'abc123def456');
assert.strictEqual(session.parallelId, 'parallel-42');This is purely stylistic - the current approach is fine. 4. Documentation opportunityConsider adding a brief comment in // Write session breadcrumb for non-TDD builds so subsequent commands
// (e.g., vizzly preview) can auto-detect this build
if (\!tdd && buildId) {
this.deps.writeSession({This helps future developers understand the "why" at a glance. 🔒 SecurityNo security concerns. The session file is created with mode ⚡ PerformanceNo performance concerns. Writing a small JSON file is negligible overhead. 🧪 TestingThe test plan is solid:
📋 Checklist
🎯 RecommendationApprove with minor suggestions. The fix is correct, well-tested, and follows the codebase patterns. The suggestions above are all optional improvements that don't block merging. The only change I'd recommend before merging is removing the redundant fallback on line 112, but even that's not critical. |

Why
vizzly preview could not auto-detect builds created by plugin commands like vizzly storybook because TestRunner.createBuild did not persist session context.
What Changed
Test Plan
Fixes #227