Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preserve compressed asset content types #11768

ClosedPastequee(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/11768/headopened View on GitHub

HTML and CSS workspace assets larger than the compression threshold lost their Content-Type header. Browsers then treated HTML as plain text and rejected sibling styles under nosniff.

Carry the inferred MIME type and content length on the file response body so Effect compression preserves the response metadata. Add an HTTP regression test that exercises a compressed HTML asset through the real middleware.

Verified with:

  • vp test run apps/server/src/http.test.ts apps/server/src/assets/AssetAccess.test.ts
  • vp lint apps/server/src/http.ts apps/server/src/http.test.ts --report-unused-disable-directives
  • vp fmt --check apps/server/src/http.ts apps/server/src/http.test.ts
  • Browser verification with a 4.8 KB HTML file and 4.6 KB linked CSS file, both Brotli-compressed with correct MIME types

The server package typecheck still reports existing errors in HostPowerMonitor.ts and NativeTelemetryClient.ts, unrelated to this change.

Model: GPT-5.6-Sol. Harness: Codex in T3 Code.

Summary by CodeRabbit

  • Bug Fixes

    • Preserved the correct content type and content length when serving compressed assets.
    • Ensured compressed asset previews continue to return the expected response body and MIME type.
  • Tests

    • Added coverage verifying asset responses retain correct headers and content when compression is enabled.
    1. Bugbot is paused — on-demand spend limit reached

      Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

      A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at b0cf29d

      Macroscope's review found this PR approvable — This is a narrowly scoped server fix that preserves existing MIME metadata through compression, with an integration test covering compressed HTML responses and body integrity. The production impact is localized to file-backed asset delivery and introduces no configuration, schema, or deployment changes.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Review Change StackReview Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 79d5ff5e-987c-4042-aaa1-6eb516b4f005

      📥 Commits

      Reviewing files that changed from the base of the PR and between 33118d9ab263904e4180b3bf2cbf0a36fe0695e2 and b0cf29d74dde43a4cc0578fc71faf3a392005090.

      📒 Files selected for processing (2)
      • apps/server/src/http.test.ts
      • apps/server/src/http.ts

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


      📝 Walkthrough

      Walkthrough

      assetFileResponse now preserves inferred MIME types when compression middleware processes raw file bodies. A new integration test verifies gzip encoding, HTML content type, and unchanged response content.

      Changes

      Asset compression

      Layer / File(s)Summary
      Preserve asset content types
      apps/server/src/http.ts
      assetFileResponse rebuilds raw response bodies with an inferred content type and the existing content length.
      Validate compressed asset responses
      apps/server/src/http.test.ts
      The test serves an HTML file through HttpMiddleware.compression() and verifies gzip encoding, text/html; charset=utf-8, and the original body.

      Priority: ⬇️ Low

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: chrisdeeming

      Merge Risk: ⚪ Minimal · up to b0cf2

      The asset response change preserves MIME metadata through compression without retaining an invalid compressed-response length. The change is ready to merge.

      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the server fix: preserving content types for compressed assets.
      Description check✅ PassedThe description clearly explains what changed, why it changed, the regression test, verification steps, and unrelated typecheck failures. It does not use the template headings or checklist, but the re…
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Comment `@coderabbitai help` to get the list of available commands.
    5. juliusmarminge added labelsmacroscope-review

    6. Note

      Written by claude-opus-5-5 on behalf of Maria

      Hi! We are cleaning up open PRs, and this one appears to have been created with an older model (gpt-5.6-sol). If this change is really important, we recommend rebuilding the PR with a newer model if possible.

    7. maria-rcks closed this

Sign in to join this conversation.