✨ Require --public-link flag for private project previews#198
Conversation
This comment has been minimized.
This comment has been minimized.
Code ReviewOverviewThis PR adds the Positive Aspects
Issues & Concerns1. Missing Test Coverage (Critical)The new functionality has zero test coverage. The test file
Recommendation: Add comprehensive test coverage before merging. The test file already has good patterns to follow (see lines 98-122 for API token validation tests). 2. Redundant API Call (Performance)The code creates a new API client and calls
Recommendation: Refactor to reuse the build data or consolidate API client creation. For example: // Fetch build info once and reuse
let client = createApiClient({...});
let build = await getBuild(client, buildId);
// Check visibility
if (build.project && !build.project.isPublic && !options.publicLink) {
// ... error handling
}
// Later, reuse the same client
let result = await uploadPreviewZip(client, buildId, zipBuffer);3. Unreachable Return Statement (Code Quality)Line 466 has a exit(1);
return { success: false, reason: 'private-project-no-flag' };The Recommendation: Either remove the unreachable return or add a comment explaining it's for testing. Consider if there's a better pattern. 4. Potential Missing Error HandlingThe
While there's a global try-catch (line 705), failing here would show a generic "Preview upload failed" error instead of something specific like "Failed to verify project visibility" or "Build not found". Recommendation: Add specific error handling: let build;
try {
build = await getBuild(client, buildId);
} catch (error) {
if (error.status === 404) {
output.error(`Build not found: ${buildId}`);
} else {
output.error('Failed to verify project visibility', error);
}
exit(1);
return { success: false, reason: 'build-fetch-failed' };
}5. API Response Shape AssumptionThe code assumes if (build.project && !build.project.isPublic && !options.publicLink)If the API response changes or Recommendation: Add defensive checks: let isPrivate = build.project && build.project.isPublic === false;
if (isPrivate && !options.publicLink) {
// ... error handling
}6. Timing of CheckThe visibility check happens after file scanning (lines 519-537), which means:
Recommendation: Move the visibility check earlier, right after build ID resolution (after line 439), to fail fast. Minor Observations
Security ConsiderationsNo security vulnerabilities introduced. The change actually improves security posture by ensuring informed consent. Test Plan VerificationThe PR description includes a test plan, but it should be automated:
RecommendationRequest Changes - This needs test coverage before merging. The core logic is sound, but without tests, future refactoring could break this security feature. Priority fixes:
Nice to have: |
2a08901 to
fc33227
Compare
This comment has been minimized.
This comment has been minimized.
Private projects now require the --public-link flag when uploading previews. This ensures users explicitly acknowledge that preview URLs grant access to anyone with the link (until expiration). Without the flag, private project previews will fail with a clear error message explaining the access model and how to proceed.
fc33227 to
a11c31b
Compare
Vizzly - Visual Test ResultsCLI Reporter - 5 changes need review
Changes needing review (5)filter-failed-only · Firefox · 1920×1080 · 0.2% diff bulk-accept-dialog · Firefox · 1920×1080 · 10.3% diff viewer-overlay-mode · Firefox · 1920×1080 · 5.8% diff fullscreen-viewer · Firefox · 375×667 · 79.1% diff bulk-accept-dialog · Firefox · 375×667 · 91.2% diff CLI TUI - 1 change needs review
|






Summary
--public-linkflag to thevizzly previewcommandWhy
Preview URLs for private projects grant access to anyone with the link until expiration. This change ensures users explicitly acknowledge this access model before uploading.
Test plan
vizzly preview ./diston a private project → should fail with clear errorvizzly preview ./dist --public-linkon a private project → should workvizzly preview ./diston a public project → should work (no flag needed)