Files
clean-architecture-frontend…/tests/unit
DongHyeonkaandClaude Opus 5.5 042427c887 refactor(browser-files): share the media-type, token and limit checks (Q-6.2-12)
The exact media-type regex lived in object-url-lease.ts,
browser-file-policy-registry.ts and the download validation;
safeOpaqueValue (vault) and safeGeneratedToken (download) were the same
regex; and five modules each defined their own positive-safe-integer check
(isPositiveByteLimit included). file-policy.ts now exports one copy of each:
EXACT_MEDIA_TYPE, isSafeGeneratedToken, isPositiveSafeInteger.
ObjectUrlLeaseRegistry.create also loses an inner revoke branch that could
never run (it required a non-empty string inside a "not a non-empty string"
guard).

cache-storage/public-cache-policy.ts keeps its private positiveSafeInteger:
adapters may not import another adapter's module.

Verified: a characterization test (unsafe reference -> UNAVAILABLE, 128-char
token accepted, empty object URL -> no revoke, fractional/zero limits and a
wildcard download media type rejected) passes on the code before and after.
Lane gates pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:39:59 +09:00
..