Repository navigation
feat(goldenrec): shape profiles — compare a capture whose workload differs - #323
Merged
Merged
Conversation
…exists A golden capture from another host can't be diffed row for row: its workload differs. What can be compared is its shape: which columns are populated, which enum values occur, which families and namespace kinds. - TestProfile, TestProfileKinds: per-column class, nonzero count and distinct count (capped at 64+), value sets for enum columns only (a container name is counted, never recorded), families, namespace kinds. - TestDiffProfiles: populated-only-in, value-only-in, column-only-in, family-missing, no-rows; row counts and distinct magnitudes ignored. - TestRunProfileShapeDiff: xtcp2-golden profile and shape-diff, taking a .parquet or a profile .json, exit 0/1/2 like diff. Red: pkg/goldenrec and cmd/xtcp2-golden do not build (ProfileOf, ColumnProfile, Profile, DiffProfiles undefined). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ffers - goldenrec.ProfileOf: per column its class, nonzero count, distinct count (64+ past 64) and, for numeric/bool Strict columns and a few enum-like strings, the value set; rows per family and per kind of namespace. No identity: container names, images, labels and the like are counted, never listed. - goldenrec.DiffProfiles: populated-only-in, value-only-in, column-only-in, family-missing, kind-missing, no-rows; row counts and distinct magnitudes are ignored. - xtcp2-golden profile IN and shape-diff A B (each a .parquet or a profile .json), exit 0/1/2 like diff. - nix/README (Golden records) and CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A profile leaves the host it was taken on. Listing every numeric Strict column's values would carry ASNs, uids and cgroup class ids. Values are now listed only for columns profileListed marks true, and a test makes every valued column carry an explicit decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
goconst (comprehensive tier) flagged the repeated literals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assigned is a valued class now that it exists on main, and nsid_assigned is on the listing allowlist; nsid itself stays counted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A capture from another host can't be diffed row by row against the golden fixture, because its workload differs. Its shape can. This adds a shape profile and a shape diff to
xtcp2-golden. Done test-first.Feature
xtcp2-golden profile IN: JSON with the row count, and per column the class, nonzero count and distinct count (capped at64+). Also rows per family and per kind of namespace (container, host, docker, anon, named, unknown)xtcp2-golden shape-diff A B: A and B are each a.parquetor aprofile.json. Reportspopulated-only-in,value-only-in,column-only-in,family-missing,kind-missing,no-rows, and ignores row counts and distinct-count size. Exits 0/1/2 likediffprofileListed: socket enums, congestion control, NIC driver, vendor, device and speed). ASNs, uids, class ids, container names and images, and interface names are only countednsid_assigned(from fix(xtcp2): nsid_assigned — tell the kernel's first nsid (0) apart from none #322) is listed andnsidis countedTests
TestProfile,TestProfileKinds,TestDiffProfiles,TestProfileListed,TestRunProfileShapeDiff: table-driven, all four categoriesTestProfileListedDecided: every column of a valued class needs an explicit list-or-count decision, so a new column never lists its values by defaultTestProfileNsidAssigned:nsid_assignedvalues listed, the ids only countedRed (tests commit, before the feature)
After merging #322, before
Assignedwas a valued class:Green
go test ./...and the nix checks (gofmt, go-vet, nix-fmt, lint-baseline, golangci ×3, redteam-lint, golden-records, test-fuzz-all) pass.🤖 Generated with Claude Code