routeros: ordering convention from mktxp patterns (#67) #134
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/iac!134
Loading…
Reference in a new issue
No description provided.
Delete branch "routeros-ordering-convention"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the missing piece of #67: the ordering convention, written down, plus the one renderer behavior worth stealing from akpw/mktxp.
Premise correction first (full analysis in docs/routeros/notes/2026-11-17-mktxp-patterns.md): mktxp is not a Go apply CLI — it is a Python exporter/GitOps toolkit whose rsc module does live /export -> normalize -> format/split, device-to-git only. It never applies, so it never solved ordering-on-apply; its answer is "the device's export order is the record." That stance validates two of our choices (copy ordered menus verbatim; keep tooling comment-opaque) and contributes one mechanism we lacked.
Code (routeros/render):
Docs: docs/routeros/README.md gains the #67 convention section (declared order = device order = render order; place_before rejected; move_items as gate-proven janitor; comments stay comma-free import keys with step-10 numbers deferred to #69, where planned_values first needs a total order); notes file carries all path:line citations.
Verification: python3 -m py_compile, bash -n, and the new selftest check run green (printed "normalize: unordered sorts, ordered copies ok"); device selftest cases unchanged (firewall is an ordered menu, so the reorder case still fails the gate by the same path). Nothing here touches *.tf roots: merging has zero live effect; the normalize change only widens gate.sh tolerance of export jitter between renders.
mktxp verdict for #71: nothing to borrow (never writes to a device). For #72: vendoring
mktxp rsc splitstays the lazy alternative; this port keeps us dependency-free.Update
9521fe4: normalize now sorts an allowlist (SORTABLE_MENUS) and copies everything else, so dns static / queue simple / routing filter / bridge nat / ipsec policy reorders stay visible to the gate; TYPE_PATH menus must be classified. Sort-key regex fixed (interface= matched in-interface=, list= matched address-list=). Reorder demo: routeros/sim/ordering/run.sh, PASS on CHR 7.25.1 with the lab provider fork: reorder = one move_items update with every .id kept, insert/delete touch one rule, step-10 renumber is comment-only, an out-of-band move shows up in plan and is repaired. Table in docs/routeros/README.md. mktxp exporter-side review in notes section 7; monitoring follow-up is #139.9521fe448eto037157415c