Repository navigation
feat: log shared links to an optional kv namespace - #11
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… bound kv Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…24 bytes Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Verify runs test/shared-links-logged-to-kv-at-conversion.test.ts and the scope gains src/shared-link-log.ts. Red-first mutation check, each applied alone and restored: - delete expirationTtl: red (2 tests) - delete put try/catch: red (5) - await write on response path: red (4, including the never-settling put) - log from share redirect: red (1) - config condition always true: red (3) - config condition truthy: red (1) - log cleaned.href: red (2) - .length for byte size: red (1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and the log convert serializes host, path and search once, and logSharedLink takes that string, so the logged URL cannot drift from the one the response shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
29e733f to
cb59ea1
Compare
✅ Action performedReview finished.
|
Adds an opt-in log of the links produced by
GET /?url=, so a deployment's owner can look up links they shared later.Behaviour
cloudflare.config.tsdeclares the KV bindingSHARED_LINKSonly when the build variableLOG_SHARED_LINKSis exactly1. Without it the config has no storage binding, and Deploy-button copies still need no setup.raw=1. Eachputruns inctx.waitUntilwith a 90-dayexpirationTtl. The key starts with an ISO timestamp so that a KV list returns records in time order. The value is the cleaned URL. The metadata holds{ url, at, raw? }, and dropsurlwhen the metadata would exceed 1,024 bytes.putthrows or rejects, and whenputnever settles.GET /<host>/<path>),/media/and failed conversions write nothing.Specs
docs/spec/shared-links-logged-to-kv-at-conversion.md. Itsverifyrunstest/shared-links-logged-to-kv-at-conversion.test.ts. Each of eight deliberate mutations turned at least one test red, and the commit message for 9437913 lists them.docs/spec/free-plan-bindings-only.mdgains one exception for this opt-in KV. The default config still declares no storage binding, andtest/config.test.tsis unchanged.Verification
bun run checkpasses on every commit: 576 tests, with typecheck clean.PROBE_VAR=1andNODE_SEES=1.Out of scope
cloudflare.config.tshard-codesname, although Workers Builds passesWRANGLER_CI_OVERRIDE_NAME. I'll fix this separately.🤖 Generated with Claude Code
Summary by CodeRabbit