Skip to content

Reintroduce JetBrains [PublicAPI] as an IDE authoring hint#541

Draft
ChrisonSimtian wants to merge 1 commit into
Fallout-build:mainfrom
ChrisonSimtian:feature/reintroduce-publicapi-annotations
Draft

Reintroduce JetBrains [PublicAPI] as an IDE authoring hint#541
ChrisonSimtian wants to merge 1 commit into
Fallout-build:mainfrom
ChrisonSimtian:feature/reintroduce-publicapi-annotations

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Closes #539. Reintroduces [PublicAPI] for the IDE "unused symbol" hint only — not API-break detection (that's the #530 / #540 track, a separate concern).

Rider/ReSharper flags Fallout's public build-authoring surface as unused because it is unused in-repo by design (external consumers call it, we don't). [PublicAPI] marks it as intentional API. IDE hint only — no runtime/semantic effect.

Approach — hybrid (see ADR-0011)

  • Outer/consumer-facing assemblies get a blanket [assembly: PublicAPI] via the _FalloutOuterApiAssemblies allowlist in Directory.Build.props (single source of truth). The JetBrains.Annotations reference flows to consumers (no PrivateAssets), so their Rider sees our surface as API too.
  • Inner assemblies get no blanket. The four Fallout.Persistence.Solution model types that surface through Fallout.Solution's public API (SolutionModel, SolutionItemModel, SolutionProjectModel, SolutionFolderModel) carry a per-type [PublicAPI] instead — a blanket would bless the vendored parser's implementation detail.
  • Opt out per project with <FalloutPublicApi>false</FalloutPublicApi>.

Only [PublicAPI] comes back; the other JetBrains attributes removed in #76 stay removed.

Docs

  • docs/adr/0011-reintroduce-publicapi-ide-hint.mdProposed, up for discussion here.
  • docs/api-encapsulation-audit.md — the outer/inner split, the per-type carve-outs, and the public-by-accident follow-up the coarse blanket implies.

Full solution builds green; [assembly: PublicAPI] verified emitted on outer assemblies and absent on inner.

Partially reverses the wholesale JetBrains.Annotations removal (Fallout-build#76), for the
[PublicAPI] concern only and via a per-assembly blanket instead of ~1450
hand-placed attributes. Rider/ReSharper flagged Fallout's public build-authoring
surface as unused because it is unused in-repo by design (external consumers call
it); [PublicAPI] marks it as intentional API. IDE hint only, no runtime effect.

- Directory.Build.props: outer (consumer-facing) assemblies get [assembly: PublicAPI]
  via the _FalloutOuterApiAssemblies allowlist (single source of truth); the
  JetBrains.Annotations reference flows to consumers (no PrivateAssets). Opt out with
  <FalloutPublicApi>false</FalloutPublicApi>.
- Inner assemblies get no blanket. Fallout.Persistence.Solution's four model types that
  surface through Fallout.Solution's public API carry a per-type [PublicAPI] instead
  (the hybrid split) - a blanket would bless the vendored parser's implementation detail.
- ADR-0011 records the decision; docs/api-encapsulation-audit.md tracks the outer/inner
  split and the carve-outs.

Distinct from public-API break detection (Fallout-build#410 / Fallout-build#530). Tracks Fallout-build#539.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian ChrisonSimtian added enhancement New feature or request target/vCurrent Targets the current version labels Jul 24, 2026
@ChrisonSimtian

Copy link
Copy Markdown
Collaborator Author

@dennisdoomen i brought [PublicAPI] back but this time not a shotgun make everything publicapi, instead its a bit more targeted both via Attributes and via Assemblies (mind you still too many for my taste but once we make it through a few refactorings hopefully the surface will normalise a bit)

@ITaluone ITaluone left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice!

Never got the reason for removing in the first place 🫢 But cool to see the actual value ;)

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator Author

Never got the reason for removing in the first place 🫢

  1. I was missing a narrative for why we use them (which this PR will fix with an ADR and a consistent gh issue story)
  2. I felt they were just wildly applied everywhere in the project without sense

So this time its a bit more targeted, organised and I want the AI instructions side-by-side to ensure we maintain those properly.

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

Labels

enhancement New feature or request target/vCurrent Targets the current version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reintroduce JetBrains [PublicAPI] as an IDE authoring hint on consumer-facing assemblies

2 participants