carlos / platform Public

edge: both instances page-eligible in the first page simulation

The second instance had process inputs but no build declarations, so
it always bypassed the page cache and the simulation judged only one
instance. It now loads def/shop/v1's declarations and requires page
hits for each instance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6899bfabf114337c310b7ca02c274763b3e5f150 parent a6eb2ac
1 file changed, +10 −3
  • internal/edge/pagecache_sim_test.go +10 −3
diff --git a/internal/edge/pagecache_sim_test.go b/internal/edge/pagecache_sim_test.go
index 9be8c4d8a..9c15d3e7a 100644
--- a/internal/edge/pagecache_sim_test.go
+++ b/internal/edge/pagecache_sim_test.go
@@ -70,6 +70,9 @@ func TestPageSimulationNoPersonalLeak(t *testing.T) {
io.WriteString(w, body)
}
s := newPCScene(t, app)
+ // The second instance's build declarations, so its pages are eligible
+ // too (the scene loads only the first's).
+ s.decl.loadFor("def", "shop", pcBuild, "/assets/")
if err := s.reg.Upsert(registry.Route{Host: two, Kind: "instance", Addr: s.b.srv.Listener.Addr().String(),
Status: "ready", Account: "def", App: "shop", Version: pcBuild}); err != nil {
t.Fatal(err)
@@ -101,6 +104,7 @@ func TestPageSimulationNoPersonalLeak(t *testing.T) {
t.Fatal("no personal LRU entries were seeded")
}
var pageHits, lruBefore int
+ hitsBy := map[string]int{}
for step := 0; step < steps; step++ {
host := hosts[rng.Intn(len(hosts))]
if rng.Intn(40) == 0 {
@@ -133,6 +137,7 @@ func TestPageSimulationNoPersonalLeak(t *testing.T) {
switch {
case rec.Header().Get(assetCacheHeader) == "hit":
pageHits++
+ hitsBy[host]++
if kind != "anon" && kind != "consent" {
t.Fatalf("step %d: a %s request to %s%s was answered from the page cache: %q", step, kind, host, path, body)
}
@@ -149,8 +154,10 @@ func TestPageSimulationNoPersonalLeak(t *testing.T) {
lruBefore++
}
}
- if pageHits == 0 {
- t.Fatalf("the run produced no page hits (seed %d): the oracle judged nothing", seed)
+ for _, host := range hosts {
+ if hitsBy[host] == 0 {
+ t.Fatalf("the run produced no page hits for %s (seed %d): the oracle judged nothing of it", host, seed)
+ }
}
- t.Logf("seed %d: %d steps, %d page hits, %d LRU answers before opt-in", seed, steps, pageHits, lruBefore)
+ t.Logf("seed %d: %d steps, %d page hits %v, %d LRU answers before opt-in", seed, steps, pageHits, hitsBy, lruBefore)
}