Skip to content

fix: metadata endpoints 404 on real keys in production#158

Merged
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
fix/metadata-routes-slashed-keys
Jul 14, 2026
Merged

fix: metadata endpoints 404 on real keys in production#158
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
fix/metadata-routes-slashed-keys

Conversation

@zachdunn

Copy link
Copy Markdown
Member

In plain terms

The new per-file metadata endpoints worked in tests but 404 in production for every real object key. The deployed router doesn't match /:key{.+}/metadata across slashes (percent-encoding the slashes returns 200, which pinpointed the router as the culprit). This blocked the gh backfill.

What it does

  • Moves metadata reads to GET /v1/:ws/files/:key?metadata=1 and writes to PATCH /v1/:ws/files/:key — the key-at-tail shape every other file route already uses and that provably matches in production.
  • Removes the old suffix routes and the now-moot "keys ending in /metadata" shadowing tradeoff + its test.
  • Updates the CLI client, backfill script, and docs. No published CLI ever shipped the old paths (0.7.0 predates the feature; version PR chore: version packages #144 is unmerged), so nothing external breaks.

Test plan

  • api 340 / uploads 281 / mcp 32 / web 81 tests pass; check + typecheck clean
  • Post-merge: verify GET …?metadata=1 and PATCH against prod, then run the gh backfill

… router mismatch)

The deployed worker 404'd on GET/PATCH /v1/:workspace/files/:key{.+}/metadata
for any real (slash-containing) key: Hono's production router doesn't match a
{.+} param followed by a static suffix across slashes, even though the local
vitest harness (which matches raw slashes) passed. Percent-encoding the slashes
into one path segment returned 200, confirming a router mismatch rather than a
storage bug.

Move metadata onto the key-at-tail routes already proven in prod: GET
/v1/:workspace/files/:key{.+}?metadata=1 and a bare PATCH on the same route
(PATCH has no other meaning there). Update the CLI client, the gh.* backfill
script, and route/client tests to the new shapes.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (2)
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed) (1)
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 78504936-3e02-4d0d-bc9c-f11d7c2847bb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/metadata-routes-slashed-keys

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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
uploads-auth e13fedf Commit Preview URL

Branch Preview URL
Jul 14 2026, 01:09 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
uploads-api e13fedf Commit Preview URL

Branch Preview URL
Jul 14 2026, 01:09 AM

@zachdunn Zach Dunn (zachdunn) merged commit 48cdbea into main Jul 14, 2026
5 checks passed
@zachdunn Zach Dunn (zachdunn) deleted the fix/metadata-routes-slashed-keys branch July 14, 2026 01:10
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.

1 participant