fix(vcs): use the mapped status when picking the comment image extension - #13771
Conversation
Sites map the `processing` status onto the `building` image, but the extension was still derived from the raw status, so a processing deployment asked for `status-building-light.png`, which does not exist. Only the `.gif` variants are shipped for `building`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
| $extensions = [ | ||
| 'waiting' => 'status-waiting-%s.png', | ||
| 'processing' => 'status-building-%s.gif', | ||
| 'building' => 'status-building-%s.gif', | ||
| 'ready' => 'status-ready-%s.png', | ||
| 'failed' => 'status-failed-%s.png', | ||
| ]; |
There was a problem hiding this comment.
Test Mirrors Production Mapping
This hard-coded status-to-filename table duplicates the mapping in Comment::generateComment() and pins the test to the current asset names and formats. That violates the repository directive to test observable behavior rather than mirror source code or configuration, and it means legitimate asset or mapping changes require synchronized test edits. This repository requirement must be satisfied before merging: inspect the image URLs generated for the relevant statuses—especially processing—and validate those emitted targets without independently prescribing their filenames.
Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/unit/Vcs/CommentTest.php
Line: 140-146
Comment:
**Test Mirrors Production Mapping**
This hard-coded status-to-filename table duplicates the mapping in `Comment::generateComment()` and pins the test to the current asset names and formats. That violates the repository directive to test observable behavior rather than mirror source code or configuration, and it means legitimate asset or mapping changes require synchronized test edits. This repository requirement must be satisfied before merging: inspect the image URLs generated for the relevant statuses—especially `processing`—and validate those emitted targets without independently prescribing their filenames.
**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What does this PR do?
Fixes the broken status image in Git PR comments for Sites while a deployment is
processing:In
Appwrite\Vcs\Comment::generateComment(), the Sites branch mapsprocessingonto thebuildingimage, but derived the file extension from the raw status:So a
processingdeployment requested/images/vcs/status-building-light.png, which we don't ship — only the.gifvariants exist forbuilding. Result: a broken image in every PR comment during the processing phase.The Functions branch a few lines below already keys off
$imageStatusand is unaffected. This PR makes Sites match, and adds a unit test asserting every site status renders a path that actually exists inpublic/images/vcs/.Introduced in 0ac6dec (shipped in 1.8.0), so it affects 1.8.x, 1.9.x, 2.0.x and main.
Test Plan
vendor/bin/phpunit tests/unit/Vcs/CommentTest.php— 5 tests, 30 assertions, passing.testSiteStatusImagesMatchExistingFilesfails onmain(assertsstatus-building-light.gif, gets.png) and passes with the fix.composer lintclean on both touched files.Related PRs and Issues
Checklist
🤖 Generated with Claude Code