Skip to content

feat(events-export): EXP - the proto, the generation, the conversion (V404) - #393

Merged
randomizedcoder merged 1 commit into
mainfrom
goip/events-export-exp
Dec 5, 2026
Merged

randomizedcoder merged 1 commit into
mainfrom
goip/events-export-exp

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

What

Tier EXP of the events export plan (PR #391): the proto — proto/xtcp_netlink_events/v1/ — the five family messages, the wrapper, the envelope; the generation into all five gen/ targets; the conversion; and the round-trip gate.

The proto

Block Family
2100 LinkEvent — ifinfomsg + the scalar IFLA_* attributes
2200 AddrEvent — ifaddrmsg + IFA_*
2300 RouteEvent — rtmsg + RTA_*
2400 NeighEvent — ndmsg + NDA_*
2500 RuleEvent — fib_rule_hdr + FRA_* (the family §14 predates)

The house style, applied: kernel member spelling; attributes as the lowercased enum constant (the inet_diag_tos precedent); presence as an explicit has_ bool beside the value (the structs' own Has* pairs — load-bearing for the events' render semantics); and a kernel-source comment on every field with the attribute number read from the kernel headers. The blocks sit above 2047 (3-byte tags) — §14 assigns the numbers, EXM's measured low volume makes the cost immaterial.

The v1 surface: the header structs and the scalar attributes; the nested payloads (the forty per-kind link nests, RTA_MULTIPATH, the stats blocks) are presence bits — each a later block, never an epoch bump. XtcpNetlinkEventsSchemaVersion = 1 lands beside the record's epoch constant with its own history block.

The gate

  • TestEventsExportConvertRoundTrip: the 71 committed event pcaps + the 15 crafted .nl files — parse, convert, marshal, unmarshal, proto.Equal — 458 link, 165 addr, 303 route, 107 neigh, 10 rule, the totals pinned.
  • TestEventsExportConvertSpotPins: the struct's own values against the converted fields, one corpus event per family — the round trip alone cannot catch a swapped mapping (both directions would carry the same wrong field).

Groundwork for EXC (recorded in the ledger)

The committed clickhouse_protolist artifacts pin the ProtobufList framing: insert4294967295.proto.bin is [varint][Record bytes] while insert1_and_4294967295.bin is [varint][Envelope] — and the record's kafka table names the ROW type ("ClickHouse's ProtobufList handles the envelope framing internally"). Which schema name the events' engine table names, and how the oneof maps to columns, is EXC-T01's container probe.

Notes

  • stats_is64, not stats_is_64: the digits split their own word in the generated Go name (StatsIs_64) — the rename fixes the generator's naming in the field, not around it.
  • The regen's buf.lock re-resolve (a newer protovalidate commit) is reverted: the events proto imports nothing, so the outputs are lock-independent. The drift is the regen path's own behavior, noted for the next arc that regenerates.

Gates

Both full suites, vet both modes, gofmt, lint-baseline, test-goip-docs, netlink-audit, nix-fmt, test-goip-monitorfile, buf lint (STANDARD, clean) — green.

🤖 Generated with pi

…(V404)

Tier EXP of the events export plan: proto/xtcp_netlink_events/v1/ - the
five family messages (link, addr, route, neigh, rule) in the 2100-2500
blocks, continuing the record proto's field-number plan; the NetlinkEvent
wrapper (the nlmsghdr, the timestamp, the netns provenance, the derived
action enum, the oneof) and the Envelope batch container, the record
path's own ProtobufList wire shape.

The house style, applied: kernel member spelling (ifi_index, ndm_state),
attributes as the lowercased enum constant (ifla_operstate, the
inet_diag_tos precedent), presence as an explicit has_ bool beside the
value - the parser structs' own Has* pairs, load-bearing for the events'
render semantics - and a kernel-source comment on every field with the
attribute number read from the kernel headers (if_link.h, if_addr.h,
rtnetlink.h, neighbour.h, fib_rules.h). The blocks sit above 2047 (3-byte
tags); 14 assigns the numbers and EXM's measured low volume is what makes
the cost immaterial.

The v1 surface: the header structs and the scalar attributes; the nested
payloads (the forty per-kind link nests, RTA_MULTIPATH, RTA_METRICS, the
stats blocks) are presence bits - each a later block, never an epoch bump.
XtcpNetlinkEventsSchemaVersion = 1 lands beside the record's epoch
constant with its own history block.

Generated by nix run .#regen-protos into all five gen/ targets (the
events proto imports nothing, so the regen's buf.lock re-resolve is
reverted - the outputs are lock-independent). The conversion
(pkg/xtcp/events_export_convert.go) is a pure function per family plus
the ConvertNetlinkEvent wrapper, any other payload an error rather than a
silent drop.

The gate: TestEventsExportConvertRoundTrip walks the 71 committed event
pcaps and the 15 crafted .nl files - parse, convert, marshal, unmarshal,
proto.Equal - 458 link, 165 addr, 303 route, 107 neigh, 10 rule, the
totals pinned. TestEventsExportConvertSpotPins compares the struct's own
values against the converted fields for one corpus event per family: the
round trip alone cannot catch a swapped mapping, both directions would
carry the same wrong field.

Groundwork for EXC, recorded in the ledger: the committed
clickhouse_protolist artifacts pin the ProtobufList framing -
insert4294967295.proto.bin is [varint][Record bytes] while
insert1_and_4294967295.bin is [varint][Envelope] - and the record's
kafka table names the ROW type. Which schema name the events' engine
table names, and how the oneof maps to columns, is EXC-T01's probe.

Gates: both full suites, vet both modes, gofmt, lint-baseline,
test-goip-docs, netlink-audit, nix-fmt, test-goip-monitorfile, buf lint
(STANDARD, clean).

Next free evidence: V405.

🤖 Generated with [pi](https://github.com/badlogic/pi-mono)
@randomizedcoder
randomizedcoder merged commit 2069b35 into main Dec 5, 2026
1 check passed
@randomizedcoder
randomizedcoder deleted the goip/events-export-exp branch December 5, 2026 07:34
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