Skip to content

feat: attach screenshots to bug reports - #501

Closed
d855 wants to merge 4 commits into
dev-null-sh:productionfrom
d855:feat/bug-screenshots
Closed

d855 wants to merge 4 commits into
dev-null-sh:productionfrom
d855:feat/bug-screenshots

Conversation

@d855

@d855 d855 commented Oct 18, 2026 •

Copy link
Copy Markdown

Why

Bug reports submitted through /bug cannot include screenshots. Reuse the composer attachment controls and image processing so screenshots appear in the public GitHub issue.

What changed

  • Accept up to three JPEG, PNG, or WebP screenshots, with previews, optional descriptions, paste, drop, and removal. Keep a text description required.
  • Re-encode uploads without metadata and serve them through permanent UUID URLs on the existing private disk. Include screenshot URLs in account exports and remove files on account deletion.
  • Keep the draft after failures. Remove uploads after definite rejection and retain them after ambiguous timeouts or server errors. Serialize image storage with account deletion.

Scope

  • /bug attachments and their storage, export, and deletion lifecycle.
  • /feature remains text-only. No new schema, storage configuration, or GitHub App permissions.
  • Test changes cover only this feature and its lifecycle.

Tradeoffs

The app hosts screenshots because the existing issue-only GitHub App has no attachment upload endpoint. Ambiguous failures retain files until account deletion because GitHub may already have created the issue.

Blast Radius

The composer reuses its current image controls and validation limits. Screenshot retrieval is intentionally public so GitHub can display the images, with fixed UUID paths, WebP responses, and no-store headers.

Verification

  • PostgreSQL feature, deletion, export, and architecture tests passed, 74 tests and 667 assertions. The stale-user regression failed before the fix and passed after it.
  • TypeScript and PHPStan passed. JavaScript tests passed, including all composer tests. Production build, frontend lint, and PHP formatting passed.
  • Browser verification covered attaching a screenshot, editing its description, previewing, submitting, and clearing the draft with simulated GitHub responses. The generated image URL returned WebP bytes anonymously. No live issue was posted during verification.

Fixes #497.

Summary by CodeRabbit

  • New Features
    • Bug reports can include up to three JPEG, PNG, or WebP screenshots, each up to 10 MB and 6,000 pixels per side, with optional descriptions. Screenshots are shared in the public GitHub issue; original image metadata is removed.
    • Screenshot links are included in user exports. Feature requests remain text-only.
  • Bug Fixes
    • Drafts and screenshots are retained when submissions fail or time out. Screenshots are removed when the associated account is deleted.

@brendt

brendt commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Please fix CI and rebase :)

@d855
d855 force-pushed the feat/bug-screenshots branch from ff56f1e to 9c1944b Compare October 22, 2026 12:34
@d855
d855 force-pushed the feat/bug-screenshots branch from 9c1944b to 41df47c Compare October 22, 2026 12:42
@d855 d855 changed the title feat(issues): attach screenshots to bug reports feat: attach screenshots to bug reports Oct 22, 2026
…enshots

# Conflicts:
#	KNOWLEDGE_BASE.md
#	app/Actions/CreateExport.php
#	resources/js/components/commit-composer.tsx
…enshots

# Conflicts:
#	resources/js/components/issue-command.tsx
#	tests/Feature/Controllers/ExportControllerTest.php
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89d42e60-542f-4091-b985-a55a2438134b
Commits

Reviewing files that changed from the base of the PR and between dcf4a6a and c0fce77.

Files selected for processing: 16
  • KNOWLEDGE_BASE.md
  • app/Actions/CreateExport.php
  • app/Actions/CreateIssue.php
  • app/Actions/DeleteUser.php
  • app/Http/Controllers/IssueController.php
  • app/Http/Controllers/IssueImageController.php
  • app/Http/Requests/CreateIssueRequest.php
  • app/Http/Requests/ShowIssueImageRequest.php
  • resources/js/components/commit-composer.tsx
  • resources/js/components/issue-command.tsx
  • routes/web.php
  • tests/Feature/Controllers/ExportControllerTest.php
  • tests/Feature/Controllers/IssueControllerTest.php
  • tests/Feature/Controllers/IssueImageControllerTest.php
  • tests/Unit/Actions/DeleteUserTest.php
  • tests/Unit/ComposerDraft.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

Bug reports can now include up to three JPEG, PNG, or WebP screenshots. The application validates and stores attachments, adds their URLs to GitHub issues, serves the images publicly, and includes the URLs in user exports. Feature requests remain text-only.

Changes: Bug report screenshot flow

Layer / File(s) Summary
Composer attachment and command behavior
resources/js/components/commit-composer.tsx, resources/js/components/issue-command.tsx, tests/Unit/ComposerDraft.test.tsx
The composer enables image attachments for eligible bug reports and sends images with descriptions. Feature requests remain text-only. Issue submission requires a body that meets the minimum length, and failed submissions retain the draft attachments.
Validate and attach screenshots to bug reports
app/Http/Requests/CreateIssueRequest.php, app/Http/Controllers/IssueController.php, app/Actions/CreateIssue.php, tests/Feature/Controllers/IssueControllerTest.php
The request validates image attachments and provides image accessors. Issue creation stores images, adds image tags to the GitHub issue body, and removes stored images for client-error responses. Tests cover validation and failure responses.
Serve, export, and remove screenshots
routes/web.php, app/Http/Requests/ShowIssueImageRequest.php, app/Http/Controllers/IssueImageController.php, app/Actions/CreateExport.php, app/Actions/DeleteUser.php, tests/Feature/Controllers/IssueImageControllerTest.php, tests/Feature/Controllers/ExportControllerTest.php, tests/Unit/Actions/DeleteUserTest.php, KNOWLEDGE_BASE.md
A public route streams stored images with security headers. User exports now use schema version 3 and include that user’s screenshot URLs. User deletion removes the issue-image directory.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Composer
  participant IssueController
  participant CreateIssue
  participant Storage
  participant GitHub
  participant Browser
  Composer->>IssueController: Submit bug report with images and descriptions
  IssueController->>CreateIssue: Pass validated images and descriptions
  CreateIssue->>Storage: Store image files
  CreateIssue->>GitHub: Send issue body with image URLs
  Browser->>IssueController: Request issue-image URL
  IssueController->>Storage: Stream stored WebP image
Loading

Possibly related issues

  • Issue #982: The PR adds image attachments to /bug reports, addressing the reported inability to include an image in a bug report.
  • Issue #423: The PR adds screenshots to GitHub issues through the bug-report path. The issue describes a composer and terminal flow, so the PR may not cover all cases.

Suggested reviewers: nunomaduro

Merge Risk: Minimal · up to c0fce

The screenshot submission, retrieval, export, and deletion paths have no established issue requiring a change before merge.

Security architecture risk: Moderate · up to c0fce

Screenshots are validated and re-encoded before publication, and upload ownership is checked against account deletion. However, failed or interrupted file cleanup can leave screenshots publicly accessible after the account is deleted.

Retained concerns

  • Medium · security · inferred: Account deletion commits before screenshot-directory removal, and the deletion result is ignored. If cleanup fails or execution stops after commit, anyone retaining a screenshot URL can continue retrieving the surviving file because authorization checks only filesystem existence, not whether its reporter still exists. The existing post-commit cleanup pattern therefore gains a new privacy consequence through this route. Normal cleanup and UUID-constrained URLs limit exposure, but do not enforce revocation after account deletion.
Security review details

Security Blast Radius

  • inferred — An authenticated reporter can store screenshots only under their own account identifier through this flow. Public readers need no account or additional privilege when holding a valid screenshot URL. The retained concern affects surviving screenshots at known URLs, not arbitrary paths or demonstrated access to other private-disk content.

Security Findings and Attack Paths

  • inferred — A reader can retain a published screenshot URL, then continue requesting it after account deletion if directory cleanup fails or is interrupted. The new endpoint still permits access whenever the file survives. Unlike base commit-image authorization, it does not consult database-backed ownership or lifecycle state. This is a source-supported failure path, not a reproduced production incident.

Trust Boundaries and Controls

  • observed — Anonymous screenshot publication is intentional. UUID-only route parameters constrain path construction, and responses specify WebP, sandbox CSP, nosniff, and no-store. Submission requires authentication and has a ten-per-minute route throttle plus a daily successful-issue limit. These controls reduce input, enumeration, and request-volume risks, but do not revoke an already-known URL.

Resilience and Maintainability Implications

  • observed — The reporter row lock and existence recheck prevent storage from proceeding after account deletion has won the race. Image processing finishes before storage begins and registers rollback cleanup. Tests cover normal per-user deletion and rejection-versus-timeout retention, but the inspected tests do not establish recovery from failed or interrupted account-deletion cleanup.

Hardening Proposals

  • proposed — Separate public-access revocation from physical deletion: require live reporter or durable revocation state when serving screenshots, and persist observable, retryable cleanup work. Validate that retained URLs become unavailable even when filesystem deletion fails or execution stops after account removal.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 15 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat: attach screenshots to bug reports" states the main change. The PR adds up to three JPEG, PNG, or WebP screenshots to /bug reports, with previews, descriptions, storage, export, and de…
Linked Issues check Passed Issue #497 asks for an option to attach a screenshot when reporting a bug with /bug. It has no other acceptance criteria. At head, CreateIssueRequest::rules() accepts images and `image_descripti…
Out of Scope Changes check Passed The changes support the /bug screenshot feature and its storage lifecycle, as stated in the PR description and linked issue #497. CreateExport adds an issue_images list and bumps the export sche…
Full details: Title check

Explanation

The title "feat: attach screenshots to bug reports" states the main change. The PR adds up to three JPEG, PNG, or WebP screenshots to /bug reports, with previews, descriptions, storage, export, and deletion handling. The title is short, specific, and uses a conventional commit prefix. It omits the storage and export details, which is acceptable for a title.

Full details: Linked Issues check

Explanation

Issue #497 asks for an option to attach a screenshot when reporting a bug with /bug. It has no other acceptance criteria. At head, CreateIssueRequest::rules() accepts images and image_descriptions from CreateCommitRequest::attachmentRules(). It prohibits both fields when command is not /bug. CreateIssue::handle() stores the images through CreateImageFiles and prefixes the GitHub issue body with <img> tags. Each tag uses a route to issue-image.show, defined in routes/web.php with UUID parameters. The composer change enables the image picker for bug commands only. The PR summary also reports feature, export, deletion, and browser tests. I did not run those tests. This assessment relies on the source evidence above. The requirement is met.

Full details: Out of Scope Changes check

Explanation

The changes support the /bug screenshot feature and its storage lifecycle, as stated in the PR description and linked issue #497. CreateExport adds an issue_images list and bumps the export schema to version 3, which exposes screenshot URLs to the user. DeleteUser removes the issue-images/{user id} directory, which covers deletion. IssueImageController, ShowIssueImageRequest, and the routes/web.php route serve the public screenshot URLs. CreateIssue locks the reporter row while it creates files. commit-composer.tsx and issue-command.tsx reuse the composer image controls for bug reports and keep feature reports text-only. The matching tests cover these paths. The summary shows no unrelated change, and the PR description states that no schema, storage configuration, or GitHub App permission changes were made.

Full details: Docstring Coverage

Explanation

Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 15 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

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.

When reporting a bug using /bug, it would be great to have the option to attach a screenshot.

2 participants