3.6 KiB
3.6 KiB
Task Spec: M-SHORTURL-01..04 — Frozen V1, Additive V2 Local/Durable/Remote Providers & V1 Adapter
- Branch:
feat/roadmap-p2-wave9(baselinemainat3e25405). - Roadmap authority:
docs/roadmap/modules/ShortUrl.md(M-SHORTURL-01..M-SHORTURL-04),ARCHITECTURE.mdC-02..C-05, C-09, C-13. - Error domain:
Void::Result::kShortUrlErrorDomain = 28.
Scope & Deliverables
- Frozen
V1Contract (include/Void/ShortUrl/ShortUrl.hpp,docs/short-url.md):- Zero changes to
Void::ShortUrl::V1layout, enum ordinals, virtual table order, ordocs/short-url.md. - Keep
ShortUrlmodule's internal dependencies lightweight (Service Time), with zeroStorage,Net, orSecuritydependencies.
- Zero changes to
- Additive
Void::ShortUrl::V2Core & Local Provider (include/Void/ShortUrl/V2.hpp):V2ErrorCodemapped viakShortUrlErrorDomain = 28(InvalidUrl,InvalidKey,InvalidExpiry,Conflict,NotFound,Expired,Revoked,Unsupported,RateLimited,QuotaExceeded,IdentityExpired,StorageError,UnknownOutcome,ProviderError,Timeout,Unavailable).CreateLink,ShortenOptions(operation_id,idempotency_ttl = 24h),Link,LinkRecord,LinkState::{Active, Revoked},LocalProviderLimits(max_url_bytes = 8192,max_key_bytes = 64,generated_key_length = 16,max_collision_retries = 8,max_retained_identities = 10000,max_entries = 100000,max_concurrent_ops = 128).- Strict target URL validation (absolute
http/https, no userinfo, no control chars, <= 8 KiB, optional host deny predicate) and custom key validation (1..64[A-Za-z0-9_-], case-sensitive, reserved route rejection). - Abstract
LinkRepositoryPort+RandomBytesPort, explicitly nondurableInMemoryLinkRepository(for unit/semantics tests), rejection-sampled base62 key generation, atomic conditional insert + idempotency record, civil expiry via injectedVoid::Time::CivilClock, tombstonerevoke()(never reusing revoked keys),V1AdapterimplementingV1::IShortenerwithout modifyingV1.
- Durable Storage Provider (
src/ShortUrlStorage/module.cmake,include/Void/ShortUrlStorage/StorageRepository.hpp,src/ShortUrlStorage/StorageRepository.cpp):- Separate module (
INTERNAL_DEPS ShortUrl Storage Security) keepingShortUrlfree ofStorage/libsodium. StorageLinkRepositorybacked byVoid::Storage::EngineconditionalWriteBatch(versioned records, atomic link + idempotency commit, tombstone persistence, byte quota enforcement, full recovery across engine reopen) +SecurityRandomBytesPortbacked byVoid::Security::random_bytes.
- Separate module (
- Remote Provider SPI (
src/ShortUrlRemote/module.cmake,include/Void/ShortUrlRemote/RemoteProvider.hpp,src/ShortUrlRemote/RemoteProvider.cpp):- Separate module (
INTERNAL_DEPS ShortUrl Net Data) keepingShortUrlfree ofNet/Boost/OpenSSL. RemoteCapabilities,RemoteProviderOptions(explicit origin, secureHttpClient, max 1 MiB response, 10s deadline),RemoteProviderchecking capability flags before network mutation, preservingRetry-Afterand classifying transport failures after send asUnknownOutcomewithout blind replay, plus loopback fixture tests.
- Separate module (
- Installed Consumers:
tests/package/ShortUrlOnly/(ShortUrlwith zero external packages) +ShortUrlProvidersintests/package/InstalledComponents.cmake.
Verification
- Standalone
ShortUrl;ShortUrlStorage;ShortUrlRemote;Testing(-DVOID_WARNINGS_AS_ERRORS=ON),ctest(ShortUrlOnly,ShortUrlProviders), fullRelWithDebInfo, DebugASan+UBSan, DebugTSan.