Skip to content

design-15 S3: sing-box sidecar annotation + bounded inspect enrichment#5

Draft
lr00rl wants to merge 1 commit into
mainfrom
feat/singbox-sidecar-line-uuid
Draft

design-15 S3: sing-box sidecar annotation + bounded inspect enrichment#5
lr00rl wants to merge 1 commit into
mainfrom
feat/singbox-sidecar-line-uuid

Conversation

@lr00rl

@lr00rl lr00rl commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

design-15 S3 agent slice:

  • Sidecar annotation: reads /etc/sing-box/lattice-metadata.json (env override LATTICE_SINGBOX_META), joins by inbound tag, fills LineUUID + DownstreamLineUUID on every reported SingBoxNode. Missing file / corrupt JSON / legacy v1 flat sidecar all degrade quietly — discovery never fails on a read-only annotation. Applies to both the primary list path and the runtime-config fallback.
  • Bounded inspect enrichment: closes the known primary-path gap — per line, sb --json inspect <name> backfills outbound tag/type, line_id, node_uuid, and user roster (cap 64 calls/cycle, per-call timeout, first-call-failure detects older sb and stops). Fill-only-empty; config join still resolves outbound server/port.
  • lattice-agent flag/env: -singbox-meta / LATTICE_SINGBOX_META; README updated.
  • Pins lattice-sdk@60c69bd (draft PR lattice-sdk#7).

Verification

  • gofmt/go vet clean; go test ./... all ok
  • New tests cover: sidecar missing/corrupt/v1/v2 (contract fixtures in testdata), tag join hit/miss, inspect mapping, inspect-failure fallback, call cap

Refs LatticeNet/lattice#2, LatticeNet/lattice-sdk#7, LatticeNet/lattice-server#13.

Discovery now annotates each reported line with the control-plane
line_uuid and declared downstream_line_uuid from the v2 sidecar
(/etc/sing-box/lattice-metadata.json, LATTICE_SINGBOX_META override),
joined by inbound tag; missing/corrupt/legacy-v1 sidecars degrade
quietly and never fail discovery.

The primary list path is also enriched per line via bounded
`sb --json inspect <name>` calls (cap 64, per-call timeout,
first-call-failure detection for older sb builds), filling outbound
tag/type, line_id, node_uuid, and the user roster the plain list omits.
Fill-only-empty in both enrichers; existing config join keeps resolving
outbound server/port.

Pins lattice-sdk @60c69bd (draft PR lattice-sdk#7).
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