Labels: Stellar Wave, perf, test, drips, help-wanted
Tier: M (2–4 days)
Type: perf / test
Context
The Spectre TEE agent runs for months. Its scanner is the hottest code path. A small memory leak in the SDK becomes an OOM kill in production. We've never run the SDK's scan loop under a profiler to find out.
Scope
- Build a long-running harness at
test/leak/scan-leak.test.ts:
- Calls
scanAnnouncements (or scanAnnouncementsStream after #09) in a tight loop.
- Synthetic dataset of 10k announcements; loop runs 10k iterations.
- Captures heap snapshots at intervals via
v8.writeHeapSnapshot (Node) or performance.memory (browser).
- Detect leaks: compute slope of RSS over iterations. Fail if slope > N KB per iteration (tunable).
- Profile hot paths — run the harness with
--prof (V8 profiler) and clinic.js doctor. Capture flame graphs.
- Identify and fix any leaks found. Common suspects:
- Closures holding references to large buffers
- Event listener accumulation
- The cache layer (from #17) not evicting properly
- Worker pool workers not being terminated
- Add CI — the leak test runs nightly, fails on regression.
Specific things to check
- After
scanAnnouncements returns, the input announcements array should be garbage-collectible — we shouldn't be holding onto it.
- After
pool.scanAll returns, all worker threads must be terminated.
- The IndexedDB cache shouldn't grow without bound (it has a 50 MB cap per #17, verify enforcement).
Acceptance criteria
Why this matters
The TEE's job is privacy. The TEE crashing because the SDK leaks is a privacy failure that looks like a reliability failure. We should know our SDK is leak-clean before a real user notices.
Resources
Labels:
Stellar Wave,perf,test,drips,help-wantedTier: M (2–4 days)
Type: perf / test
Context
The Spectre TEE agent runs for months. Its scanner is the hottest code path. A small memory leak in the SDK becomes an OOM kill in production. We've never run the SDK's scan loop under a profiler to find out.
Scope
test/leak/scan-leak.test.ts:scanAnnouncements(orscanAnnouncementsStreamafter #09) in a tight loop.v8.writeHeapSnapshot(Node) orperformance.memory(browser).--prof(V8 profiler) andclinic.jsdoctor. Capture flame graphs.Specific things to check
scanAnnouncementsreturns, the inputannouncementsarray should be garbage-collectible — we shouldn't be holding onto it.pool.scanAllreturns, all worker threads must be terminated.Acceptance criteria
Why this matters
The TEE's job is privacy. The TEE crashing because the SDK leaks is a privacy failure that looks like a reliability failure. We should know our SDK is leak-clean before a real user notices.
Resources