Skip to content

Commit 304d7e9

Browse files
authored
fix(zones): keep a row's public internet beside the DMZ, hanging at most one zone under another (#596) (#597)
Asked for left to right, a Sol three-zone-request-path-v2 sample stacked the public internet, the DMZ and the private subnet one under another, and the judge failed it on relationships. Neither zone's own flow is long enough to wrap, so only top-level cuts were planned: two bands missed the 2:1 target at 2.3:1, so three won. In a row, of the plans no longer too long (under 2.45:1), the one that hangs the fewest top-level zones under another now goes first, the plan it passes its first alternative. Eight of ten Sonnet samples hung the DMZ under the public internet. The cached page's line ran straight to a response outside every zone, past the private subnet, and a zoned cut could carry only lines joining the two ranks it separates, so the one cut left was after the public internet. A zoned cut may now also carry forward lines that skip ranks, each across that cut alone. The skipping line may cross another, so the cuts that carry none are planned too where they differ, and a plan whose cut carries one gives way to a later plan adding nothing that crosses fewer lines or draws fewer findings. Seven of the eight keep the DMZ beside the public internet; the eighth's skipping plan crosses the WAF's line, so it keeps the plan it had. Of the 60 saved zone specs from the last four evals, only those 8 left-to-right three-zone renders change: top to bottom, and every hybrid, AWS and Kubernetes spec, render as before. Of the zone and group fixtures in four directions, only the four-deep stress case changes, in BT, LR and RL: its second availability zone hangs under the first, 1.9:1 instead of a 4.1:1 row, and it joins the alongside check. The routing fuzz's third zoned sample draws fewer crossings and findings than pinned in both rows. Fixes #596
1 parent 3fa9f3d commit 304d7e9

8 files changed

Lines changed: 509 additions & 34 deletions

File tree

‎docs/flowchart-zones.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ Each zone's label sits at the left of a header strip across its top; nothing the
4444
- Edges route around every zone neither end sits in and never cross a zone's label or run along its outline. An edge whose ends share a zone stays inside the innermost zone holding both.
4545
- Zones keep the diagram's direction at every level: zones a flow passes through one after another follow it, and zones it does not join stand side by side across it.
4646
- A zoned flow too long for its breadth (2.45:1 for a row at least 1,200 px long or for any column, 4:1 always) wraps as a plain flowchart wraps into rows or columns, never by turning a zone across the flow. Level by level, the top level or one zone's members cut between whole ranks into bands, each read in the stated direction, columns keeping the plain rule's even-split guard. A band hangs under the step that leads into it, as far as the longest band allows, and lines into it turn in from that side. Of the plans that route with no more crossings, export defects or reader findings other than port jogs, the first adding nothing is kept, else the one with the fewest crossings, then findings, then the squarest. The hybrid fixture goes from 4.8:1 to 1.5:1, the AWS one from 2.8:1 to 1.7:1.
47-
- In a row, a plan within the target that keeps the top-level zones side by side, wrapping inside one of them, goes before a plan that cuts the top level between two zones. That cut hangs the later zone under the earlier, though the flow passes from one to the next along the row, and the line between them runs down and back against it. The stacked plan stays the first alternative, so a side-by-side plan that routes worse still gives way to it. A column's cut stands the later zone beside the earlier, across a wide export, and columns plan as before. Two of three Sol samples of `hybrid-cloud-zones-v2`, asked for left to right, hung the AWS cloud under the data center (the top level reached the target in two bands, the region in three); the cloud now stands beside it.
47+
- In a row, of the plans no longer too long (under 2.45:1), the one that hangs the fewest top-level zones under another goes first, before a plan that reaches the 2:1 target by hanging more. A top-level cut hangs the later zone under the earlier, though the flow passes from one to the next along the row, and the line between them runs down and back against it. The plan it passes stays the first alternative, so a plan that routes worse still gives way to it. A column's cut stands the later zone beside the earlier, across a wide export, and columns plan as before. Two of three Sol samples of `hybrid-cloud-zones-v2`, asked for left to right, hung the AWS cloud under the data center (the top level reached the target in two bands, the region in three); the cloud now stands beside it. A Sol sample of `three-zone-request-path-v2` stacked all three zones, since two bands missed the target (2.3:1) and three reached it; the DMZ now stands beside the public internet, the private subnet under it.
48+
- A zoned cut may carry a forward line that skips ranks, as a cached page's line straight to a response past the private subnet, so long as that line crosses no other cut. The skipping line may cross another, so the cuts that carry none are planned too, where they differ, and a plan whose cut carries one gives way to a later plan, adding nothing to the layout it replaces, that crosses fewer lines or draws fewer reader findings. Eight of ten Sonnet samples of `three-zone-request-path-v2` hung the DMZ under the public internet, the only cut that carried no skipping line; seven now keep it beside the public internet, and the eighth, whose skipping line would cross the WAF's, keeps its plan. The four-deep stress fixture's second availability zone now hangs under the first: 1.9:1 instead of a 4.1:1 row.
4849
- A plan whose plain routes cross more than the layout it replaces is routed again, each line across as few others as it can, before it is judged, so a crossing the plain router happens to draw does not alone stack sibling zones that read side by side along the flow.
4950
- A plan that keeps the top level in one band and still crosses one line pair more is judged as the crossing repairs leave it, as the kept plan is drawn, where those leave it crossing, detouring, hooking, running through arrowheads and passing near nodes no more than the layout it replaces, each cleared of the nodes it passes, and no line in it runs more than twice its direct connection past its stubs. Such a plan only keeps sibling zones side by side: it replaces the chosen plan only where that one stacks them and it crosses and finds no more, and it never stacks zones itself. A Sol hybrid sample whose region, wrapped beside the data center, crossed the sync function's lines to the orders table and the invoice PDF once now draws beside it, the table's line entering the table from the side that faces the sync function.
5051
- A line into a hanging band whose target stands behind another step of its rank, straight across the flow from the source, leaves forward and turns back into the target's forward side, around that step, instead of hooking around the band's margin to reach its near side. This is kept when it routes no worse, hooks or detours no line more, and draws the lines shorter in total. In a round 19 hybrid sample, the line to the orders table drops straight down and the line to the invoice archive brackets around it: four turns fewer and a tenth less line.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/**
2+
* The three-zone request path whose cached page goes straight to a response
3+
* outside every zone, past the private subnet, so the only cut that carried no
4+
* line skipping ranks hung the DMZ under the public internet. From a generated
5+
* eval sample (Sonnet, the real-voice v2 prompt, #596).
6+
*/
7+
export default {
8+
id: "web-request-across-network-zones",
9+
title: "Web request across network zones",
10+
nodes: [
11+
{
12+
id: "browser",
13+
label: "Browser",
14+
kind: "start",
15+
description: "Sends a request",
16+
group: "pub",
17+
},
18+
{
19+
id: "cache",
20+
label: "Cache hit?",
21+
kind: "decision",
22+
group: "dmz",
23+
},
24+
{
25+
id: "cached",
26+
label: "Return cached page",
27+
kind: "process",
28+
group: "dmz",
29+
},
30+
{
31+
id: "waf",
32+
label: "WAF filters request",
33+
kind: "process",
34+
group: "dmz",
35+
},
36+
{
37+
id: "api",
38+
label: "API server handles request",
39+
kind: "process",
40+
group: "priv",
41+
},
42+
{
43+
id: "db",
44+
label: "Query database",
45+
kind: "process",
46+
group: "priv",
47+
shape: "database",
48+
},
49+
{
50+
id: "resp",
51+
label: "Response returned",
52+
kind: "end",
53+
},
54+
],
55+
edges: [
56+
{
57+
id: "edge-1",
58+
source: "browser",
59+
target: "cache",
60+
label: "request",
61+
},
62+
{
63+
id: "edge-2",
64+
source: "cache",
65+
target: "cached",
66+
label: "yes",
67+
},
68+
{
69+
id: "edge-3",
70+
source: "cache",
71+
target: "waf",
72+
label: "no",
73+
},
74+
{
75+
id: "edge-4",
76+
source: "waf",
77+
target: "api",
78+
},
79+
{
80+
id: "edge-5",
81+
source: "api",
82+
target: "db",
83+
},
84+
{
85+
id: "edge-6",
86+
source: "db",
87+
target: "resp",
88+
},
89+
{
90+
id: "edge-7",
91+
source: "cached",
92+
target: "resp",
93+
},
94+
],
95+
groups: [
96+
{
97+
id: "pub",
98+
label: "Public internet",
99+
kind: "zone",
100+
},
101+
{
102+
id: "dmz",
103+
label: "DMZ",
104+
kind: "zone",
105+
},
106+
{
107+
id: "priv",
108+
label: "Private subnet",
109+
kind: "subnet",
110+
},
111+
],
112+
} as const;
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/**
2+
* The three-zone request path whose cache decision's hit branch goes straight
3+
* to a response outside every zone, past the private subnet, which hung the
4+
* DMZ under the public internet. From a generated eval sample (Sonnet, the
5+
* real-voice v2 prompt, #596).
6+
*/
7+
export default {
8+
id: "web-request-across-network-zones",
9+
title: "Web Request Across Network Zones",
10+
nodes: [
11+
{
12+
id: "browser",
13+
label: "Browser sends request",
14+
kind: "start",
15+
group: "pub",
16+
},
17+
{
18+
id: "cache",
19+
label: "CDN checks its cache",
20+
kind: "process",
21+
group: "dmz",
22+
},
23+
{
24+
id: "hit",
25+
label: "Cache hit?",
26+
kind: "decision",
27+
group: "dmz",
28+
},
29+
{
30+
id: "waf",
31+
label: "WAF filters request",
32+
kind: "process",
33+
group: "dmz",
34+
},
35+
{
36+
id: "api",
37+
label: "API server handles request",
38+
kind: "process",
39+
group: "priv",
40+
},
41+
{
42+
id: "db",
43+
label: "Query database",
44+
kind: "process",
45+
group: "priv",
46+
shape: "database",
47+
},
48+
{
49+
id: "resp",
50+
label: "Response returned",
51+
kind: "end",
52+
},
53+
],
54+
edges: [
55+
{
56+
id: "edge-1",
57+
source: "browser",
58+
target: "cache",
59+
},
60+
{
61+
id: "edge-2",
62+
source: "cache",
63+
target: "hit",
64+
},
65+
{
66+
id: "edge-3",
67+
source: "hit",
68+
target: "resp",
69+
label: "yes: cached page",
70+
},
71+
{
72+
id: "edge-4",
73+
source: "hit",
74+
target: "waf",
75+
label: "no",
76+
},
77+
{
78+
id: "edge-5",
79+
source: "waf",
80+
target: "api",
81+
},
82+
{
83+
id: "edge-6",
84+
source: "api",
85+
target: "db",
86+
},
87+
{
88+
id: "edge-7",
89+
source: "db",
90+
target: "resp",
91+
},
92+
],
93+
groups: [
94+
{
95+
id: "pub",
96+
label: "Public Internet",
97+
kind: "zone",
98+
},
99+
{
100+
id: "dmz",
101+
label: "DMZ",
102+
kind: "zone",
103+
},
104+
{
105+
id: "priv",
106+
label: "Private Subnet",
107+
kind: "subnet",
108+
},
109+
],
110+
} as const;
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/**
2+
* The three-zone request path asked for left to right, whose public internet,
3+
* DMZ and private subnet a top-level wrap stacked one under another: two bands
4+
* missed the target aspect, so three did. From a generated eval sample (Sol,
5+
* the real-voice v2 prompt, #596).
6+
*/
7+
export default {
8+
id: "web-request-across-three-network-zones",
9+
title: "Web request across three network zones",
10+
nodes: [
11+
{
12+
id: "browser",
13+
label: "Browser sends a request",
14+
kind: "start",
15+
group: "public",
16+
},
17+
{
18+
id: "cache",
19+
label: "CDN checks its cache",
20+
kind: "process",
21+
group: "dmz",
22+
},
23+
{
24+
id: "hit",
25+
label: "Cache hit?",
26+
kind: "decision",
27+
group: "dmz",
28+
},
29+
{
30+
id: "cached",
31+
label: "Return cached page",
32+
kind: "end",
33+
group: "dmz",
34+
},
35+
{
36+
id: "waf",
37+
label: "WAF",
38+
kind: "process",
39+
group: "dmz",
40+
},
41+
{
42+
id: "filter",
43+
label: "Filter the request",
44+
kind: "process",
45+
group: "dmz",
46+
},
47+
{
48+
id: "api",
49+
label: "API server handles the request",
50+
kind: "process",
51+
group: "private",
52+
},
53+
{
54+
id: "db",
55+
label: "Query the database",
56+
kind: "process",
57+
group: "private",
58+
shape: "database",
59+
},
60+
{
61+
id: "response",
62+
label: "Return response",
63+
kind: "end",
64+
group: "private",
65+
},
66+
],
67+
edges: [
68+
{
69+
id: "edge-1",
70+
source: "browser",
71+
target: "cache",
72+
},
73+
{
74+
id: "edge-2",
75+
source: "cache",
76+
target: "hit",
77+
},
78+
{
79+
id: "edge-3",
80+
source: "hit",
81+
target: "cached",
82+
label: "Hit",
83+
},
84+
{
85+
id: "edge-4",
86+
source: "hit",
87+
target: "waf",
88+
label: "Miss",
89+
},
90+
{
91+
id: "edge-5",
92+
source: "waf",
93+
target: "filter",
94+
},
95+
{
96+
id: "edge-6",
97+
source: "filter",
98+
target: "api",
99+
},
100+
{
101+
id: "edge-7",
102+
source: "api",
103+
target: "db",
104+
},
105+
{
106+
id: "edge-8",
107+
source: "db",
108+
target: "response",
109+
},
110+
],
111+
groups: [
112+
{
113+
id: "public",
114+
label: "Public internet",
115+
},
116+
{
117+
id: "dmz",
118+
label: "DMZ",
119+
},
120+
{
121+
id: "private",
122+
label: "Private subnet",
123+
kind: "subnet",
124+
},
125+
],
126+
} as const;

‎packages/diagram/core/src/zone-fixtures.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import hybridCloudStacked from "./fixtures/zones/hybrid-cloud-stacked.js";
1515
import hybridCloudSync from "./fixtures/zones/hybrid-cloud-sync.js";
1616
import kindedFlat from "./fixtures/zones/kinded-flat.js";
1717
import kubernetesCluster from "./fixtures/zones/kubernetes-cluster.js";
18+
import threeZoneRequestPath from "./fixtures/zones/three-zone-request-path.js";
19+
import threeZoneRequestPathCached from "./fixtures/zones/three-zone-request-path-cached.js";
20+
import threeZoneRequestPathHit from "./fixtures/zones/three-zone-request-path-hit.js";
1821

1922
function flowchart(fixture: object, direction: "LR" | "TB" = "LR") {
2023
return parseFlowchartDiagram({
@@ -100,6 +103,17 @@ export const corridorHybridFlowchart = flowchart(hybridCloudArchiveCorridor);
100103
*/
101104
export const leftToRightHybridFlowchart = flowchart(hybridCloudLeftToRight);
102105

106+
/**
107+
* A web request asked for left to right across the public internet, a DMZ and
108+
* a private subnet, as generated samples drew it: a wrap hung one zone under
109+
* another though the request passes from each to the next along the row.
110+
*/
111+
export const requestPathFlowcharts = {
112+
"three-zone-request-path": flowchart(threeZoneRequestPath),
113+
"three-zone-request-path-cached": flowchart(threeZoneRequestPathCached),
114+
"three-zone-request-path-hit": flowchart(threeZoneRequestPathHit),
115+
};
116+
103117
/** Zones of the thirty-node stress case, each with its parent and kind. */
104118
const STRESS_ZONES = [
105119
{ id: "aws", label: "AWS", kind: "cloud" },

0 commit comments

Comments
 (0)