Skip to content

Add a revisioned cache for partially acquired normalized entities #9276

Closed

Description

@ifireball

What is missing

Entity data can be acquired progressively. Fullsend needs a cache that retains partial normalized entities while multiple clients fetch additional fields or history for the same entity.

What should happen

  • Use the entity ID defined by the normalized-entity spec as the cache key.
  • Define Get(entityID) to return the current partial entity and its revision. On a miss, return the current revision as well, so callers can safely create an entry.
  • Define Put(entityID, entity, expectedRevision) as an atomic compare-and-swap. It succeeds and returns a new revision only if the expected revision matches; otherwise it reports a conflict and the current revision.
  • Keep merging outside the cache API: after a conflict, callers fetch the latest snapshot, merge in their newly retrieved data, and retry Put.
  • Define Invalidate(entityID) to remove the cached value and advance its revision, so a write based on a pre-invalidation snapshot cannot restore stale data.
  • Provide a thread-safe in-memory implementation. Concurrent clients must not silently overwrite each other’s updates; stale writes must be detectable and retryable.
  • Preserve the normalized-entity contract’s distinctions between absent, not loaded, unsupported, unknown, failed, and incomplete data.

Context

This supports progressive entity acquisition under ADR 0147 and the normalized-entity contract in #8420. It is intended as a sibling to #9271, under parent #8418.

Activity

  1. fullsend-ai-triage commented on Nov 10, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 2:57 PM UTC · Completed 2:59 PM UTC

    Commit: f31165c · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.17

  2. added
    feature
    triaged
    on Nov 10, 2026
  3. fullsend-ai-triage commented on Nov 10, 2026

    @fullsend-ai-triage

    Triage summary

    This is a well-scoped new feature with no blockers and no in-flight PR. The normalized-entity v1 contract it depends on (#8420) is already closed, and the spec is in the repo, so implementation can start without further input. #9271 (actor cache) is a sibling primitive and does not block this.

    Design notes worth pinning down in the implementation:

    • Use the canonical entity.id string from the normalized-entity v1 spec as the key. It is not the snapshot record_key and not a repo/path or #N reference.
    • Revisions must be monotonic per key and must survive Invalidate. A Put based on a miss-time revision should also conflict after an invalidation, so absent keys need a revision or tombstone record. Decide how that memory is bounded.
    • Copy entities on the way in and out so callers can't mutate cached state without CAS.
    • Store entities exactly as given. The cache must not turn not-loaded, unsupported, failed or incomplete markers into absent or empty values.
    • No Go type for the normalized entity exists yet, so the cache can use an opaque or generic value type until one lands.

    Proposed test case (conceptual):

    miss: Get -> (notfound, rev r0); Put(r0) -> ok, r1
    stale: Put(r0) after r1 -> conflict(current=r1), value unchanged
    invalidate: Invalidate -> value gone, rev r2; Put(r1) and Put(r0 from miss) -> conflict
    absent key: Invalidate advances revision
    isolation: mutate returned/stored entity -> cache unchanged
    markers: not_loaded/unsupported/failed/incomplete round-trip unchanged
    concurrency (-race): N goroutines Get->merge own field->Put, retry on conflict;
      final entity contains all N fields
    

    This is a feature, so automatic promotion to code does not apply. A maintainer can apply the ready-to-code label or comment /fs-code when ready.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. self-assigned this
    on Nov 11, 2026
  5. ifireball commented on Nov 11, 2026

    @ifireball
    MemberAuthor

    /fs-code

  6. fullsend-ai-coder commented on Nov 11, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 9:07 AM UTC · Completed 9:18 AM UTC

    Commit: 47b1f72 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $1.52

  7. added 4 commits that reference this issue on Nov 11, 2026
  8. added 2 commits that reference this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featuretriaged

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions