Chapter 36 worked answers
These answers use baseline cbfc94ade5b57e449d6b73bf1485b1c5b1647022 and the chapter's linked execution records. Procedures remain scoped to disposable resources.
1. Read the fake's contract
Task-key replay and operation history support agent idempotency/order assertions. FakeRuntime does not enforce kernel cgroups or real port binding, so a successful fake start cannot prove memory or CPU limits. Assert supplied ContainerSpec fields and separately inspect a real engine when claiming enforcement.
2. Reproduce a property, not a score
Run go test ./internal/scheduler -run '^TestSchedulerRandomizedInvariants/seed_42$' -count=1 -v. The batch's actual recorded run included all five seeds and passed. Seed42 must accompany the exact generator revision because changing generated fields/order changes the resulting fixture. For occupied-port coverage, add an existing active task reserving a fixed TCP port on one node and a pending service requesting it; assert no assignment reuses that node/port pair. Do not call the scoring helper again as the oracle. The baseline randomized fixture has no occupied-task inventory.
3. Fuzz scope is callback scope
Run the exact FuzzPortSpec target for two seconds with one worker. The recorded campaign performed42,919 executions and passed. Its callback discards values/errors, so panic resistance is the main assertion; accepted-invalid semantics can remain undetected. Sixty-three newly interesting inputs report coverage exploration, not sixty-three bugs. No crash occurred, so no minimized failing case is invented. The documentation's FuzzParsePortSpec example does not match the actual declaration.
4. Observe every handoff
Submit explicit CPU/memory through the normal API path, inspect stored service values, inspect the delivered agent DTO, assert the Runner's created ContainerSpec, then inspect the actual engine limits. Keep identities tied to one owned task/container. The actual boundary experiment found direct adapter limits present and normal-path limits zero. Testing only a manually populated direct-adapter spec would pass while missing the dropped DTO fields. Preserve the failing upstream boundary; a regression fix requires separately authorized application work.
See the corresponding chapter claim ledger for exact immutable source anchors and limitations.
Return to Chapter 36.