eureka-state tests: reach the limit through the source runtime id, seed the stewardship
The source runtime id adds its field name when present, so exact sizes are searched over both paddings. The attribution test admits a campaign, which needs its repo stewarded first. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
db40a6647b
commit
c2b2952749
2 changed files with 13 additions and 10 deletions
|
|
@ -423,15 +423,18 @@ fn smallest_request_over() -> HuginnMindRequest {
|
||||||
padded_admit(pad_for(MAX_REQUEST_BYTES + 1))
|
padded_admit(pad_for(MAX_REQUEST_BYTES + 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A message that encodes to exactly `target` bytes: the largest request that
|
/// A message that encodes to exactly `target` bytes: a request a little under
|
||||||
/// fits under it, topped up with a source runtime id, which rides outside the
|
/// it, topped up with a source runtime id, which rides outside the payload and
|
||||||
/// payload and moves the size a byte at a time.
|
/// moves the size a byte at a time once the field is there at all.
|
||||||
fn message_of_size(target: usize) -> CultNetMessage {
|
fn message_of_size(target: usize) -> CultNetMessage {
|
||||||
let request = padded_admit(pad_for(target + 1) - 1);
|
let fitting = pad_for(target + 1) - 1;
|
||||||
for pad in 0..16 {
|
for padding in (fitting.saturating_sub(80)..=fitting).rev() {
|
||||||
let message = message_for(&request, (pad > 0).then(|| "r".repeat(pad)));
|
let request = padded_admit(padding);
|
||||||
if encoded_bytes(&message) == target {
|
for source in 1..80 {
|
||||||
return message;
|
let message = message_for(&request, Some("r".repeat(source)));
|
||||||
|
if encoded_bytes(&message) == target {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic!("no message encodes to {target} bytes");
|
panic!("no message encodes to {target} bytes");
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,7 @@ fn an_oversize_admit_is_a_typed_too_large_error() {
|
||||||
/// is a typed refusal, and nothing is committed.
|
/// is a typed refusal, and nothing is committed.
|
||||||
#[test]
|
#[test]
|
||||||
fn admit_refuses_an_unusable_attribution() {
|
fn admit_refuses_an_unusable_attribution() {
|
||||||
let (root, daemon) = mind(vec![]);
|
let (root, daemon) = mind(vec![vec![stewardship()]]);
|
||||||
let server = serve(root, daemon);
|
let server = serve(root, daemon);
|
||||||
let mut mcp = Mcp::at(INSTANCE, server.addr);
|
let mut mcp = Mcp::at(INSTANCE, server.addr);
|
||||||
for (field, value) in [
|
for (field, value) in [
|
||||||
|
|
@ -437,7 +437,7 @@ fn admit_refuses_an_unusable_attribution() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let (_, whoami) = mcp.call("whoami", json!({}));
|
let (_, whoami) = mcp.call("whoami", json!({}));
|
||||||
assert_eq!(whoami["status"]["receipts"], json!(1), "only the seed is committed: {whoami}");
|
assert_eq!(whoami["status"]["receipts"], json!(2), "only the seed is committed: {whoami}");
|
||||||
let (error, admitted) = mcp.call("admit", faculty_args(vec![campaign_json()]));
|
let (error, admitted) = mcp.call("admit", faculty_args(vec![campaign_json()]));
|
||||||
assert!(!error);
|
assert!(!error);
|
||||||
assert!(admitted.get("Committed").is_some(), "{admitted}");
|
assert!(admitted.get("Committed").is_some(), "{admitted}");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue