Skip to content

chore(api): add @Beta annotation + apply to NodeDefinition SPI (H2)#90

Merged
DemchaAV merged 1 commit into
developfrom
chore/internal-beta-annotations
May 31, 2026
Merged

chore(api): add @Beta annotation + apply to NodeDefinition SPI (H2)#90
DemchaAV merged 1 commit into
developfrom
chore/internal-beta-annotations

Conversation

@DemchaAV
Copy link
Copy Markdown
Owner

Summary

Wires up Track H2 from the v1.6.5→1.7 readiness taskboard. The G3 stability policy (#88) referenced @Beta as the planned Extension SPI / Experimental marker; this PR ships the annotation, applies it to the first concrete Extension SPI seam, and lifts the "pending" hedges in the policy doc.

Changes

New annotation — com.demcha.compose.document.api.Beta

Sibling to the existing @Internal marker. Same shape — @Documented, @Retention(RUNTIME), @Target({TYPE, METHOD, FIELD, CONSTRUCTOR, PACKAGE}) — so architecture guard tests can read both reflectively. Lives next to @Internal so IDE autocomplete surfaces both markers.

The annotation's docstring documents two usages:

  • Extension SPI (common case) — the seam is intentionally public so users can implement or call it; shape may evolve in a minor release with a one-minor deprecation window where possible.
  • Experimental — a brand-new public type shipping in its first minor release before the contract has stabilised; may change or disappear in any minor release without a deprecation window.

The distinction lives in the annotated element's own Javadoc, not in the annotation itself.

First application — NodeDefinition is now @Beta

com.demcha.compose.document.layout.NodeDefinition is the canonical Extension SPI seam — the interface library users implement to register custom node types. Its Javadoc now explicitly explains the seam ("carved out of the otherwise @Internal document.layout package") and links the API stability policy § 1 Extension SPI row.

Additional Extension SPI surfaces (render-handler interfaces, fragment-payload interfaces designed for extension) will gain the marker incrementally as their contract solidifies — tracked as follow-up.

Tests — BetaAnnotationDocumentationTest

Pins the annotation's contract in the same shape InternalAnnotationDocumentationTest pins @Internal:

Assertion What it locks
RUNTIME retention Guard tests can read @Beta reflectively (matches @Internal).
@Documented Javadoc surfaces the marker on annotated types.
Target set TYPE / METHOD / FIELD / CONSTRUCTOR / PACKAGE — same as @Internal.
Source-Javadoc invariants Mentions both "Extension SPI" and "Experimental", links docs/api-stability.md, directs users to the issue tracker.
Same-package check Beta.class.getPackage() == Internal.class.getPackage() — IDE autocomplete invariant.

Documentation updates

  • docs/api-stability.md@Beta reference cells in § 1 are no longer hedged as "pending"; the associated quote block lists both markers side-by-side with the guard tests that pin them. NodeDefinition now linked from the Extension SPI row.
  • docs/architecture/package-map.md — new intro paragraph documents the stability-marker convention; the document.layout row calls out NodeDefinition as the current @Beta seam.

Verification

$ ./mvnw -B -ntp test -pl . \
    -Dtest='BetaAnnotationDocumentationTest,InternalAnnotationDocumentationTest,InternalAnnotationCoverageTest,CanonicalSurfaceGuardTest,DocumentationCoverageTest,PublicApiSinceTagCoverageTest,PublicApiNoEngineLeakTest'
BUILD SUCCESS (25s)
$ ./mvnw -B -ntp test -pl .
Tests run: 1029 (+5 from BetaAnnotationDocumentationTest), Failures: 0

CHANGELOG entry added to v1.6.6 — Planned under new ### Public API and existing ### Documentation subsections.

Test plan

  • BetaAnnotationDocumentationTest 5/5 green
  • Existing InternalAnnotationCoverageTest / InternalAnnotationDocumentationTest unchanged and still green
  • G3 stability-policy doc no longer references a "pending" annotation
  • Package-map intro and document.layout row carry the marker convention
  • CI green on PR (Guards / JDK 17/21/25 / Examples Smoke / binary-compat)
  • Reviewer skim — Beta.java (60 LOC) and the policy-doc revisions are where the human eye pays off; the test mirrors the existing Internal test 1:1
  • (Out of scope) follow-up: incrementally apply @Beta to the rest of the Extension SPI surface (render-handler interfaces, fragment-payload interfaces) as each seam's contract solidifies

Wires up Track H2 from the v1.6.5->1.7 readiness taskboard. Adds the @beta annotation that the G3 stability policy (#88) referenced as the planned Extension SPI / Experimental marker, applies it to the first concrete Extension SPI seam, and lifts the 'pending' hedges in the policy doc.

Changes:

- New com.demcha.compose.document.api.Beta annotation, sibling to @internal. Same retention/target/contract shape as @internal so guard tests handle both uniformly; lives next to @internal so IDE autocomplete surfaces both markers.

- @beta applied to com.demcha.compose.document.layout.NodeDefinition - the canonical custom-node-type seam carved out of the otherwise @internal document.layout package. The interface Javadoc now explains the Extension SPI contract and links the stability policy.

- BetaAnnotationDocumentationTest pins the annotation contract (retention, @documented, target set, source-Javadoc invariants, same-package-as-@internal) in the same shape InternalAnnotationDocumentationTest pins @internal.

- docs/api-stability.md: @beta annotation reference cells in section 1 are no longer hedged as 'pending'; the associated quote block lists both markers side-by-side with the guard tests.

- docs/architecture/package-map.md: new intro paragraph documents the stability-marker convention; document.layout row now calls out NodeDefinition as the current @beta seam.

Suite: 1029 tests, 0 failures, 0 errors (+5 from BetaAnnotationDocumentationTest).
@DemchaAV DemchaAV merged commit 852d839 into develop May 31, 2026
10 checks passed
@DemchaAV DemchaAV deleted the chore/internal-beta-annotations branch May 31, 2026 11:47
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