Skip to content

📝 docs(sync): correct openapi/example/site drift from audit pass 2 - #59

Merged
scttbnsn merged 2 commits into
mainfrom
fix/audit-pass-2
Jul 11, 2026
Merged

scttbnsn merged 2 commits into
mainfrom
fix/audit-pass-2

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Second correctness + completeness pass over the portwing surfaces that pass 1 (#58, merged) didn't diff field-by-field: api/openapi.yaml, the Kubernetes/Compose examples, the audit/observability/standalone/api-reference docs pages, the Dockerfiles, and the release/CI process docs. A multi-agent audit surfaced 25 verified findings (find → adversarial verify → completeness critic); all are fixed here. Nothing contradicts pass 1 — the README/SPEC/security-model/website edge-auth and version claims still hold.

Highlights (the ones that weren't just wording)

  • Broken k8s examples. examples/kubernetes/{standard,edge}.yaml mounted the Compose stacks dir (/data/stacks) as emptyDir, which Kubernetes wipes on pod recreation — silently breaking down/ps/stop/restart/logs for every stack a prior up deployed (the non-up compose ops reuse the file up wrote to disk). Now hostPath, with a note to pre-create it owned by UID 65532 since fsGroup doesn't apply to hostPath. The edge manifest's portwing keygen step was also missing its > portwing_ed25519.pem redirect, so the kubectl create secret --from-file=… that followed referenced a file that was never written.
  • FuzzEnvelope was in no fuzz tier. The wire-envelope fuzzer (internal/protocol) exercises the portwing/1.0 parser on the untrusted edge-WebSocket input path — arguably the highest-value target in the tree — but was wired into none of ci/nightly/monthly/lefthook/CONTRIBUTING. Now in all five. (Ran 28M+ execs locally and in the pre-push smoke, no crashers.)

OpenAPI contract gaps

api/openapi.yaml now documents: the GET /_portwing/audit and POST /_portwing/mcp agent endpoints (were entirely absent); a real GET op on /api/watchers/{type}/{name} (previously only POST→501, but the GET is a live 200/404 lookup); GET /api/log/entries; the dd:watcher-snapshot SSE event; the timestamps log query param; 404/409 on DELETE /api/containers/{id}; and the digest/link/timestamp ContainerResult/ContainerError fields. info.version and example version strings bumped to 0.6.0.

Docs-site + process drift

  • audit-logging.mdx: GET /_portwing/audit response example now uses ts (no level/msg) to match the ring-buffer schema; key_id sample uses the real bare-hex format; the "core fields" table scopes method/path to the events that actually emit them.
  • observability.mdx: portwing_auth_failures_total reason labels corrected to the real values (bad_token, no_credentials, timestamp-skew, …).
  • standalone-mode.mdx: generic-adapter capabilities array corrected (base caps are always prepended; events appears twice).
  • Stale 0.1.0/0.3.0 example version strings → 0.6.0 across the docs site.
  • CONTRIBUTING.md: describes the actual trunk-based flow (no dev/* branch). RELEASING.md + release-cut.yml: a BREAKING CHANGE footer does not trigger a major bump (the workflow only reads commit subjects). Dockerfile.armv7: comment points at the real unified Dockerfile.release. SPEC.md: image package list split into its accurate Wolfi/Alpine variants.

Verification

  • go build ./..., go vet, actionlint, zizmor, qlty check (markdownlint/shellcheck) all clean.
  • OpenAPI YAML validated (25 paths, new schemas present); both k8s manifests parse.
  • Pre-push battery green, including the 6-fuzzer smoke with FuzzEnvelope.
  • No Go source changed (docs/examples/CI-config only), so the test suite is unaffected.

Still uncovered (candidate pass 3)

authentication.mdx and drydock-integration.mdx wire-shape tables not diffed field-by-field; configuration.mdx env-var table vs internal/config; quality-mutation-monthly.yml package matrix scope; soak-benchmark scenarios vs docs; security-scanning workflows vs README/SECURITY claims.

Changelog

  • ✨ Added OpenAPI schemas and endpoints for audit records and MCP over JSON-RPC (including new MCP tag).
  • ✨ Added OpenAPI coverage for watcher retrieval, log entries compatibility, timestamps query param, container delete response codes, and /api/events SSE example updates.
  • ✨ Added FuzzEnvelope as a new Go fuzz target across CI workflows (quality monthly/nightly), lefthook pre-push, and contributor guidance.
  • 🔧 Updated API and documentation examples to 0.6.0 (agent/version/capabilities examples) and refreshed related docs pages (API reference, audit logging, observability, standalone mode).
  • 🐛 Fixed Kubernetes example drift by persisting Compose stacks (switching stacks volume from emptyDir to hostPath) and correcting edge key-generation instructions/redirect output and clarified key contents.
  • 🐛 Fixed OpenAPI audit documentation and schema examples:
    • 🔧 Removed minimum: 1 from the audit limit parameter schema (allow 0/non-positive to mean “return all”).
    • 🔒 Clarified audit event field handling and aligned audit response/ring-buffer example schema with the intended (internal) format.
  • 🔧 Updated release automation documentation and major-bump detection to trigger on Conventional Commit subject !: (tightened regex/logic; body/footer not read).
  • 🔧 Updated build/release/image documentation (Dockerfile armv7 comment, architecture-specific image packages in SPEC.md, and release/cutting/tag wording).
  • 🔧 Updated contribution guidance to trunk-based flow (PRs target main) and aligned fuzz-testing instructions accordingly.

Concerns

  • Confirm the new OpenAPI audit + MCP contracts align exactly with the implemented handlers (paths, schemas, required/optional fields, and status/response examples).
  • Validate Kubernetes hostPath requirements in all supported environments (pre-create directory with correct non-root UID/GID; ensure node filesystem permissions hold).
  • Ensure release-bump detection behavior matches documentation for ! vs BREAKING CHANGE footer and that the !: subject-only interpretation is correct end-to-end.
  • Check CI/runner constraints after expanding fuzz matrix size (time budgets, artifact limits, and failure upload behavior).
  • Review any remaining “pass 3” candidate documentation discrepancies identified during the sync/audit process.

Second correctness + completeness pass over the surfaces pass 1 (#58) did not
diff field-by-field. 25 verified findings, fixed across docs, deployment
examples, the OpenAPI contract, and fuzz coverage.

- 📝 docs(openapi): document the GET /_portwing/audit and POST /_portwing/mcp
  agent endpoints, GET /api/watchers/{type}/{name}, GET /api/log/entries, the
  dd:watcher-snapshot SSE event, the timestamps log query param, DELETE
  404/409 responses, and the ContainerResult/ContainerError digest/link/
  timestamp fields; bump info.version and example version strings to 0.6.0
- 🐛 fix(k8s): mount the DaemonSet Compose stacks dir as hostPath instead of
  emptyDir so stack state survives pod recreation (emptyDir wiped it, breaking
  down/ps/stop/restart/logs); add the missing `> portwing_ed25519.pem` redirect
  to the edge keygen setup step, and document the supplementalGroups socket-GID
  prerequisite in examples/README.md
- 📝 docs(site): fix the GET /_portwing/audit response example (ts, no
  level/msg), the portwing_auth_failures_total reason labels, the generic
  adapter capabilities list, the audit key_id sample, the core-fields table,
  and stale 0.1.0/0.3.0 version examples across the audit-logging,
  observability, standalone-mode, and api-reference pages
- 🧪 test(fuzz): wire FuzzEnvelope (internal/protocol; the portwing/1.0 parser
  on the untrusted edge-WS input path) into the ci.yml smoke tier, the nightly
  and monthly deep-fuzz matrices, the lefthook pre-push hook, and CONTRIBUTING
- 📝 docs(process): describe the actual trunk-based flow in CONTRIBUTING (no
  dev/* branch), correct the RELEASING/release-cut BREAKING-CHANGE major-bump
  claim (subjects only), fix the Dockerfile.armv7 comment, and split SPEC's
  image package list into its Wolfi and Alpine variants
@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The OpenAPI specification adds audit and MCP schemas and endpoints, extends response metadata, and documents additional compatibility operations. Related API, audit, observability, and standalone-mode documentation is synchronized. FuzzEnvelope is added to local, continuous, nightly, and monthly fuzzing. Contribution and release guidance now reflects trunk-based development and current version rules. Docker image documentation and Kubernetes examples are updated for architecture-specific packages, persistent stack storage, and key generation.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/audit-pass-2

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/ci.yml (1)

392-406: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Stale count in harden-runner comment.

Matrix now has 6 fuzzer variants but comment at line 398 still says "5".

diff
-          # One allowlist shared by all 5 matrix variants (harden-runner config
+          # One allowlist shared by all 6 matrix variants (harden-runner config
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 392 - 406, Update the harden-runner
comment near the egress policy to state that the allowlist is shared by all 6
matrix variants instead of 5.
.github/workflows/release-cut.yml (1)

100-112: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Tighten the major-bump regex in .github/workflows/release-cut.yml. ^.+!\s*: matches ! anywhere before a later :, so fix: embed !: in quoted text can bump major. Match the prefix only, e.g. grep -qP '^[^:]+!:'.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release-cut.yml around lines 100 - 112, Update the
major-bump check in the commit-subject loop to use a regex that only matches an
exclamation mark in the conventional-commit prefix before the first colon, such
as `^[^:]+!:`; retain the existing major-bump behavior while preventing later
punctuation in the subject from triggering it.
docs/content/docs/api-reference.mdx (1)

56-68: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Stale capabilities example — out of sync with api/openapi.yaml.

InfoResponse.capabilities in api/openapi.yaml (line 158) was updated to ["compose", "exec", "metrics", "events", "dd:watch", "dd:trigger", "dd:container-sync", "dd:logs"], but this doc still shows only the first six entries, missing dd:container-sync and dd:logs.

Fix
   "capabilities": ["compose", "exec", "metrics", "events", "dd:watch", "dd:trigger"]
+  "capabilities": ["compose", "exec", "metrics", "events", "dd:watch", "dd:trigger", "dd:container-sync", "dd:logs"]

As per path instructions, docs should be reviewed for accuracy against the code (in this case, the OpenAPI spec).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/docs/api-reference.mdx` around lines 56 - 68, Update the
capabilities array in the GET /_portwing/info example to match
InfoResponse.capabilities in api/openapi.yaml by adding "dd:container-sync" and
"dd:logs" after the existing dd:trigger entry.

Source: Path instructions

🧹 Nitpick comments (2)
examples/kubernetes/edge.yaml (1)

143-152: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

hostPath for stacks is correct but widens the container's reach into the node's filesystem.

Switching from emptyDir to hostPath is the right fix for restart persistence, and the comment correctly notes fsGroup doesn't apply to hostPath. Two things worth a second look:

  • DirectoryOrCreate means kubelet will auto-create /var/lib/portwing/stacks (root-owned) if the operator skips the documented install -d step — the pod will then fail to write. That's already flagged in the comment, so acceptable as-is.
  • This grants the agent write access to an arbitrary path on the node's disk, in addition to the already-required Docker socket access. Given the agent already needs docker-sock hostPath, this is a modest incremental widening, not a new class of risk — flagging for awareness only.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/kubernetes/edge.yaml` around lines 143 - 152, The hostPath change is
acceptable as-is; retain the stacks volume configuration and its documentation.
No code changes are required, but ensure deployment guidance clearly instructs
operators to pre-create /var/lib/portwing/stacks with ownership for the non-root
container UID before starting the pod.
api/openapi.yaml (1)

502-539: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚖️ Poor tradeoff

MCPResponse doesn't enforce result/error exclusivity.

result and error are both plain optional object properties; nothing models the JSON-RPC "exactly one of result or error" contract. Consider oneOf with required per branch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/openapi.yaml` around lines 502 - 539, Update the MCPResponse schema to
enforce exactly one of result or error using oneOf branches, with one branch
requiring result and the other requiring error. Preserve the shared jsonrpc and
id fields while ensuring each response cannot contain both or neither property.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/openapi.yaml`:
- Around line 757-765: Update the limit query parameter schema in the OpenAPI
definition to match the documented API behavior: remove the minimum: 1
constraint so zero and negative integer values are accepted, while retaining the
existing description and example.

In `@docs/content/docs/standalone-mode.mdx`:
- Line 168: Deduplicate capabilities returned by handleInfo before encoding the
response. Update the capability aggregation around handleInfo to filter repeated
values, including events already present in the base capabilities and generic
adapter capabilities, while preserving the existing order.

---

Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 392-406: Update the harden-runner comment near the egress policy
to state that the allowlist is shared by all 6 matrix variants instead of 5.

In @.github/workflows/release-cut.yml:
- Around line 100-112: Update the major-bump check in the commit-subject loop to
use a regex that only matches an exclamation mark in the conventional-commit
prefix before the first colon, such as `^[^:]+!:`; retain the existing
major-bump behavior while preventing later punctuation in the subject from
triggering it.

In `@docs/content/docs/api-reference.mdx`:
- Around line 56-68: Update the capabilities array in the GET /_portwing/info
example to match InfoResponse.capabilities in api/openapi.yaml by adding
"dd:container-sync" and "dd:logs" after the existing dd:trigger entry.

---

Nitpick comments:
In `@api/openapi.yaml`:
- Around line 502-539: Update the MCPResponse schema to enforce exactly one of
result or error using oneOf branches, with one branch requiring result and the
other requiring error. Preserve the shared jsonrpc and id fields while ensuring
each response cannot contain both or neither property.

In `@examples/kubernetes/edge.yaml`:
- Around line 143-152: The hostPath change is acceptable as-is; retain the
stacks volume configuration and its documentation. No code changes are required,
but ensure deployment guidance clearly instructs operators to pre-create
/var/lib/portwing/stacks with ownership for the non-root container UID before
starting the pod.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a7b240e-b9a1-4cfe-8a07-d3861af212cc

📥 Commits

Reviewing files that changed from the base of the PR and between b15a752 and cd5fbe0.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !CHANGELOG.md
📒 Files selected for processing (17)
  • .github/workflows/ci.yml
  • .github/workflows/quality-fuzz-monthly.yml
  • .github/workflows/quality-fuzz-nightly.yml
  • .github/workflows/release-cut.yml
  • CONTRIBUTING.md
  • Dockerfile.armv7
  • RELEASING.md
  • SPEC.md
  • api/openapi.yaml
  • docs/content/docs/api-reference.mdx
  • docs/content/docs/audit-logging.mdx
  • docs/content/docs/observability.mdx
  • docs/content/docs/standalone-mode.mdx
  • examples/README.md
  • examples/kubernetes/edge.yaml
  • examples/kubernetes/standard.yaml
  • lefthook.yml

Comment thread api/openapi.yaml Resolved
Comment thread docs/content/docs/standalone-mode.mdx Resolved
- 🐛 fix(release-cut): match `!` only in the conventional-commit prefix
  (`^[^:]+!:`) so a stray `!:` later in a subject can't trigger a major bump
- 🔧 config(openapi): drop `minimum: 1` on the /_portwing/audit `limit` param —
  the handler treats 0/negative as "return all", which the schema now permits
- 📝 docs(api-reference): add dd:container-sync/dd:logs to the GET /_portwing/info
  capabilities example to match the OpenAPI InfoResponse
- 🔧 config(ci): correct the harden-runner comment (6 fuzz matrix variants, not 5)
@scttbnsn

Copy link
Copy Markdown
Contributor Author

Addressed the review in 0143186.

Applied:

  • api/openapi.yaml — dropped minimum: 1 on the audit limit param (handler treats 0/negative as "return all").
  • docs/content/docs/api-reference.mdx — added dd:container-sync/dd:logs to the /_portwing/info capabilities example to match the OpenAPI InfoResponse.
  • .github/workflows/release-cut.yml — tightened the major-bump regex to ^[^:]+!: so a stray !: later in a subject can't trigger a major bump (verified against feat!:, config(ci)!:, and fix: embed !: text).
  • .github/workflows/ci.yml — fixed the harden-runner comment (6 fuzz matrix variants, not 5).

Not doing here (with reasons):

  • handleInfo capabilities dedup — replied on the inline thread: it's a runtime API-shape change, out of scope for a docs-sync PR; the doc now accurately describes the current behavior.
  • MCPResponse oneOf result/error exclusivity — skipping. This is a read-only internal endpoint and the oneOf branching isn't worth the schema complexity (tagged "poor tradeoff"); the description already says it returns a JSON-RPC 2.0 response object.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-cut.yml:
- Around line 101-105: Restrict the major-bump check in the release workflow’s
commit-subject loop to valid Conventional Commit syntax: accept only recognized
types such as feat or fix, with an optional scope, followed by !:. Update the
regex used by the subject check and add coverage for feat!:, fix(api)!, and an
invalid free-form subject like urgent deployment!:.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 77d9485e-56a2-49d1-8723-a4ca17970800

📥 Commits

Reviewing files that changed from the base of the PR and between cd5fbe0 and 0143186.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/release-cut.yml
  • api/openapi.yaml
  • docs/content/docs/api-reference.mdx
💤 Files with no reviewable changes (1)
  • api/openapi.yaml
✅ Files skipped from review due to trivial changes (1)
  • docs/content/docs/api-reference.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/release-cut.yml Resolved

@ALARGECOMPANY ALARGECOMPANY left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pass-2 audit fixes reviewed. OpenAPI contract additions match the served routes, the k8s example fixes are correct (hostPath persistence + keygen redirect), FuzzEnvelope wiring is sound, and the CodeRabbit follow-ups are handled (regex over-tightening correctly declined — its suggestion breaks the emoji-prefixed commit convention). LGTM.

@biggest-littlest biggest-littlest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Second approval. Docs-site and process-doc corrections are accurate against the code, CI fuzz coverage gap closed, and verification (build/vet/actionlint/zizmor/qlty) is clean. LGTM.

@scttbnsn
scttbnsn merged commit 1d8d346 into main Jul 11, 2026
26 checks passed
@scttbnsn
scttbnsn deleted the fix/audit-pass-2 branch July 11, 2026 01:45
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.

3 participants