Guidance for coding agents working on miapd — a DHCPv6 Prefix Delegation
(IA_PD) client daemon for Arista EOS. Read docs/design.md first; it is
the terse as-built description of the system, including the hardware
findings that shaped it.
just build # workspace, no EOS SDK needed (miapd-eos-sys builds as a stub)
just test # all unit tests, hardware-free
just clippy # -D warnings
just fmt # rustfmt
just deny # license check
Everything above runs on any machine. The sdk feature flavor compiles
the real C++ shim and must ALSO pass before a change is done:
podman exec -e EOS_SDK_DIR=/workspace/eos_sdk_dir -w /workspace/miapd miapd-build \
sh -c '. "$HOME/.cargo/env" && cargo clippy --workspace --features sdk --all-targets -- -D warnings'
The miapd-build container (AlmaLinux 9.3, glibc-matched to the switch,
SDK headers + the switch's libeos mounted) is described in
crates/miapd-eos-sys/README.md. ./scripts/package-swix.sh builds the
deployable SWIX inside it.
- No freestanding functions where a method fits; no stringly-typed
values. Closed sets are enums (
OptionKey,StatusKey,EosOp); domain values are newtypes (PrefixOffset,HostOffset,ValidLifetime, ...). Parsing from strings happens once, at the boundary. - All switch access goes through the
EosControltrait; daemon logic must stay testable againstMockEosControl(which records the exact op sequence) andMockLeaseStore. - Comments state constraints the code can't show. No section-number
references —
docs/design.mduses named sections. - Edit files with your editor/tools directly; don't shell out to sed/python for file edits.
- Unit tests must stay hardware-free and pass via
just test. - Changes to
miapd-eos-sys(shim),miapd-eosbackends, or anything touching SDK/eAPI behavior need validation on a real switch — mocks cannot catch EOS's behavioral quirks (several were only found live). Ask the operator for switch access; never hardcode switch addresses, usernames, or key paths into the repo. - The on-switch lab recipe (EOS's bundled
kea-dhcp6on a scratch SVI) is indocs/design.mdunder "Build, packaging, testing". Use a fresh scratch interface per session and tear everything down afterward.
- SDK C++ exceptions crossing the cxx bridge terminate the process;
every shim function catches internally and is declared
Result. - SDK-written interface addresses silently lose source arbitration to
CLI config — addresses are written via eAPI only. Don't "fix" this
back to
ip_intf_mgrwrites. ip_intf_mgr::ip_addrsreturns IPv4 entries too; filter them.- Agent config/status persist in Sysdb across daemon deregistration (not reboot). Orphaned address config blocks the same /64 anywhere else — the applied-downstream ledger exists for this; keep it accurate in every install/withdraw path.
- EOS binary names must not contain dashes. ProcMgr backs off restarts after crashes — a freshly bounced daemon may take minutes to appear.
- When driving a switch over SSH, use single spaced-out connections; rapid polling loops can exhaust the CLI session broker and lock everyone out.
- Keep
docs/design.mdcurrent when behavior changes; it describes the implemented system, not aspirations. - Commit messages: one concise summary line, a short body if needed.
- The repo must stay free of environment specifics (lab IPs, key paths, container mount paths beyond the documented defaults).