Skip to content

sbx: restructure governance docs and add API reference#25162

Draft
dvdksn wants to merge 1 commit into
docker:mainfrom
dvdksn:sbx/governance-docs
Draft

sbx: restructure governance docs and add API reference#25162
dvdksn wants to merge 1 commit into
docker:mainfrom
dvdksn:sbx/governance-docs

Conversation

@dvdksn
Copy link
Copy Markdown
Contributor

@dvdksn dvdksn commented May 25, 2026

Summary

Splits the existing security/governance and security/policy pages into a new governance section with concepts, local, organization, monitoring, and API reference sub-pages, and adds a custom api-reference Hugo layout that renders the colocated OpenAPI 3 spec directly.

The layout reads the spec with transform.Unmarshal, resolves $ref nodes through a tiny returning partial, overrides baseof's main block to take the full content width, and adds a sticky right-rail endpoint navigator grouped by tag. Each operation card shows method/path, summary, description, parameters, request body, and responses; responses are native <details> with 2xx open by default; JSON examples use the site's syntax-light/syntax-dark utility for theming. Every operation also exposes a copy-as-cURL button that assembles a ready-to-paste command from spec parameter and request-body examples.

A companion api-reference.markdown.md template renders the same spec as a clean markdown document so the page's Copy/View Markdown actions and the .md alternate return real content.

Learnings

  • Hugo's prettier config only applies the prettier-plugin-go-template parser to *.html. Running prettier --write on layouts/*.markdown.md mangles Go template syntax (e.g. {{- /* ... */ -}} and *.yaml). Format the HTML layout, leave the markdown template alone.
  • docker buildx bake validate still fails inside a git worktree, but a plain hugo --renderToMemory or hugo -d <out> does build the page — the only post-build error is the deferred Tailwind CSS transform (missing tailwindcss CLI), which doesn't gate template rendering.

Generated by Claude Code

Splits the existing security/governance and security/policy pages into a
new governance section with concepts, local, organization, monitoring,
and API reference sub-pages, and adds a custom api-reference Hugo layout
that renders the colocated OpenAPI 3 spec directly from the spec file.

The layout reads the spec via transform.Unmarshal, resolves $ref nodes
through a small returning partial, and overrides baseof's main block to
take the full content width. The built-in right-rail TOC is replaced
with a sticky endpoint navigator that groups operations by tag with
method-colored pills.

Each operation card shows method/path, summary, description, parameters,
request body, and responses. Responses use native <details> elements so
the list of status codes stays scannable; 2xx defaults to open. JSON
examples are wrapped in the site's syntax-light/dark utility so Chroma
classes pick up the theme. Each operation also exposes a copy-as-cURL
button that assembles a ready-to-paste command from the spec's path and
query parameter examples, the bearer-auth scheme (with $TOKEN as a
literal placeholder), and the request body's default JSON example.

A companion api-reference.markdown.md template renders the same spec as
a clean markdown document so the page's "Copy Markdown" / "View
Markdown" actions and the .md alternate link return real content
instead of just the page title.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 25, 2026

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 16617fa
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6a1460b14e3b190008ac2bf4
😎 Deploy Preview https://deploy-preview-25162--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added hugo Updates related to hugo area/ai labels May 25, 2026
Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

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

Assessment: 🟡 NEEDS ATTENTION

This PR restructures sandbox governance docs into a clean multi-page hierarchy and adds an OpenAPI-rendered API reference page. The redirect aliases on local.md and org.md correctly cover the old security/policy and security/governance URLs. Two issues found in the newly added content.

See [Local policy](local.md).

**Organization policy** is configured centrally in the Docker Admin Console or
via the [Governance API](api.md). Rules defined at the org level apply
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] Links to api.md will fail — API reference lives at api/index.md (leaf bundle)

Multiple files in content/manuals/ai/sandboxes/governance/ link to api.md as a sibling file:

_index.md line 17:  [Governance API](api.md)
_index.md line 38:  [API reference](api.md)
org.md line 18:     [Governance API](api.md)
org.md line 110:    [API](api.md)
local.md line 158:  [API](api.md)
concepts.md line 19: [Governance API](api.md)

No sibling api.md file exists — the API reference is a leaf bundle at governance/api/index.md. Hugo link checking will report these as broken links. Change the links to api/ (or api/index.md) to correctly point at the bundle's index page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the link resolves correctly it seems, but that's just luck. Agree that we should link to the actual file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You're right that Hugo is likely resolving it — Hugo's link resolver is forgiving and will often find the target even with imprecise paths. But as you noted, relying on that is fragile. Using api/ (or api/index.md) makes the intent explicit and ensures the link works predictably across different contexts (ref lookups, relrefs, etc.).

Thanks for confirming the fix makes sense!

type:
type: string
description: >
Identifies the rule-set format. Currently always `allowlist_v0`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[LOW] Time-relative language "Currently always allowlist_v0" violates style guide

Docker's style guide prohibits time-relative language like "currently" because it implies the state may change and becomes stale. Documentation should describe the product as it is today.

Suggested rewrite:

description: >
  Identifies the rule-set format. Always `allowlist_v0`,
  corresponding to the `allowlist_v0` property on the full Policy object.

The same phrase appears at the same line in static/manuals/ai/sandboxes/governance/api.yaml.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will fix upstream.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for confirming! I'll mark this as resolved once the upstream fix is merged.

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

Labels

area/ai hugo Updates related to hugo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants