Skip to content

docs: add Mermaid diagrams for better readability - #167

Open
LSX-s-Software wants to merge 1 commit into
kvcache-ai:mainfrom
LSX-s-Software:docs/update-networking-doc
Open

docs: add Mermaid diagrams for better readability#167
LSX-s-Software wants to merge 1 commit into
kvcache-ai:mainfrom
LSX-s-Software:docs/update-networking-doc

Conversation

@LSX-s-Software

@LSX-s-Software LSX-s-Software commented Aug 13, 2026

Copy link
Copy Markdown
Member

What

Replace selected ASCII architecture and lifecycle diagrams in the mdBook documentation with Mermaid diagrams, and enable Mermaid rendering in the documentation build.

Why

The architecture, sandbox lifecycle, egress-rule, and multi-node control-plane diagrams are easier to read, maintain, and render consistently as Mermaid diagrams than as fixed-width ASCII art.

Related issue

N/A

Scope and non-goals

  • Convert relationship diagrams in the concepts and internals documentation.
  • Add the mdBook Mermaid preprocessor and browser-side Mermaid initialization.
  • Keep source directory trees, command examples, and other non-diagram text unchanged.
  • No runtime, API, storage, scheduler, or generated-code behavior changes.

Design and behavior changes

  • docs/book.toml enables the mdbook-mermaid preprocessor and loads mermaid-init.js.
  • Mermaid diagrams preserve the original component relationships, labels, lifecycle transitions, storage paths, and control-plane routing semantics.
  • The browser initializer loads Mermaid 11.12.0 from jsDelivr with an integrity hash and selects a light or dark Mermaid theme based on the mdBook theme.
  • The distributed control-plane diagram shows Gateway as the data-plane proxy and Scheduler as the node selection/lookup service.

Compatibility and operations

  • Public API or generated protocol: N/A; documentation-only change.
  • Configuration or defaults: N/A.
  • Snapshot manifest, artifact layout, or storage format: N/A.
  • Upgrade and rollback: Reverting this commit restores the previous ASCII diagrams and removes Mermaid preprocessing.
  • Host requirements, permissions, ports, or dependencies: Documentation builds now require mdbook-mermaid; CI installs mdbook-mermaid@0.17.0.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:

mdbook build docs
INFO Book building has started
INFO Running the html backend
INFO HTML book written to /home/ubuntu/AgentENV/docs/book

git diff --check
Passed

Skipped checks and reasons:

Rust, services, generated-code, and benchmark checks were skipped because this PR only changes documentation and documentation build assets.

Risks and reviewer notes

  • Mermaid rendering depends on the pinned jsDelivr asset and the mdbook-mermaid preprocessor.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ Successfully posted inline: 2 comment(s)

Comment thread .github/workflows/docs.yml
Comment thread docs/mermaid-init.js Outdated
Comment thread docs/mermaid-init.js
@LSX-s-Software
LSX-s-Software force-pushed the docs/update-networking-doc branch from 62048cd to f15636f Compare August 13, 2026 06:16
Comment thread .github/workflows/docs.yml
Comment thread docs/mermaid-init.js
@LSX-s-Software
LSX-s-Software force-pushed the docs/update-networking-doc branch from 485e49e to 12ed5c0 Compare August 13, 2026 09:17
Comment on lines +64 to +66
- uses: taiki-e/install-action@v2
with:
tool: mdbook-mermaid@0.17.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security · medium
This newly added third-party action is pinned only to the mutable v2 tag. Pin it to a full commit SHA (while retaining the version in a comment) so a future tag movement or repository compromise cannot alter the documentation build.

Suggestion:

Suggested change
- uses: taiki-e/install-action@v2
with:
tool: mdbook-mermaid@0.17.0
- uses: taiki-e/install-action@<full-commit-sha> # v2
with:
tool: mdbook-mermaid@0.17.0

@LSX-s-Software
LSX-s-Software force-pushed the docs/update-networking-doc branch from 12ed5c0 to a82b68e Compare August 13, 2026 09:46
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
@kvcache-ai kvcache-ai deleted a comment from github-actions Bot Aug 13, 2026
Comment on lines +64 to +66
- uses: taiki-e/install-action@v2
with:
tool: mdbook-mermaid@0.17.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security · medium
This newly added third-party action is referenced by the mutable v2 tag. A tag can be moved or compromised, causing an unreviewed binary to run in the documentation build; pin taiki-e/install-action to a full commit SHA (and retain the version in a comment if desired).

Comment thread docs/book.toml
edit-url-template = "https://github.com/kvcache-ai/AgentENV/edit/main/docs/{path}"
additional-css = ["theme/version-selector.css"]
additional-js = ["theme/version-selector.js"]
additional-js = ["theme/version-selector.js", "mermaid-init.js"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bug · medium
mermaid-init.js looks up mdbook-theme-* element IDs, but mdBook's built-in theme links use theme-* (for example, theme-light, theme-coal, and theme-ayu). Consequently none of these listeners are attached, so switching between light and dark themes does not reload/re-render Mermaid diagrams and their colors can remain from the initial theme. Use the actual mdBook theme IDs (or listen to the theme-change mechanism) before enabling this script here.

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