Skip to content

feat(app): pluggable HTTP cache policy for the metadata endpoints (ETag included, off by default) - #249

Merged
marioserrano09 merged 1 commit into
nextfrom
feature/248-metadata-http-cache
Oct 13, 2026
Merged

marioserrano09 merged 1 commit into
nextfrom
feature/248-metadata-http-cache

Conversation

@marioserrano09

Copy link
Copy Markdown
Contributor

Part 1 of #248 (HTTP cache policy). Part 2 (server-side Spring Cache) is deliberately not included: the descriptors are already cached by AbstractViewDescriptorFactory, so it only makes sense if measuring shows serialization matters.

  • MetadataHttpCachePolicy (+ MetadataCacheDirectives): the application decides ETag / Cache-Control / Vary for /apps/api/metadata descriptors, entities and navigation. Nothing by default: responses are unchanged.
  • dynamia.app.metadata.http-cache=etag enables ContentEtagMetadataHttpCachePolicy: strong ETag from content + locale, Cache-Control: private, no-cache, Vary: Accept-Language, 304 with no body on a matching If-None-Match.
  • A MetadataHttpCachePolicy bean of the application replaces the included one.
  • Applied by a ResponseBodyAdvice scoped to ApplicationMetadataController and an allowlist of read-only paths; actions, /entities/ref/**, executions, dashboard and reports are never cached.
  • Docs: docs/backend/ARCHITECTURE.md.

Tests: MetadataHttpCacheAdviceTest (8: default untouched, ETag, 304, changed content, locale in the validator, path allowlist and POST, custom policy, policy returning nothing) and the existing ApplicationMetadataControllerTest (19), via mvn -pl platform/app -am test. Mutation-checked (304 and locale). Not run: the rest of the reactor, and a real request against a running server.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GDh8QvbJA9soPiZXVjuYph

…ag included and off by default

MetadataHttpCachePolicy lets the application decide how clients cache descriptors, entity metadata and navigation served by /apps/api/metadata. No policy by default (responses unchanged). dynamia.app.metadata.http-cache=etag enables ContentEtagMetadataHttpCachePolicy: strong ETag from content and locale, Cache-Control private,no-cache, Vary Accept-Language, and 304 on a matching If-None-Match. An application bean replaces it. Actions, entity data and executions are never cached.

Refs #248

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDh8QvbJA9soPiZXVjuYph
@marioserrano09
marioserrano09 merged commit 3947e40 into next Oct 13, 2026
1 check passed
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.

1 participant