Skip to content

fix(cli): use org-scoped CAS URL for theme file uploads#16682

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1782316499-fix-theme-upload-cas-url
Open

fix(cli): use org-scoped CAS URL for theme file uploads#16682
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1782316499-fix-theme-upload-cas-url

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

Fix fern docs theme upload failing with HTTP 422 for all theme asset files.

Changes Made

Bug: ThemeConfigProcessor.uploadToCas built the CAS URL as /v2/registry/content/{hash}?orgId={orgId}. FDR's wildcard route only parses path segments — the orgId query param was silently ignored. The server fell back to the deprecated 1-segment path, resolved orgId from the token, and stored the file under a different org-scoped S3 key. When bind ran with the actual orgId, the key didn't match → 422.

Fix: One-line change in ThemeConfigProcessor.ts — use /v2/registry/content/{orgId}/{hash} (org-scoped path) instead of passing orgId as a query param.

  • packages/cli/cli/src/commands/docs-theme/ThemeConfigProcessor.ts: Fix CAS URL to use org-scoped path format
  • packages/cli/cli/src/__test__/themeConfigProcessor.test.ts: Add 6 unit tests covering:
    • CAS URL uses org-scoped path (not query param) — prevents regression
    • Same orgId in both CAS and bind URLs
    • URL-encoding of special characters in orgId
    • S3 upload triggered when CAS returns upload_required
    • S3 upload skipped when CAS returns already_exists
    • Bind request body contains correct hash and contentType
  • packages/cli/cli/changes/unreleased/fix-theme-upload-cas-url.yml: Changelog entry

Testing

  • Unit tests added/updated (6 new tests, all 570 passing)
  • Lint passing (pnpm run check — 0 errors)

Link to Devin session: https://app.devin.ai/sessions/1cb7e302e7464477ae7e5e7f9c0e3599


Open in Devin Review

Co-Authored-By: will.kendall@buildwithfern.com <wpk235@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

…essor

Co-Authored-By: will.kendall@buildwithfern.com <wpk235@gmail.com>
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.

0 participants