1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
//! The shared adoption-wedge corpus (12E.13) — the SAME deterministic
//! workloads the adoption court measured, reused verbatim by the 12C-1
//! adaptive-budget oracle so its settled-bytes curves are directly
//! comparable to the sealed 12E.13 footprint numbers.
//!
//! # PURPOSE
//!
//! One corpus generator, two courts. The 12E.13 adoption court
//! (`src/tests/adoption_oracle.rs`) measured the settled footprint wedge
//! (build-artifacts 0.049×, four workloads clear 10×); the 12C-1
//! adaptive-budget oracle (`src/tests/adaptive_budget_probe.rs`) measures
//! how much of that wedge survives reduced foreground search effort.
//! Both must run the IDENTICAL bytes or the curves cannot be compared.
//!
//! # DETERMINISM
//!
//! Every byte derives from the workload/version/index parameters and a
//! fixed LCG seed — no wall-clock, no randomness. The generators are
//! pure: same call sequence → same bytes.
#![forbid(unsafe_code)]
/// Deterministic pseudo-random (LCG) helper.
pub fn lcg(state: &mut u64) -> u64 {
*state = state
.wrapping_mul(6364136223846793005)
.wrapping_add(1442695040888963407);
*state >> 16
}
/// Fill `buf` with template lines carrying a (workload, version, index)
/// stamp so near-duplicates share structure but differ deterministically.
pub fn stamp_lines(buf: &mut Vec<u8>, tag: &str, ver: u64, idx: u64, line: &str) {
let target = buf.capacity().min(1 << 20);
while buf.len() < target {
buf.extend_from_slice(
format!(
"{line} // {tag} v{ver} item{idx} seq{seq}\n",
seq = buf.len() % 4096
)
.as_bytes(),
);
}
buf.truncate(target);
}
/// One workload: a named set of immutable blobs (the adoption corpus).
pub struct Workload {
pub name: &'static str,
pub blobs: Vec<Vec<u8>>,
}
/// The six brief-mandated workload families. Deterministic.
pub fn workloads() -> Vec<Workload> {
let mut out = Vec::new();
let mut seed: u64 = 0xDEAD_BEEF_CAFE_F00D;
// 1. Versioned build artifacts: 12 versions × 200 objects; 80% of
// each version is byte-identical to the previous (dedup), 20%
// carries a version stamp (near-duplicate).
{
let mut blobs = Vec::new();
for ver in 0..12u64 {
for i in 0..200u64 {
let mut b = Vec::with_capacity(4096 + ((i * 37) % 60000) as usize);
if i % 5 == 0 {
// the changed fifth: version-stamped object
stamp_lines(&mut b, "build", ver, i, "artifact(v){v} = {a} {b} {c}");
} else {
// the stable 80%: identical across versions
stamp_lines(&mut b, "build", 0, i, "stable_object = {a} {b} {c}");
}
blobs.push(b);
}
}
out.push(Workload {
name: "build-artifacts",
blobs,
});
}
// 2. Incremental source trees: 10 versions × 150 files; each file
// changes only its version stamp + a few edited lines.
{
let mut blobs = Vec::new();
for ver in 0..10u64 {
for i in 0..150u64 {
let mut b = Vec::with_capacity(2048 + ((i * 53) % 24000) as usize);
stamp_lines(
&mut b,
"src",
ver,
i,
"fn handler_{i}(ctx: &mut Ctx) -> Result<(), E> { let v = ctx.get({i}); v.map(|_| ()) }",
);
// a few genuinely edited lines per version
for e in 0..(ver % 5) {
b.extend_from_slice(
format!("// edit {ver}.{e} applied to file {i}\n").as_bytes(),
);
}
blobs.push(b);
}
}
out.push(Workload {
name: "source-trees",
blobs,
});
}
// 3. Container-like layers: 8 layers; each layer keeps 60% of the
// previous layer's files byte-identical and adds 40% new.
{
let mut blobs = Vec::new();
let mut kept: Vec<Vec<u8>> = Vec::new();
for layer in 0..8u64 {
let mut next_kept: Vec<Vec<u8>> = Vec::new();
// keep 60% of previous layer's files (or seed files)
let prev_len = kept.len().max(100);
for i in 0..prev_len {
if i % 10 < 6 {
let b = if kept.is_empty() {
let mut x = Vec::with_capacity(8192);
stamp_lines(&mut x, "layer", 0, i as u64, "layer_base_file = {a} {b}");
x
} else {
kept[i].clone()
};
next_kept.push(b.clone());
blobs.push(b);
}
}
// add 40% new
for i in 0..(prev_len / 10 * 4) {
let mut b = Vec::with_capacity(8192);
stamp_lines(&mut b, "layer", layer, i as u64, "layer_new_file = {a} {b}");
next_kept.push(b.clone());
blobs.push(b);
}
kept = next_kept;
}
out.push(Workload {
name: "container-layers",
blobs,
});
}
// 4. Near-duplicate generated assets: 50 assets from one template
// with per-asset parameters (strong shared structure).
{
let mut blobs = Vec::new();
for i in 0..50u64 {
let mut b = Vec::with_capacity(16 * 1024);
stamp_lines(
&mut b,
"asset",
0,
i,
"asset {{ id: {i}, palette: [r,g,b], scale: {s}, label: \"gen-{i}\" }}",
);
blobs.push(b);
}
out.push(Workload {
name: "generated-assets",
blobs,
});
}
// 5. CI/cache-style object population: 300 objects; 60% unique, 40%
// exact duplicates of earlier ones (cache hits); mixed sizes.
{
let mut blobs = Vec::new();
let mut pool: Vec<Vec<u8>> = Vec::new();
for i in 0..300u64 {
if i >= 120 && i % 10 < 4 {
// duplicate a random earlier object (cache hit)
let hit = pool[(lcg(&mut seed) as usize) % pool.len()].clone();
blobs.push(hit);
continue;
}
let mut b = Vec::with_capacity(1024 + ((i * 97) % 63000) as usize);
stamp_lines(&mut b, "ci", 0, i, "cache_entry = {hash} {status} {bytes}");
pool.push(b.clone());
blobs.push(b);
}
out.push(Workload {
name: "ci-cache",
blobs,
});
}
// 6. Versioned scientific outputs: 6 versions × 20 outputs of
// 64–512 KiB; mostly stable across versions (high dedup).
{
let mut blobs = Vec::new();
for ver in 0..6u64 {
for i in 0..20u64 {
let mut b = Vec::with_capacity(64 * 1024 + ((i * 131) % (448 * 1024)) as usize);
stamp_lines(
&mut b,
"science",
ver,
i,
"run {i} metric={m} value={v} timestamp=1787840{ver}00",
);
blobs.push(b);
}
}
out.push(Workload {
name: "scientific-outputs",
blobs,
});
}
out
}
/// The hostile-media RAW control: 200 deterministic random blobs of
/// 1–64 KiB — the SAME bytes the 12C-1 adaptive-budget probe used (the
/// identical generator, shared here so the 12C-1-2 pressure-deferral
/// probe's RAW-control rows are byte-comparable to the sealed 12C-1
/// numbers). The arms must all be byte-exact here; the RAW winner must
/// stay ~100% in every arm (a budget or policy change must never turn
/// random bytes into a "compressed" winner — the "RAW controls
/// unchanged" gate row).
pub fn noise_control() -> Workload {
let mut blobs = Vec::new();
let mut state: u64 = 0x0123_4567_89AB_CDEF;
for i in 0..200u64 {
let len = 1024 + ((i * 2654435761) % (63 * 1024)) as usize;
let mut b = Vec::with_capacity(len);
while b.len() < len {
state = state
.wrapping_mul(6364136223846793005)
.wrapping_add(1442695040888963407);
b.push((state >> 33) as u8);
}
blobs.push(b);
}
Workload {
name: "noise-control",
blobs,
}
}