Skip to content

feat: add GET /v1/changes endpoint for querying changed docs pages#2896

Open
reakaleek wants to merge 3 commits intomainfrom
diff-api
Open

feat: add GET /v1/changes endpoint for querying changed docs pages#2896
reakaleek wants to merge 3 commits intomainfrom
diff-api

Conversation

@reakaleek
Copy link
Member

Summary

  • Adds a new GET /v1/changes?since=<ISO8601>&size=100&cursor=<token> API endpoint that returns which documentation pages have changed since a given date
  • Uses Elasticsearch search_after for cursor-based pagination with no 10k hit limit
  • Returns url, title, lastUpdated per changed page, with hasMore and nextCursor for pagination

Details

New files:

  • Api.Core/Changes/IChangesGateway.cs — gateway interface + domain records
  • Api.Core/Changes/ChangesUsecase.cs — usecase with Base64Url cursor encode/decode + API models
  • Search/ChangesGateway.cs — Elasticsearch range query + search_after implementation

Modified files:

  • SerializationContext.cs — AOT serialization registration
  • MappingsExtensions.cs — endpoint mapping
  • Search/ServicesExtension.cs — DI registration

Test plan

  • Verify endpoint returns 400 when since parameter is missing
  • Verify endpoint returns changed pages for a valid since date
  • Verify cursor pagination works across multiple pages
  • Verify empty result set returns hasMore: false and no cursor
  • Verify Lambda host builds and registers the endpoint

🤖 Generated with Claude Code

Add a cursor-paginated API endpoint that returns which documentation
pages have changed since a given date, using Elasticsearch search_after
for efficient deep pagination with no 10k hit limit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…OT compatibility

The Lambda NativeAOT build failed because JsonSerializer.Deserialize<T>
requires runtime code generation. Use JsonDocument.Parse instead, which
is fully AOT-compatible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use params overload for .Sort() so both sort fields (LastUpdated, Url)
  are applied instead of the second overwriting the first
- Add SearchTitle and Type to source filter to prevent deserialization
  failures on required DocumentationDocument properties
- Handle ES returning date sort values as double with TryGetDouble fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Nice!

This should use PIT explicitly, multiple queries can share the same one.

That way deploys do not interfere with this API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants