Skip to content

Implement report permalinks for sharing sets of runs #90

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 1, 2025

This PR adds the ability to generate permalinks for sets of runs (reports), allowing users to share multiple cache inspection runs together as requested in the issue.

Key Features

Immutable Report System

  • When a user submits their first URL, a new report is created containing that run
  • Each additional run creates a new report that extends the previous one (immutable design)
  • Reports store only run IDs to minimize data duplication while individual runs remain separately cached

Seamless User Experience

  • Report permalinks are automatically displayed in the UI with copy-to-clipboard functionality
  • Users can share /report/{reportId} URLs to show others their exact set of runs
  • Recipients can view the shared runs and continue adding their own (creating new extended reports)

Example Flow

1. User visits / and submits https://example.com
   → Creates run abc123 and report report789
   → UI shows permalink: /report/report789

2. User submits https://test.com  
   → Creates run def456 and new report report999 containing [abc123, def456]
   → UI updates to show: /report/report999

3. User shares /report/report999 with colleague
   → Colleague sees both runs and can add more

Technical Implementation

New API Endpoints

  • GET /api/reports/{reportId} - Fetches report and all associated runs
  • POST /api/inspect-url - Enhanced to accept optional currentReportId for report chaining

Data Storage

  • Reports stored in Netlify Blobs with same caching strategy as individual runs
  • Uses max-age=31536000, immutable headers for optimal performance
  • Report IDs generated using similar hash-based approach as run IDs

UI Components

  • Enhanced RunDisplay component with permalink display
  • New /report/{reportId} page for viewing shared reports
  • Updated state management in useRunManager to track current report

Type Safety & Testing

  • Added Report and updated ApiRun TypeScript interfaces
  • Comprehensive test coverage including new report functionality tests
  • All existing tests pass with enhanced API parameters

Files Changed

  • New: app/types/report.ts, server/api/reports/[reportId].ts, app/pages/report/[reportId].vue
  • Enhanced: server/db.ts, server/api/inspect-url.post.ts, app/composables/useRunManager.ts, app/components/RunDisplay.vue
  • Tests: Added report-specific tests, updated existing test expectations

The implementation follows the pragmatic approach suggested in the issue comments - reports are immutable, data is duplicated as needed for simplicity, and the user experience is seamless.

Fixes #84.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Generate permalinks for a set of runs Implement report permalinks for sharing sets of runs Jul 2, 2025
@Copilot Copilot AI requested a review from serhalp July 2, 2025 00:02
Copilot finished work on behalf of serhalp July 2, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate permalinks for a set of runs
2 participants