fix(mcp): принять пропажу автоматического LL пустого моста при выходе из VRF через PATCH
Решение владельца по эксперименту на стенде: адрес может не вернуться; возврат принимается один раз. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
1dda615b06
commit
782d1d52ab
3 files changed
+154
-22
No files matched your search
@@ -246,4 +246,76 @@ for (const [label, current, mutate] of [
|
||||
await assert.rejects(settleVrfTransition(changed, after => classifyVrfProductionTransition({ ...current, after }), async () => { rereads++; return structuredClone(current.after) }, noPause), /VRF production transition refused/, label)
|
||||
assert.equal(rereads, 0, label); cases++
|
||||
}
|
||||
// Owner decision 2026-11-18 (stand experiment, docs/mcp-stand-run-a-plan.md 1dda615b): a membership PATCH that moves an
|
||||
// empty concrete bridge out of the VRF may lose its automatic LL; the loss is revival debt settled once by a reappearance.
|
||||
// Native bridge chain of the model (gre=false): reenable -> PATCH interfaces a -> b (bridge a returns to main).
|
||||
{
|
||||
const open = (checkpoint: VrfProductionTransitionCheckpoint) => openVrfProductionTransitionCheckpoint(sealVrfProductionTransitionCheckpoint(checkpoint, createdScope, secret), createdScope, secret)
|
||||
const durable = (checkpoint: VrfProductionTransitionCheckpoint) => JSON.parse(Buffer.from(sealVrfProductionTransitionCheckpoint(checkpoint, createdScope, secret).split(".")[0], "base64url").toString()).history
|
||||
let chainBefore = snapshot("vrf-create", false), chainPrevious = open(classifyVrfProductionTransition(input(snapshot("addresses-before-vrf", false), chainBefore, base.request, undefined, base.acknowledgedId)).checkpoint)
|
||||
for (let index = 1; index <= 3; index++) {
|
||||
const after = snapshot(stages[index], false)
|
||||
chainPrevious = open(classifyVrfProductionTransition(input(chainBefore, after, inputs[index].request, chainPrevious)).checkpoint); chainBefore = after
|
||||
}
|
||||
const reenabled = chainBefore, transfer = inputs[4].request, vrfRow = reenabled.catalogs.vrf.find(row => row[".id"] === transfer.id)!
|
||||
const leaving = String(vrfRow.interfaces), joining = String(transfer.fields.interfaces)
|
||||
assert.equal(reenabled.catalogs.interface_inventory.find(row => row.name === leaving)?.type, "bridge")
|
||||
const linkLocalRoute = (row: Row, name: string) => String(row["dst-address"]).startsWith("fe80::") && [row.gateway, row["immediate-gw"]].some(value => value === name || String(value ?? "").startsWith(name + "@"))
|
||||
const withoutLl = (s: VrfProductionSnapshot, name: string) => {
|
||||
const copy = structuredClone(s)
|
||||
copy.catalogs.ipv6_address = copy.catalogs.ipv6_address.filter(row => !(row.dynamic === "true" && row.interface === name))
|
||||
copy.catalogs.ipv6_route = copy.catalogs.ipv6_route.filter(row => !linkLocalRoute(row, name))
|
||||
return copy
|
||||
}
|
||||
const transferred = snapshot(stages[4], false)
|
||||
assert.ok(transferred.catalogs.ipv6_address.some(row => row.dynamic === "true" && row.interface === leaving))
|
||||
const left = withoutLl(transferred, leaving)
|
||||
// (a) leave-VRF with the bridge LL and its fe80 route gone: accepted at once (no re-read) and recorded as debt.
|
||||
let rereads = 0
|
||||
const leftResult = await settleVrfTransition(left, after => classifyVrfProductionTransition(input(reenabled, after, transfer, chainPrevious)), async () => { rereads++; return left }, async () => {})
|
||||
assert.equal(leftResult.status, "explained-native-transition"); assert.equal(rereads, 0)
|
||||
assert.deepEqual(durable(leftResult.checkpoint).leftBridgeLl.map((item: { member: string }) => item.member), [leaving]); cases++
|
||||
const leftPrevious = open(leftResult.checkpoint)
|
||||
assertVrfProductionHistoryProvenance(leftPrevious, left); cases++
|
||||
// Before this owner decision the same PATCH was refused (the generic absence path), not merely re-read forever.
|
||||
// (b) rejoin (PATCH interfaces b -> a) with the LL back: the debt is settled once with the recorded fields.
|
||||
const rejoin: VrfProductionRequest = { action: "patch", id: transfer.id, fields: { interfaces: leaving } }
|
||||
// b goes back to main without its LL: its own acquisition debt (absentLl) keeps the pre-existing DELETE-only revival rule.
|
||||
const rejoined = withoutLl(reenabled, joining)
|
||||
const rejoinResult = classifyVrfProductionTransition(input(left, rejoined, rejoin, leftPrevious))
|
||||
assert.equal(rejoinResult.status, "explained-native-transition"); assert.equal(durable(rejoinResult.checkpoint).leftBridgeLl, undefined); cases++
|
||||
// ... once: the settled history cannot adopt the same reappearance again.
|
||||
assert.throws(() => classifyVrfProductionTransition(input(left, rejoined, rejoin, open(rejoinResult.checkpoint))), /new address\/route adoption forbidden/); cases++
|
||||
// (c) the LL came back while the bridge stayed in main (it is in the next before): settled once, same fields.
|
||||
const backInMain = classifyVrfProductionTransition(input(transferred, rejoined, rejoin, leftPrevious))
|
||||
assert.equal(durable(backInMain.checkpoint).leftBridgeLl, undefined); cases++
|
||||
const drifted = structuredClone(transferred)
|
||||
drifted.catalogs.ipv6_address.find(row => row.dynamic === "true" && row.interface === leaving)!["auto-link-local"] = "false"
|
||||
assert.throws(() => classifyVrfProductionTransition(input(drifted, rejoined, rejoin, leftPrevious)), /VRF production/); cases++
|
||||
// (d) still absent on the rejoin: the debt is carried, neither adopted nor refused.
|
||||
const carried = classifyVrfProductionTransition(input(left, withoutLl(rejoined, leaving), rejoin, leftPrevious))
|
||||
assert.deepEqual(durable(carried.checkpoint).leftBridgeLl.map((item: { member: string }) => item.member), [leaving]); cases++
|
||||
// (e) refused at once, no settling re-read: non-empty bridge, changed bridge row, missing static address, extra missing row.
|
||||
const refusedNow = async (before: VrfProductionSnapshot, after: VrfProductionSnapshot, label: string, reason: RegExp) => {
|
||||
let count = 0
|
||||
await assert.rejects(settleVrfTransition(after, next => classifyVrfProductionTransition(input(before, next, transfer, chainPrevious)), async () => { count++; return after }, async () => {}), reason, label)
|
||||
assert.equal(count, 0, label); cases++
|
||||
}
|
||||
const bridgeId = String(reenabled.catalogs.bridge.find(row => row.name === leaving)![".id"])
|
||||
const ported = (s: VrfProductionSnapshot) => { const copy = structuredClone(s); copy.catalogs.bridge_vlan.push({ ".id": "*ff70", bridge: leaving, "vlan-ids": "10", tagged: leaving, untagged: "", disabled: "false" }); return copy }
|
||||
await refusedNow(ported(reenabled), ported(left), "non-empty bridge", /PATCH bridge LL empty configuration/)
|
||||
const changedBridge = structuredClone(left); changedBridge.catalogs.bridge.find(row => row.name === leaving)!.mtu = "1400"
|
||||
await refusedNow(reenabled, changedBridge, "changed bridge row", /opaque configuration drift/)
|
||||
const noStatic = structuredClone(left); noStatic.catalogs.ipv4_address = noStatic.catalogs.ipv4_address.filter(row => row.interface !== leaving)
|
||||
await refusedNow(reenabled, noStatic, "missing static address", /VRF production transition refused/)
|
||||
const extraMissing = structuredClone(left); extraMissing.catalogs.ipv6_address = extraMissing.catalogs.ipv6_address.filter(row => !(row.interface === leaving && row.dynamic !== "true"))
|
||||
await refusedNow(reenabled, extraMissing, "extra missing static IPv6 row", /VRF production transition refused/)
|
||||
assert.ok(bridgeId.startsWith("*"))
|
||||
// (f) GRE LL loss on the same PATCH shape stays transient-only: settled re-reads, then the same refusal.
|
||||
const greBefore = inputs[3].after, greAfter = withoutLl(inputs[4].after, String(greBefore.catalogs.vrf.find(row => row[".id"] === transfer.id)!.interfaces))
|
||||
let greRereads = 0
|
||||
await assert.rejects(settleVrfTransition(greAfter, after => classifyVrfProductionTransition({ ...inputs[4], after }), async () => { greRereads++; return greAfter }, async () => {}), /VRF production transition refused/)
|
||||
assert.equal(greRereads, VRF_SETTLING_REREADS); cases++
|
||||
assert.ok(joining && joining !== leaving)
|
||||
}
|
||||
console.log("GRE captured auto-LL, synthetic lifecycle, durable endpoints, negative conservation cases:", cases)
|
||||
@@ -9,7 +9,7 @@ type Row = VrfProductionRow
|
||||
export interface VrfProductionTransitionCheckpoint { readonly kind: "vrf-production-transition-checkpoint-v1" }
|
||||
interface SnapshotProof { kind: "configuration-sha256-v1" | "configuration-sha256-v2"; serverId: number; sourceProof: string; catalogDigests: Record<string, string> }
|
||||
interface CausalProvenance { inactiveCycle?: Row; missingMembers: Row[]; greMembers?: Row[] }
|
||||
interface History { snapshot: VrfProductionSnapshot | SnapshotProof; vrfId: string; activeVirtual?: Row; dormantTable?: Row; absentLl: Array<{ address: Row; route: Row; member: string }>; provenance: CausalProvenance }
|
||||
interface History { snapshot: VrfProductionSnapshot | SnapshotProof; vrfId: string; activeVirtual?: Row; dormantTable?: Row; absentLl: Array<{ address: Row; route: Row; member: string }>; leftBridgeLl?: Array<{ address: Row; route: Row; member: string }>; provenance: CausalProvenance }
|
||||
const histories = new WeakMap<VrfProductionTransitionCheckpoint, History>()
|
||||
export interface VrfProductionCheckpointScope { serverId: number; sourceProof: string; actorId: string; nativeId: string }
|
||||
const checkpointPurpose = "mmapp-vrf-production-transition-history-v1\0"
|
||||
@@ -244,27 +244,62 @@ function routeFor(row: Row, source: Source, vrfs: Row[]): boolean {
|
||||
if (row["routing-table"] !== table || row.gateway !== gateway || row["immediate-gw"] !== source.member || row.interface !== undefined && row.interface !== "" && row.interface !== source.member) return false
|
||||
return row["local-address"] === undefined || row["local-address"] === `${String(source.row.address).split("/")[0]}%${gateway}`
|
||||
}
|
||||
/** Facts shared by the two accepted losses of one automatic LL from an
|
||||
* unchanged, empty concrete bridge returning to main. Each wrapper asserts
|
||||
* them in the same order with its own closed reasons. */
|
||||
function bridgeLinkLocalLoss(before: VrfProductionSnapshot, after: VrfProductionSnapshot, source: Source, oldRoute: Row, beforeSources: Source[], afterSources: Source[]) {
|
||||
const name = source.member
|
||||
const parents = [before, after].map(snapshot => snapshot.catalogs.interface_inventory.filter(row => row.name === name))
|
||||
const parent = () => parents[0][0]
|
||||
const routeReference = (row: Row) => [row.gateway, row["immediate-gw"], row.interface].some(value => typeof value === "string" && (value === name || value === parent()[".id"] || value.startsWith(name + "@") || value.startsWith(String(parent()[".id"]) + "@")))
|
||||
const linkLocalRoute = (row: Row) => { try { return prefix(row["dst-address"], 6).network === source.network && routeReference(row) } catch { return false } }
|
||||
return {
|
||||
concreteParent: () => parents.every(rows => rows.length === 1) && parents.every(rows => rows[0].type === "bridge" && rows[0].disabled === "false" && rows[0].running === "true" && rows[0].dynamic === "false") && parents[0][0][".id"] === parents[1][0][".id"] && parents[0][0]["mac-address"] === parents[1][0]["mac-address"],
|
||||
emptyConfiguration: () => [before, after].every(snapshot => {
|
||||
const id = parent()[".id"], bridges = snapshot.catalogs.bridge.filter(row => row.name === name)
|
||||
const reference = (value: unknown) => typeof value === "string" && value.split(",").some(item => [name, id].includes(item.trim()))
|
||||
return bridges.length === 1 && bridges[0][".id"] === id && bridges[0].disabled === "false" && bridges[0].dynamic === "false" && bridges[0].running === "true" && bridges[0]["mac-address"] === parent()["mac-address"] && !snapshot.catalogs.bridge_port.some(row => reference(row.bridge) || reference(row.interface)) && !snapshot.catalogs.bridge_vlan.some(row => reference(row.bridge) || reference(row.tagged) || reference(row.untagged) || reference(row["current-tagged"]) || reference(row["current-untagged"])) && !(snapshot.catalogs.vlan ?? []).some(row => reference(row.interface))
|
||||
}),
|
||||
sameBridge: () => same("bridge", before.catalogs.bridge.find(row => row.name === name)!, after.catalogs.bridge.find(row => row.name === name)!),
|
||||
automaticProvenance: () => source.row.dynamic === "true" && source.row["auto-link-local"] === "true" && source.row["link-local"] === "true" && source.row.disabled === "false" && source.row.invalid === "false" && source.row.interface === name && source.row["actual-interface"] === name,
|
||||
eui64: () => eui64(source.row, parent()),
|
||||
staticAddressClosure: () => {
|
||||
const statics = beforeSources.filter(item => item.member === name && !item.ll)
|
||||
return statics.some(item => item.family === 4) && statics.every(item => afterSources.some(next => next.member === name && next.resource === item.resource && !next.ll && next.row[".id"] === item.row[".id"] && next.network === item.network)) && !afterSources.some(item => item.member === name && item.ll)
|
||||
},
|
||||
connectedRouteClosure: () => before.catalogs.ipv6_route.filter(linkLocalRoute).length === 1 && before.catalogs.ipv6_route.filter(linkLocalRoute)[0] === oldRoute && !after.catalogs.ipv6_route.some(linkLocalRoute),
|
||||
}
|
||||
}
|
||||
/** A terminal DELETE may remove one proven automatic LL from an unchanged,
|
||||
* empty concrete bridge. It creates no revival debt for the deleted target. */
|
||||
function deletedBridgeLinkLocal(before: VrfProductionSnapshot, after: VrfProductionSnapshot, old: Row, source: Source, oldRoute: Row, beforeSources: Source[], afterSources: Source[]): void {
|
||||
const name = source.member
|
||||
must(source.ll && source.family === 6 && no(old.disabled) && members(old.interfaces).includes(name) && context(before.catalogs.vrf, name) === old.name && context(after.catalogs.vrf, name) === "main" && !after.catalogs.vrf.some(row => row[".id"] === old[".id"]), "DELETE bridge LL owned context")
|
||||
const parents = [before, after].map(snapshot => snapshot.catalogs.interface_inventory.filter(row => row.name === name))
|
||||
must(parents.every(rows => rows.length === 1) && parents.every(rows => rows[0].type === "bridge" && rows[0].disabled === "false" && rows[0].running === "true" && rows[0].dynamic === "false") && parents[0][0][".id"] === parents[1][0][".id"] && parents[0][0]["mac-address"] === parents[1][0]["mac-address"], "DELETE bridge LL concrete parent")
|
||||
const parent = parents[0][0], id = parent[".id"]
|
||||
for (const snapshot of [before, after]) {
|
||||
const bridges = snapshot.catalogs.bridge.filter(row => row.name === name)
|
||||
const reference = (value: unknown) => typeof value === "string" && value.split(",").some(item => [name, id].includes(item.trim()))
|
||||
must(bridges.length === 1 && bridges[0][".id"] === id && bridges[0].disabled === "false" && bridges[0].dynamic === "false" && bridges[0].running === "true" && bridges[0]["mac-address"] === parent["mac-address"] && !snapshot.catalogs.bridge_port.some(row => reference(row.bridge) || reference(row.interface)) && !snapshot.catalogs.bridge_vlan.some(row => reference(row.bridge) || reference(row.tagged) || reference(row.untagged) || reference(row["current-tagged"]) || reference(row["current-untagged"])) && !(snapshot.catalogs.vlan ?? []).some(row => reference(row.interface)), "DELETE bridge LL empty configuration")
|
||||
}
|
||||
same("bridge", before.catalogs.bridge.find(row => row.name === name)!, after.catalogs.bridge.find(row => row.name === name)!)
|
||||
must(source.row.dynamic === "true" && source.row["auto-link-local"] === "true" && source.row["link-local"] === "true" && source.row.disabled === "false" && source.row.invalid === "false" && source.row.interface === name && source.row["actual-interface"] === name, "DELETE bridge LL automatic provenance")
|
||||
eui64(source.row, parent)
|
||||
const statics = beforeSources.filter(item => item.member === name && !item.ll)
|
||||
must(statics.some(item => item.family === 4) && statics.every(item => afterSources.some(next => next.member === name && next.resource === item.resource && !next.ll && next.row[".id"] === item.row[".id"] && next.network === item.network)) && !afterSources.some(item => item.member === name && item.ll), "DELETE bridge LL static address closure")
|
||||
const routeReference = (row: Row) => [row.gateway, row["immediate-gw"], row.interface].some(value => typeof value === "string" && (value === name || value === id || value.startsWith(name + "@") || value.startsWith(String(id) + "@")))
|
||||
const linkLocalRoute = (row: Row) => { try { return prefix(row["dst-address"], 6).network === source.network && routeReference(row) } catch { return false } }
|
||||
must(before.catalogs.ipv6_route.filter(linkLocalRoute).length === 1 && before.catalogs.ipv6_route.filter(linkLocalRoute)[0] === oldRoute && !after.catalogs.ipv6_route.some(linkLocalRoute), "DELETE bridge LL connected route closure")
|
||||
const facts = bridgeLinkLocalLoss(before, after, source, oldRoute, beforeSources, afterSources)
|
||||
must(facts.concreteParent(), "DELETE bridge LL concrete parent")
|
||||
must(facts.emptyConfiguration(), "DELETE bridge LL empty configuration")
|
||||
facts.sameBridge()
|
||||
must(facts.automaticProvenance(), "DELETE bridge LL automatic provenance")
|
||||
facts.eui64()
|
||||
must(facts.staticAddressClosure(), "DELETE bridge LL static address closure")
|
||||
must(facts.connectedRouteClosure(), "DELETE bridge LL connected route closure")
|
||||
}
|
||||
/** Owner decision 2026-11-18 (stand experiment, docs/mcp-stand-run-a-plan.md
|
||||
* 1dda615b; undocumented by MikroTik): a membership PATCH that moves an
|
||||
* unchanged, empty concrete bridge from this VRF to main may lose its automatic
|
||||
* LL (RouterOS 7.24.5 does not recreate it). The loss is recorded as revival
|
||||
* debt that a later reappearance may settle once, with the same fields. */
|
||||
function leftBridgeLinkLocal(before: VrfProductionSnapshot, after: VrfProductionSnapshot, old: Row, current: Row, source: Source, oldRoute: Row, beforeSources: Source[], afterSources: Source[]): void {
|
||||
const name = source.member
|
||||
must(source.ll && source.family === 6 && no(old.disabled) && no(current.disabled) && old[".id"] === current[".id"] && members(old.interfaces).includes(name) && !members(current.interfaces).includes(name) && context(before.catalogs.vrf, name) === old.name && context(after.catalogs.vrf, name) === "main", "PATCH bridge LL owned context")
|
||||
const facts = bridgeLinkLocalLoss(before, after, source, oldRoute, beforeSources, afterSources)
|
||||
must(facts.concreteParent(), "PATCH bridge LL concrete parent")
|
||||
must(facts.emptyConfiguration(), "PATCH bridge LL empty configuration")
|
||||
facts.sameBridge()
|
||||
must(facts.automaticProvenance(), "PATCH bridge LL automatic provenance")
|
||||
facts.eui64()
|
||||
must(facts.staticAddressClosure(), "PATCH bridge LL static address closure")
|
||||
must(facts.connectedRouteClosure(), "PATCH bridge LL connected route closure")
|
||||
}
|
||||
/** Existing object guards must see the exact concrete parent/dependent
|
||||
* identities already proved by admission, not a guessed numeric namespace. */
|
||||
@@ -385,6 +420,9 @@ export function classifyVrfProductionTransition(input: VrfProductionTransitionIn
|
||||
const beforeSources = withVrfTransitionSection("before-address", () => addressSources(before, names))
|
||||
const afterSources = withVrfTransitionSection("after-address", () => addressSources(after, names))
|
||||
const absences: History["absentLl"] = []
|
||||
// Bridge LLs lost by a membership PATCH out of this VRF: carried until seen again (once) or this VRF is deleted.
|
||||
const leftLl: NonNullable<History["leftBridgeLl"]> = [], priorLeft = history?.leftBridgeLl ?? []
|
||||
const settledLeft = new Set<(typeof priorLeft)[number]>()
|
||||
const routeResource = (source: Source) => source.family === 4 ? "ipv4_route" : "ipv6_route"
|
||||
const route = (snapshot: VrfProductionSnapshot, source: Source): Row => withVrfTransitionSection("connected-route", () => { const matches = snapshot.catalogs[routeResource(source)].filter(row => routeFor(row, source, snapshot.catalogs.vrf)); must(matches.length === 1, "missing/ambiguous proven connected route"); return matches[0] })
|
||||
const usedAfter = new Set<Source>()
|
||||
@@ -397,6 +435,11 @@ export function classifyVrfProductionTransition(input: VrfProductionTransitionIn
|
||||
settling(() => changes.includes(source.member), () => withVrfTransitionSection("LL-comparison", () => deletedBridgeLinkLocal(before, after, old!, source, oldRoute, beforeSources, afterSources)))
|
||||
explain(source.resource, source.row, undefined); explain(routeResource(source), oldRoute, undefined); continue
|
||||
}
|
||||
if (request.action === "patch" && source.ll && oldContext.get(source.member) === old?.name && newContext.get(source.member) === "main" && [before, after].every(snapshot => snapshot.catalogs.interface_inventory.some(row => row.name === source.member && row.type === "bridge"))) {
|
||||
withVrfTransitionSection("LL-comparison", () => leftBridgeLinkLocal(before, after, old!, current!, source, oldRoute, beforeSources, afterSources))
|
||||
leftLl.push({ address: structuredClone(source.row), route: structuredClone(oldRoute), member: source.member })
|
||||
explain(source.resource, source.row, undefined); explain(routeResource(source), oldRoute, undefined); continue
|
||||
}
|
||||
settling(() => source.ll && changes.includes(source.member), () => must(source.ll && transfer && current!.interfaces === source.member && oldContext.get(source.member) === "main", "address/route absence outside exact acquisition"))
|
||||
absences.push({ address: structuredClone(source.row), route: structuredClone(oldRoute), member: source.member }); explain(source.resource, source.row, undefined); explain(routeResource(source), oldRoute, undefined); continue
|
||||
}
|
||||
@@ -414,14 +457,25 @@ export function classifyVrfProductionTransition(input: VrfProductionTransitionIn
|
||||
if (source.ll && source.row[".id"] !== successor.row[".id"]) must(moved || transfer || ownedDelete, "LL ID changed outside native move")
|
||||
explain(source.resource, source.row, successor.row); explain(routeResource(source), oldRoute, newRoute)
|
||||
}
|
||||
// A left bridge LL already back before this write settles its debt once, with the recorded fields.
|
||||
for (const entry of priorLeft) for (const seen of addressSources(before, [entry.member]).filter(source => source.ll)) {
|
||||
withVrfTransitionSection("LL-comparison", () => same(seen.resource, entry.address, seen.row, [".id", "vrf"])); const seenRoute = route(before, seen)
|
||||
must(Object.hasOwn(entry.route, "local-address") === Object.hasOwn(seenRoute, "local-address"), "revived route local-address shape")
|
||||
same(routeResource(seen), entry.route, seenRoute, [".id", "gateway", "immediate-gw", "routing-table", "local-address"]); settledLeft.add(entry)
|
||||
}
|
||||
for (const successor of afterSources.filter(source => !usedAfter.has(source))) {
|
||||
const missing = history?.absentLl.filter(item => item.member === successor.member) ?? []
|
||||
must(request.action === "delete" && successor.ll && missing.length === 1, "new address/route adoption forbidden")
|
||||
withVrfTransitionSection("LL-comparison", () => same(successor.resource, missing[0].address, successor.row, [".id"])); const nextRoute = route(after, successor)
|
||||
must(Object.hasOwn(missing[0].route, "local-address") === Object.hasOwn(nextRoute, "local-address"), "revived route local-address shape")
|
||||
same(routeResource(successor), missing[0].route, nextRoute, [".id", "gateway", "immediate-gw", "routing-table", "local-address"])
|
||||
const left = priorLeft.filter(item => item.member === successor.member && !settledLeft.has(item))
|
||||
must(successor.ll && (request.action === "delete" && missing.length === 1 && left.length === 0 || left.length === 1 && missing.length === 0), "new address/route adoption forbidden")
|
||||
const debt = missing[0] ?? left[0]
|
||||
withVrfTransitionSection("LL-comparison", () => same(successor.resource, debt.address, successor.row, left.length ? [".id", "vrf"] : [".id"])); const nextRoute = route(after, successor)
|
||||
must(Object.hasOwn(debt.route, "local-address") === Object.hasOwn(nextRoute, "local-address"), "revived route local-address shape")
|
||||
same(routeResource(successor), debt.route, nextRoute, [".id", "gateway", "immediate-gw", "routing-table", "local-address"])
|
||||
if (left.length) settledLeft.add(left[0])
|
||||
explain(successor.resource, undefined, successor.row); explain(routeResource(successor), undefined, nextRoute)
|
||||
}
|
||||
// Unsettled left-bridge debt is carried by every later PATCH; a terminal DELETE ends it (the bridge stays in main).
|
||||
if (request.action !== "delete") for (const entry of priorLeft) if (!settledLeft.has(entry)) leftLl.push(structuredClone(entry))
|
||||
for (const missing of history?.absentLl ?? []) if (!afterSources.some(source => source.member === missing.member && source.ll)) { settling(() => changes.includes(missing.member), () => must(request.action !== "delete", "DELETE missing expected LL revival")); absences.push(structuredClone(missing)) }
|
||||
let active: Row | undefined, dormant: Row | undefined
|
||||
withVrfTransitionSection("virtual", () => {
|
||||
@@ -490,6 +544,6 @@ export function classifyVrfProductionTransition(input: VrfProductionTransitionIn
|
||||
const virtual = after.catalogs.interface_inventory.find(row => row.type === "vrf" && row.name === current.name && row.vrf === "main")
|
||||
must(virtual, "missing inactive causal virtual"); provenance.inactiveCycle = witness(virtual, cycleFields)
|
||||
}
|
||||
histories.set(checkpoint, { snapshot: structuredClone(after), vrfId, activeVirtual: active, dormantTable: dormant, absentLl: absences, provenance })
|
||||
histories.set(checkpoint, { snapshot: structuredClone(after), vrfId, activeVirtual: active, dormantTable: dormant, absentLl: absences, ...(leftLl.length ? { leftBridgeLl: leftLl } : {}), provenance })
|
||||
return { status: "explained-native-transition", executionAvailable: false, forwardingVerified: false, checkpoint, explainedRows: [...exemptAfter.values()].reduce((sum, rows) => sum + rows.size, 0) }
|
||||
}
|
||||
@@ -9,6 +9,12 @@ export const VRF_TRANSITION_REASON_CODES = Object.freeze({
|
||||
"DELETE bridge LL automatic provenance": "DELETE_BRIDGE_LL_AUTOMATIC_PROVENANCE",
|
||||
"DELETE bridge LL static address closure": "DELETE_BRIDGE_LL_STATIC_ADDRESS_CLOSURE",
|
||||
"DELETE bridge LL connected route closure": "DELETE_BRIDGE_LL_CONNECTED_ROUTE_CLOSURE",
|
||||
"PATCH bridge LL owned context": "PATCH_BRIDGE_LL_OWNED_CONTEXT",
|
||||
"PATCH bridge LL concrete parent": "PATCH_BRIDGE_LL_CONCRETE_PARENT",
|
||||
"PATCH bridge LL empty configuration": "PATCH_BRIDGE_LL_EMPTY_CONFIGURATION",
|
||||
"PATCH bridge LL automatic provenance": "PATCH_BRIDGE_LL_AUTOMATIC_PROVENANCE",
|
||||
"PATCH bridge LL static address closure": "PATCH_BRIDGE_LL_STATIC_ADDRESS_CLOSURE",
|
||||
"PATCH bridge LL connected route closure": "PATCH_BRIDGE_LL_CONNECTED_ROUTE_CLOSURE",
|
||||
"bounded GRE cycle member identity/context": "BOUNDED_GRE_CYCLE_MEMBER_IDENTITY_CONTEXT",
|
||||
"bounded GRE cycle active state": "BOUNDED_GRE_CYCLE_ACTIVE_STATE",
|
||||
"bounded GRE cycle parent/configuration": "BOUNDED_GRE_CYCLE_PARENT_CONFIGURATION",
|
||||
|
||||
Reference in new issue
Block a user