Skip to content

Changes API: Use content_last_updated instead of last_updated#3101

Merged
reakaleek merged 1 commit intomainfrom
efficacious-twig
Apr 14, 2026
Merged

Changes API: Use content_last_updated instead of last_updated#3101
reakaleek merged 1 commit intomainfrom
efficacious-twig

Conversation

@reakaleek
Copy link
Copy Markdown
Member

What

Switch the Changes API to query content_last_updated instead of last_updated.

Why

After #3016 introduced content_last_updated, the Changes API should use it so that metadata-only changes (nav reordering, mapping rollovers) no longer surface in the feed.

How

  • ChangesGateway now queries, sorts, and sources ContentLastUpdated
  • ChangedPageDto.LastUpdated still exists with the same JSON name — the mapping just reads from the new field
  • Cursor internals renamed to ContentLastUpdatedEpochMs (opaque to consumers)

Test plan

  • Query /changes?since=<date> and verify only content changes appear
  • Verify pagination cursor round-trips correctly

🤖 Generated with Claude Code

The Changes API now queries and sorts by content_last_updated so that
metadata-only changes (nav reordering, mapping rollovers) no longer
surface in the feed. The API response shape is unchanged — lastUpdated
is still the JSON field name — keeping this non-breaking for consumers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@reakaleek reakaleek requested a review from a team as a code owner April 14, 2026 08:46
@reakaleek reakaleek requested review from Mpdreamz and technige April 14, 2026 08:46
@reakaleek reakaleek self-assigned this Apr 14, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

This change updates the changes-feed cursor tracking mechanism to use ContentLastUpdated instead of LastUpdated consistently across the query layer, cursor encoding, and result mapping. The ChangesPageCursor record parameter is renamed, the Elasticsearch query now filters and sorts by the content_last_updated field, the cursor's search_after key references the new field, and result items map their LastUpdated output from ContentLastUpdated instead.

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: switching the Changes API to use content_last_updated instead of last_updated.
Description check ✅ Passed The description is directly related to the changeset, providing context (Why), implementation details (How), and a test plan, all aligned with the actual code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch efficacious-twig

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/api/Elastic.Documentation.Api.Core/Changes/ChangesUsecase.cs`:
- Line 85: The cursor serialization currently writes only the
content_last_updated value
(writer.WriteNumberValue(cursor.ContentLastUpdatedEpochMs)) which keeps the old
2-element payload shape and causes mixed-semantics pagination across
deployments; change the cursor format to include an explicit version token
(e.g., emit a small object or array with a leading version number) when
serializing in ChangesUsecase.cs and update the corresponding deserialization
logic to branch on the version: if version==1 parse the new shape, if missing or
legacy shape, detect and map the old 2-element payload (last_updated) into the
new versioned structure so older cursors are handled safely without semantic
mixups. Ensure all code paths creating/reading cursors reference the new
versioned format and increment the version when semantics change next time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a7511661-1bd6-4de0-a168-13fb6f39d65d

📥 Commits

Reviewing files that changed from the base of the PR and between 2a74b24 and bbf52c7.

📒 Files selected for processing (3)
  • src/api/Elastic.Documentation.Api.Core/Changes/ChangesUsecase.cs
  • src/api/Elastic.Documentation.Api.Core/Changes/IChangesGateway.cs
  • src/services/Elastic.Documentation.Search/ChangesGateway.cs

@reakaleek reakaleek merged commit 9a64e85 into main Apr 14, 2026
28 of 29 checks passed
@reakaleek reakaleek deleted the efficacious-twig branch April 14, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants