Skip to content

docs: library-integration guide + cross-links#114

Merged
joshprice merged 9 commits intomainfrom
docs-library-integration
Apr 22, 2026
Merged

docs: library-integration guide + cross-links#114
joshprice merged 9 commits intomainfrom
docs-library-integration

Conversation

@joshprice
Copy link
Copy Markdown
Member

Adds usage-rules/library-integration.md codifying the three-part contract a library author follows to ship Clarity content from inside their own library:

  1. Module guarded by Code.ensure_loaded?(Clarity.Content)
  2. Registration via the library's application/0 env under :clarity_content_providers (or :clarity_introspectors / :clarity_perspective_lensmakers)
  3. {:clarity, "~> 0.4", optional: true} in deps

Also:

  • Clarifies when library-owned content belongs in the extension itself vs a cross-cutting library such as ash_diagram
  • Recommends YourLibrary.Clarity.* as the canonical namespace (shorter than ClarityContent.*, leaves room for introspectors and vertex types in the same tree)
  • Points at ash_diagram as a worked example
  • Links from the README's "Third-Party Libraries" section and from usage-rules/content-providers.md so library authors find the guide from either entry point

@joshprice joshprice force-pushed the docs-library-integration branch from aef803b to f888442 Compare April 22, 2026 14:03
Comment thread mix.exs Outdated
Adds `documentation/how_to/integrate-from-a-library.md` codifying
the three-part contract a library author follows to ship Clarity
content from inside their own library:

1. Module guarded by `Code.ensure_loaded?(Clarity.Content)` (or the
   corresponding behaviour for introspectors, vertex types, and
   lensmakers)
2. Registration via the library's `application/0` env under
   `:clarity_content_providers` (or the equivalent key)
3. `{:clarity, "~> 0.4", optional: true}` in deps

Also:

- Wires a "How To" section into ExDoc via `extras:` so HexDocs
  surfaces the guide with its own sidebar entry
- Adds a condensed rules summary at usage-rules/library-integration.md
  pointing at the guide, for AI coding assistants
- Links to the guide from the README's "Third-Party Libraries"
  section and from usage-rules/content-providers.md
- Clarifies when library-owned content belongs in the extension vs a
  cross-cutting library such as ash_diagram
- Recommends `YourLibrary.Clarity.*` as the canonical namespace
  (shorter than `ClarityContent.*`, leaves room for introspectors
  and vertex types in the same tree)
- Points at `ash_diagram` and `ash_state_machine` as worked examples
@joshprice joshprice force-pushed the docs-library-integration branch from f888442 to 85e8ad7 Compare April 22, 2026 15:22
…ests

The "unknown task" warnings in the ack and nack handlers of
Clarity.Server had their log strings swapped, so a stale ack was
reported as a stale nack (and vice versa). Two tests in server_test.exs
deliberately exercise the stale-ack path but never flushed the cast, so
the warning leaked to the console intermittently depending on scheduling
relative to ExUnit's capture_log scope. Wrap those calls in capture_log
with a sync flush and assert the expected warning.
@joshprice joshprice merged commit e39ee04 into main Apr 22, 2026
23 checks 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.

2 participants