Skip to content

feat(redis): add key hash-tag convention#355

Merged
KurodaKayn merged 10 commits into
mainfrom
feat/346-redis-hash-tags
Jun 19, 2026
Merged

feat(redis): add key hash-tag convention#355
KurodaKayn merged 10 commits into
mainfrom
feat/346-redis-hash-tags

Conversation

@KurodaKayn

@KurodaKayn KurodaKayn commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Feature Description

  • Defines the Redis Cluster hash-tag rules and records audit-item strategies for known multi-key groups.
  • Applies approved tags to auth verification, browser session/stream token, publish lock, project-list cache, and media-asset cache key families.
  • Preserves rolling-deploy compatibility for renamed TTL-scoped keys: auth verification/resend keys, browser active/live/token keys, and publish locks.
  • Updates Redis inventory patterns and docs so tagged keys are recognized operationally.

Implementation Approach

  • Added backend/internal/pkg/rediskey for normalized key parts, hash-tag creation, and same-tag checks.
  • Dual-write/read/delete legacy key shapes during the migration windows for auth codes, browser sessions, and publish locks.
  • Kept quota, stream-gate, cleanup, and other conflicting/global groups documented where tagging would change semantics.
  • Added package regression tests plus Redis inventory fixture coverage for the implemented tagged groups and legacy-key fallbacks.

Testing

  • Passed: bash script/ci/backend.sh.
  • Passed: bash script/ci/browser-worker.sh.
  • Passed: golangci-lint run from backend.
  • Passed: golangci-lint run from browser-worker.
  • Passed: go test ./internal/handlers ./internal/services/publish ./internal/services/browser_session from backend.
  • Passed: ruby script/redis/test_keyspace_inventory.rb.
  • Not run locally this pass: bash script/ci/content-pipeline-integration.sh because it builds and launches the Rust service locally.
  • Not rerun locally this pass: bash script/ci/kubernetes.sh; earlier local run reached the Redis capacity alert step and was blocked by missing promtool plus unavailable Docker/OrbStack fallback.

Related

Redis Cluster key builders need one shared way to create safe hash tags.

Add helper functions for normalized key parts, tag creation, and same-tag checks.

Callers can now build and verify Redis hash-tag conventions consistently.
Auth verification cleanup touches related Redis keys together in the same flow.

Add the email digest hash tag to code, attempt, and last-send keys and cover the shared tag.

Verification keys now remain colocated for Redis Cluster multi-key cleanup.
Backend and browser-worker share live browser session keys across Redis.

Tag active, live-session, and stream-token keys by the authoritative user or session scope.

Shared browser-session keys now have a Cluster-ready slot contract.
The browser-session Redis key contract spans backend and worker code.

Update existing Redis assertions and add focused tests for approved hash-tag shapes.

Future browser-session key changes now fail when they break the shared tag contract.
Publish lock keys are project-scoped coordination state for Redis-backed workers.

Add a project hash tag to publish lock keys and cover the generated key shape.

Publish lock ownership can now be colocated with future project-scoped Redis work.
Resolve-cache invalidation scans all actor entries for one media asset.

Add an asset hash tag to resolve-cache keys and update cache assertions.

Actor-specific resolve cache entries for one asset now share a Redis Cluster slot.
Project-list cache invalidation coordinates data keys with one generation key.

Add a dashboard project-list family hash tag to cache and generation keys.

Project-list cache keys now stay colocated for Cluster-safe invalidation work.
Redis inventory needs to classify the tagged key shapes emitted by the application.

Update declared patterns, fixtures, and inventory tests for the approved hash-tag formats.

Operational keyspace scans now keep the new keys under known ownership metadata.
Redis Cluster follow-up work needs an explicit convention for new key construction.

Document approved tag scopes, examples, audit strategies, and intentionally deferred groups.

Future Redis key work now has a single reference for Cluster slot decisions.
Existing Redis docs still described pre-convention key shapes.

Link the audit to the convention and update browser-session and publish-lock examples.

Documentation examples now match the tagged keys emitted by the code.
@KurodaKayn KurodaKayn force-pushed the feat/346-redis-hash-tags branch 2 times, most recently from e23c932 to 9ece654 Compare June 19, 2026 07:32
@KurodaKayn KurodaKayn merged commit 2522698 into main Jun 19, 2026
32 checks passed
@KurodaKayn KurodaKayn deleted the feat/346-redis-hash-tags branch June 19, 2026 07:37
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.

PR 5.2: Add key hash-tag convention

1 participant