Skip to content

Conversation

@dmitrytrager
Copy link
Collaborator

Implement GET /api/v1/beacons/manifest to build and return the full manifest JSON (language, region, tags, providers with nested topics and files, totals, checksum). Implement HEAD support with If-None-Match (304 Not Modified) and If-Match (412 Precondition Failed) for lightweight change detection during sync.

Manifest versioning uses lazy evaluation: content checksum is compared with stored value on the beacon, and the version is incremented only when content actually changes. Conditional requests use the stored version directly, avoiding a full manifest build for 304/412 responses.

What Issue Does This PR Cover, If Any?

Resolves
#566
#567
#573

What Changed? And Why Did It Change?

  • Manifest controller with change detection and corresponding response statuses
  • Manifest building logic, saving version and checksum inside beacon
  • Files and assignments tracking logic that will update manifest data for beacon once triggered

How Has This Been Tested?

Rspec

Please Provide Screenshots

Additional Comments

For changed associations (such as topic/providers) rebuild is triggered from callbacks now.
This logic should be later moved into controllers/mutators.

dmitrytrager and others added 2 commits February 3, 2026 15:45
Implement GET /api/v1/beacons/manifest to build and return the full
manifest JSON (language, region, tags, providers with nested topics
and files, totals, checksum). Implement HEAD support with If-None-Match
(304 Not Modified) and If-Match (412 Precondition Failed) for
lightweight change detection during sync.

Manifest versioning uses lazy evaluation: content checksum is compared
with stored value on the beacon, and the version is incremented only
when content actually changes. Conditional requests use the stored
version directly, avoiding a full manifest build for 304/412 responses.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Introduce Beacons::RebuildManifestJob and wire it into Topics::Mutator
(create, update, archive, unarchive, destroy), BeaconTopic/BeaconProvider
join model callbacks, and SynchronizeCognatesOnTopicsJob so that beacon
manifests stay current without waiting for a GET request.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

# During sync, beacon sends If-Match with its current version.
# If the manifest changed since sync started, return 412 so beacon aborts and restarts.
if stale_by_match?(stored_etag)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of checks here to protect from unnecessary rebuild

belongs_to :beacon
belongs_to :provider

after_commit :rebuild_beacon_manifest, on: [ :create, :destroy ]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we add controller/mutator for managing association, move this logic there

belongs_to :beacon
belongs_to :topic

after_commit :rebuild_beacon_manifest, on: [ :create, :destroy ]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we add controller/mutator for managing association, move this logic there

@dmitrytrager dmitrytrager marked this pull request as ready for review February 3, 2026 15:57
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.

2 participants