Skip to content

fix(ocsf): address follow-ups from the #4288 review - #5020

Merged
krishicks merged 6 commits into
mainfrom
fix/ocsf-4288-review-follow-ups/krishicks
Oct 29, 2026
Merged

krishicks merged 6 commits into
mainfrom
fix/ocsf-4288-review-follow-ups/krishicks

Conversation

@krishicks

Copy link
Copy Markdown
Collaborator

Summary

Fix the five findings from the second review round on #4288 that were deferred to a follow-up, plus a Podman 6 failure in the new OCSF conformance e2e test.

Related Issue

Follow-up on #4288; no separate issue.

Changes

  • Fallback context (review): the fallback EventContext no longer carries a fake sandbox identity under test-support, so a binary built with the feature unified in does not attribute unbound events to a nonexistent sandbox.
  • compile_fail doctests (review): the HTTP, Network, Process, and SSH type-state doctests build their context with ctx::ctx(), so the missing required field is their only compile error.
  • Setter macros (review): the shared setter macros take an optional type-state parameter and replace the setters those four builders hand-copied; both SSH endpoint setters share one state transition.
  • Docs (review): the Network Activity example in ocsf-json-export.mdx includes the required type_uid.
  • e2e exec errors (review): ocsf_jsonl_conformance reports the last traffic exec error instead of discarding it.
  • Podman 6: ocsf_jsonl_conformance reads the sandbox ID label from podman ps --format json. Podman 6 renders .Labels in a format template as a string, so the index template failed and the test never copied records.

Testing

  • openshell-ocsf (including doctests), and the OCSF producer tests in openshell-supervisor-network, openshell-supervisor-process, and openshell-server pass on this branch
  • Each rewritten compile_fail doctest compiled once its missing setter was added, so the missing field is its only error
  • New unit test for the fallback context fails before the change
  • mise run pre-commit and Podman e2e ocsf_jsonl_conformance pass with these commits on top of feat(ocsf): validate OCSF events against exported JSON Schemas #5019; on this branch the e2e test passes clippy
  • Unit tests added/updated
  • E2E tests added/updated

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

With test-support, the fallback EventContext carried a fake sandbox
identity, so a binary built with that feature unified in, such as by
cargo build --workspace --all-targets, attributed unbound events to a
sandbox that does not exist. Producer tests no longer need it: the
validator accepts top-level container on its own, and the builder
conformance test uses an explicit sandbox context.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
The HTTP, Network, Process, and SSH type-state doctests built their
EventContext from a struct literal, so a new EventContext field would
also make them fail to compile and they would keep passing with the
guard removed. Build the context with ctx::ctx() so the missing
required field is the only compile error.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
The HTTP, Network, Process, and SSH builders carry a type-state
parameter, so they hand-copied the activity, action, disposition,
severity, status, and message setters that the shared macros generate
for other builders. Let the macros take an optional state parameter and
use them on all four, and route both SSH endpoint setters through one
state transition.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
OCSF 1.8.0 requires type_uid, so the example that follows the
conformance claim failed validation as written.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
The test discarded the result of the exec that generates traffic, so
when the exec failed, for example without python3 in the image, the
test retried for a minute and then blamed the JSONL copy. Keep the
latest exec error and include it in the missing-classes failure.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
Signed-off-by: Kris Hicks <khicks@nvidia.com>
@github-actions

Copy link
Copy Markdown

@krishicks krishicks added the test:e2e Requires end-to-end coverage label Oct 28, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for c62e567. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway, sandbox, and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@krishicks
krishicks enabled auto-merge October 28, 2026 23:01
@krishicks
krishicks added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit f88b581 Oct 29, 2026
164 checks passed
@krishicks
krishicks deleted the fix/ocsf-4288-review-follow-ups/krishicks branch October 29, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants