fix: accept 24 MP camera photographs - #13
TorstenDittmann wants to merge 1 commit into
Conversation
A 6000x4000 PNG (~28 MiB, 24 MP) was rejected by the 10 MiB upload cap and the 20 megapixel decode ceiling. Raise those limits to 32 MiB and 40 megapixels so common camera photos can be analyzed. Co-authored-by: Torsten Dittmann <TorstenDittmann@users.noreply.github.com>
AutogravityProject ID: Tip SSR frameworks are fully supported with configurable build runtimes |
|
| func TestProductionPhotographFitsLimits(t *testing.T) { | ||
| const ( | ||
| productionPNGBytes = 28_026_017 | ||
| productionWidth = 6000 | ||
| productionHeight = 4000 | ||
| ) | ||
| if maxRequestBytes < productionPNGBytes { | ||
| t.Fatalf("maxRequestBytes = %d, production photograph is %d bytes", maxRequestBytes, productionPNGBytes) | ||
| } | ||
| pixels := int64(productionWidth) * int64(productionHeight) | ||
| if pixels > imageutil.MaxPixels { | ||
| t.Fatalf("MaxPixels = %d, production photograph is %d pixels", imageutil.MaxPixels, pixels) | ||
| } | ||
| } |
There was a problem hiding this comment.
Implementation-Coupled Regression Tests
TestProductionPhotographFitsLimits only compares duplicated dimensions and byte counts with maxRequestBytes and imageutil.MaxPixels. The related header-only test also requires decoding to fail, and the existing valid fixtures are all small. As a result, these tests can remain green even if a valid 6000×4000 image cannot be decoded or accepted by the handler. This violates the repository directive to test observable behavior rather than mirror source configuration. Replace these checks with a valid generated or fixture image that exercises successful decoding or handler acceptance; this repository requirement must be satisfied before merging.
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)
Knowledge Base Used: CLI integration and evaluation
Prompt To Fix With AI
This is a comment left during a code review.
Path: cmd/autogravity/main_test.go
Line: 324-337
Comment:
**Implementation-Coupled Regression Tests**
`TestProductionPhotographFitsLimits` only compares duplicated dimensions and byte counts with `maxRequestBytes` and `imageutil.MaxPixels`. The related header-only test also requires decoding to fail, and the existing valid fixtures are all small. As a result, these tests can remain green even if a valid 6000×4000 image cannot be decoded or accepted by the handler. This violates the repository directive to test observable behavior rather than mirror source configuration. Replace these checks with a valid generated or fixture image that exercises successful decoding or handler acceptance; this repository requirement must be satisfied before merging.
**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))
**Knowledge Base Used:** [CLI integration and evaluation](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/autogravity/-/docs/cli-validation.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Problem
A production 6000×4000 PNG (~28 MiB, 24 megapixels) could not be analyzed. The request was rejected before inference:
/analyzereturned 413.The image itself decodes cleanly; the limits were the only failure.
Change
The original photograph is not redistributed.