tracker
All repositories: gitoria
20.1 KB
# HM1: what retains the live heapThe bulk is derived application indexes, their strings, and catalog rows. The main record tables already stream records and fetch individual records on demand. Packing their cold record graphs therefore offers little additional steady-state benefit in the current app. The useful targets are the short-ID map, search text, person lookup maps, person ordering, and catalog entry shapes.This is a read-only analysis of the 20261104-0940 backup, using a detached worktree at `2e7d625`, not a measurement of live production. The warmed copy retained **17,990,297 objects and 1,266,576,935 counted bytes** (1.267 GB; 1.180 GiB). The brief's production example was 19,083,893 objects and 1,387,443,967 bytes. Different jobs, requests, caches and sessions prevent treating the difference as a regression or an improvement. No change was deployed or committed.## Method and precisionThe scratch directory is `/media/STORAGE/claude-scratch/tracker/HM1/`. Storage was extracted without posters/profiles, sessions or `.env`. All jobs, including merge, art, photos and franchise seed, were explicitly disabled. The copy listened on 8701. Its successful startup scanned 280,138 titles in 26,177 ms, 2,551,065 episodes in 17,642 ms and 1,220,682 people in 59,798 ms: 103,617 ms total, after compilation.App-only probes first counted structures, then removed their contents in the order below. Between removals, a bounded census streamed the persons table without keeping its rows. This caused ordinary allocation-triggered collections, whose existing `HL_GC_STATS=1` lines supply marked objects, counted bytes and mark times. The table uses the final GC observation in each stage; the time is the median mark time across that stage. See `server4.log`, `heap-deltas.json`, `heap-table.md`, `instrumentation.patch`, the instrumented `wt/`, and `start.sh` in scratch.These are **ordered marginal differences**, not independently additive predictions for individual changes against the intact app. Shared strings become collectible only after their last reference disappears. A census GC can still retain its current decoded row and conservative stack roots, so read differences as estimates to about 0.01 million objects, not exact permanent per-type counts. Raw GC observations are shown exactly for auditability. Timing also depends on table capacity, allocation history and machine contention; mark time is more informative here than total pause.Deleting map keys and nulling array slots deliberately leaves their outer capacity allocated. Thus byte differences understate the savings from replacing an entire structure. The catalog removal releases its nested collections too. After all removals, 539,966 objects and 629,203,513 counted bytes remained: 17,450,331 fewer objects (97.0%) but only 637,373,422 fewer bytes (50.3%). This is a diagnostic stripped app, not a functioning replacement or a promised optimization result.## Measured retained structuresIn this table, “cut” is relative to the preceding row. Bytes are runtime-counted heap bytes, not RSS or MessagePack file sizes.| Stage | Surviving objects | Surviving bytes | Objects cut | Bytes cut | Median mark ms ||---|---:|---:|---:|---:|---:|| baseline | 17,990,297 | 1,266,576,935 | 0 | 0 | 1538.1 || drop searchArrays | 14,988,841 | 1,207,548,304 | 3,001,456 | 59,028,631 | 1271.5 || drop searchBuckets | 14,935,943 | 1,123,864,907 | 52,898 | 83,683,397 | 1268.9 || drop searchMaps | 14,632,408 | 1,120,367,327 | 303,535 | 3,497,580 | 1159.9 || drop peopleSlugs | 13,412,041 | 1,103,712,118 | 1,220,367 | 16,655,209 | 1027.7 || drop peopleTmdb | 12,191,673 | 1,095,389,047 | 1,220,368 | 8,323,071 | 927.4 || drop peopleView | 9,750,937 | 1,046,574,606 | 2,440,736 | 48,814,441 | 734.0 || drop castProfiles | 8,719,485 | 1,021,829,786 | 1,031,452 | 24,744,820 | 693.4 || drop shortOwners | 4,218,536 | 952,815,903 | 4,500,949 | 69,013,883 | 376.9 || drop shortQueue | 4,217,381 | 952,662,183 | 1,155 | 153,720 | 371.5 || drop catalog | 1,543,250 | 659,069,035 | 2,674,131 | 293,593,148 | 120.0 || drop titleSlugs | 703,617 | 642,712,251 | 839,633 | 16,356,784 | 56.1 || drop requestCaches | 553,544 | 629,992,246 | 150,073 | 12,720,005 | 45.6 || drop franchises | 539,966 | 629,203,513 | 13,578 | 788,733 | 45.4 |The exact structure counts and their interpretation are:| Structure | Entries in the warmed copy | Marginal objects/entry and bytes/entry | Access pattern inferred from code ||---|---:|---|---|| Search parallel arrays | 1,500,729 entries: 280,049 titles + 1,220,680 people | About 2 objects and 39.3 bytes; primarily normalized text descriptors/buffers. Array capacity remains. | Needed for search; cold for other pages. || Search buckets | 26,448 prefix buckets | About 2 objects and 3,164 bytes/bucket, mostly arrays of numeric candidate positions. | Search only. Few objects, substantial bytes. || Search auxiliary maps | TMDB 279,861; TVmaze 23,617; taken slugs 279,888; visibility 279,950; title positions 279,861; stale positions 0 | 303,535 objects and 3,497,580 bytes collectively in this removal order; shared keys/IDs make a per-map split unavailable. | Import/sync maps are mostly job/write paths; visibility is hot during search. || Person slug lookup | 1,220,368 keys | About 1 object and 13.6 bytes: slug key buffers at this point; map capacity remains. | Person page lookup; most individual keys are cold. || Person TMDB lookup | 1,220,368 keys | About 1 object and 6.8 bytes: numeric key text buffers; capacity remains. | Cast import and guest lookup, mostly cold between writes. || People ordering | 1,220,682 IDs, including repeated physical rows | About 2 objects and 40 bytes; ID strings become unreferenced in this order. Two startup arrays already have null slots but retain capacity. | `/people` pagination needs only a slice of 24; updates reorder it. || Cast profile fallback | 343,816 person keys | About 3 objects and 72 bytes | Only accessed for selected people without another photo source; most keys are cold. || Short-ID owners | 1,500,318 owners | About 3 objects and 46 bytes: key bytes plus prefixed owner String descriptor/buffer. Capacity remains. | Short redirects and allocation uniqueness; most owners are cold on ordinary page requests. || Short-ID queue | 502 rows | About 1,155 objects / 153,720 bytes collectively; shared IDs affect the difference. | Backfill only; disabled in this copy. It is small. || Catalog | 225,628 public movie rows + 50,471 public TV rows; 456,679 genre memberships | 2,674,131 objects / 293,593,148 bytes collectively, including release maps, genre membership maps and nested lists. A single uniform per-entry size would be misleading. | Homepage/list/genre navigation is hot, but each page needs a small slice. || Title slug/rank maps | 279,888 keys in each | About 3 objects and 58.4 bytes per distinct slug, collectively across both maps at this stage. | Title lookup/redirect, hot lookup operation with mostly cold keys. || Five request caches | Cards 133; episode-row sets 133; episode keys 12,840; credit rows 0; person links 0 | 150,073 objects / 12,720,005 bytes collectively | Hot followed-title data. Existing bounds should stay. This is under 1% of the measured object heap. || Franchise reverse map | 5,018 title keys; 1,771 timelines; 17 franchises | 13,578 objects / 788,733 bytes collectively | Widget lookup; small. |Array `.keys()` returned no ordered indices in the first probe output. Those logged zeros are not empty arrays: logical array counts above come from the completed boot/search/short-ID logs. The removal code correctly walks `.length` and nulls each slot. Catalog membership counts come from the full disk census with the app's public-title predicate; splitting TV rows by series/show kind was not needed for the heap difference.There is no request-frequency telemetry in this experiment. “Hot/cold” describes which code paths read a structure, not measured production hit rates. Old short-ID reservations (702), small configuration values and other unmeasured runtime/framework data are part of the residual. A separate application string pool was not identified in the reviewed topic files. The exact type composition of the residual, interned strings and framework/session state could not be measured with the public app surface.## Stored records versus retained graphs`census.py` reads every length-prefixed MessagePack record and excludes offsets in the table's metadata `deleted` list. `distinct.py` additionally counts distinct `id` values. Physical nondeleted rows and logical IDs differ slightly; the boot logs independently agree with the large-table physical counts. These counts describe this backup, not the current live database.The “decoded object model” below is maps + lists + twice the number of string **values**. A runtime String has a descriptor and backing bytes. This deliberately excludes copied field-key buffers, sharing, interning and wrapper details, so it is a shape estimate if all records were kept decoded, not a measurement of objects actually retained. Full census detail and field counts are in `census.json` and `distinct.json`. Packed bytes include the four-byte record header.| Table | Nondeleted rows | Distinct IDs | Live packed bytes | Decoded object model, not retained heap ||---|---:|---:|---:|---:|| collectionchecks | 125,257 | 125,257 | 8,659,346 | 626,285 || episodes | 2,551,065 | 2,550,598 | 700,563,769 | 38,162,085 || follows | 135 | 135 | 14,822 | 1,215 || franchises | 17 | 17 | 3,283 | 153 || franchiseseed | 60 | 60 | 13,816 | 1,357 || genres | 27 | 27 | 2,708 | 243 || persons | 1,220,682 | 1,220,368 | 434,926,825 | 27,657,723 || seasons | 110,503 | 110,503 | 63,351,958 | 6,633,781 || shows | 280,138 | 279,950 | 948,954,588 | 57,273,366 || timelines | 1,771 | 1,771 | 393,525 | 31,408 || users | 1 | 1 | 55 | 5 || watches | 13,455 | 13,455 | 1,756,317 | 148,099 |The title data contains 4,944,934 cast entries and 806,164 crew entries; their value-graph model contributes 41,333,072 and 6,631,117 objects respectively if materialized together. Person filmographies contain 1,934,695 credits, modeled at 12,315,695 objects. Season episode-ID lists contribute 5,196,617 modeled objects. These are the tempting “cold graphs”, but the running app does not retain these tables wholesale: `MPackDB.cursor/iterate` decodes rows individually, and `fetch` reads selected records. Temporary startup or page allocations can still be expensive.The backup has 188 extra title rows sharing an ID, 314 extra person rows and 467 extra episode rows. Startup logs confirm same-owner short IDs entering the queue. This is only 502 queue rows overall, not the explanation for millions of retained objects. No data repair was attempted. Normal copy startup did run its existing summary migration; the copy was disposable.The native MPackDB indexes are a separate memory category. `indexes.py` counted every on-disk index entry and key byte. For the stored entry shape (`Key` tagged union + offset + length, modeled as 40 bytes on this 64-bit target), entries plus key text total approximately **641,419,814 bytes**, before capacity slack, allocator overhead, metadata and any open-time reconciliation. Episodes account for 304,770,582 bytes; persons 208,633,047; titles 106,174,138; seasons 12,982,761. These indexes can include obsolete offsets and are not a count of live logical records. They belong to the native plugin, not millions of GC-managed record graphs. This is a layout estimate, not a native heap measurement.The GC object table itself is also separate: the baseline has 134,217,728 slots at 16 bytes/slot, approximately 2 GiB, outside the reported live-byte counter. Neither the native index estimate nor that table should be mistaken for the 1.267 GB counted heap. RSS includes more categories and allocator retention.Production sessions were deliberately not restored or read. The copy used an empty session directory and no browser. Its production session contribution cannot be inferred from this measurement. Watch caches are empty before a user request; the watches table is small (13,455 rows). No UI change was made and no browser/tunnel was started.## App-side optionsSavings below are estimates from this copy, conditional on preserving behavior and removing the corresponding object representation. They are not additive independent benchmarks. New buffers, bounded caches and shared references will alter the final saving. Mark percentages use the 17.990 million-object baseline; total-pause reductions will be smaller or different.| Option | Expected object reduction and mark implication | Cost, risk and Hybriel needs ||---|---|---|| Replace short-ID owners with a packed lookup, or indexed `shortId` lookups in both tables | Approximately 4.50 M objects, 25.0% of the baseline. Measured payload difference is 69 MB, plus potentially about 101 MB of map backing if the outer structure is released. A fixed 22-byte shortId/kind/id representation would hold about 33 MB before offsets/overhead. | Best large cold target. Preserve uniqueness across both tables, old reservations and tombstone redirects. Existing MPackDB indexes suffice in principle; adding indexes to existing stores needs a tested copy migration. A packed lookup needs app decoding/search code, no runtime patch. || Store search text in a shared packed buffer with numeric offsets; decode candidates on demand | Approximately 3.00 M objects, 16.7%. It removes per-entry String descriptors/buffers; the text payload itself remains, so the 59 MB deletion result is an upper bound on byte savings from packing. | Keep prefix buckets, matching, accents, years and ranking unchanged. Candidate decoding trades allocations/CPU against mark work. Existing Bytes/string operations are enough in principle; benchmark common-prefix searches. || Move person slug/TMDB maps to native indexed lookups, or packed sorted keys | Approximately 2.44 M key objects combined, 13.6%, while other references still retain IDs. Payload differences total about 25 MB; two power-of-two outer maps can retain approximately 201 MB backing. | Two frequent lookup operations become disk/native-index searches. Preserve slug conflicts, guest creation and new-person updates. MPackDB already supports declared indexes; migration correctness and native-memory cost need testing. || Pack the people ordering into IDs/offsets and release completed startup buffers | Up to approximately 2.44 M objects in this removal order, 13.6%; standalone savings may be smaller while other structures reference the same ID strings. | Preserve stable ordering, equal-time ties and recent updates. Low implementation scope compared with storage migration. IDs can be decoded for one page. Existing language features suffice. Releasing null-filled startup arrays mainly saves bytes and scanned slots, not millions of objects. || Flatten catalog `{id,key}` records into parallel arrays or packed entries | The whole catalog measures 2.67 M marginal objects (14.9%) and 294 MB. A flattening saves a subset; roughly 0.73 M row containers is a useful first target, with larger cuts requiring packed/shared IDs and keys too. | Keep list order, genre membership, day rollover, refresh and ties correct. Lists are hot, so retaining sortable compact keys is preferable to fetching every candidate. Existing app features suffice; native sorting is not assumed. || Replace cast-profile fallback map with compact storage or stored per-person fallback | Around 1.03 M objects in this order, 5.7%; 25 MB payload plus outer map capacity. | Do not lose photos for legacy people. A deliberate copy-tested migration or compact immutable map avoids repeated title scans. No new runtime feature is inherently needed. || Serialize cold whole title/person/episode records and decode on demand | Near-zero additional steady-state object cut from replacing wholesale table graphs: those graphs are already streamed/fetched on demand. | Could reduce transient allocation in specific page/boot paths using slimmer projections. A new public projection API would be a Hybriel feature request; do not decode an entire table just to pack it again. |For orientation only, short-ID owners + search text + the two person key maps represent about 9.94 M ordered marginal objects, roughly 55% of this baseline. The stripped experiment's 97% reduction shows the upper ceiling of deleting useful indexes, not a practical target by itself. Start with the short-ID representation and a compact people order, then measure actual page/search latency and update behavior before choosing additional cuts.## Profiling gap and reproducible request for AntonAn attempted app `import c { hl_gc_collect_now } from 'hlrt'` was refused: “'import c' is the runtime's own surface: only a file of the runtime (runtime/) or of a package whose plugin.json declares 'system': true may use it”. That attempt was removed. No plugin privilege bypass, custom runtime collector or per-type workaround was built. The final experiment uses existing GC logs and normal table streaming only.Please provide a supported diagnostic snapshot that can request collection and report live objects/bytes by collector kind and named application root, distinguishing shared strings, key buffers, hybrid backing storage and native plugin allocations. Repro: run this worktree's app-only removals on the named backup, compare `server4.log` before/after `hm1searchArrays`, `hm1shortOwners` and `hm1catalog`. Today the logs can prove marginal totals but cannot identify types/owners for the remaining 539,966 objects or charge shared bytes to roots. A projection/field-select API for MPackDB would separately help avoid decoding cold cast/filmography fields for slim reads.DOCS: Read the complete mission, archived WORKER-RULES, HL-PRIMER, CODE-ORDER and archived RULINGS; used project.hl's map, README configuration/storage material, the MPackDB class/cursor surface, and the relevant topic implementations. The requested current MANUAL path was absent; archived rulings were located and read. Language questions included ordered arrays versus named `.keys()` and the prohibition on application `import c`. The remaining documentation/API gap is a supported app heap snapshot/root attribution and an explicit projection API. No component/style work required framework changes.## Process and artifact cleanupThe long-lived successful server was PID **2763914**, checked with cwd inside scratch, then stopped with SIGTERM after `[hm1] finished`; `/proc/2763914` disappeared. Earlier server PID **2715601** exited on the refused `import c`; PID **2753679** was stopped with SIGTERM after checking its scratch cwd to correct the array probe. An initial background launch PID **2709209** ended immediately without a server; a subsequent parse-error launch exited immediately, but its PID was not captured. The short array-keys probe exited normally; its PID was not captured. These failed attempts are retained as `server.log`, `server2.log`, `server3.log`; only `server4.log` supplies final results.Backup extraction tar PID **2681581** and gzip PID **2681640**, census Python PID **2715846**, and the finite index/distinct/monitor scripts all completed. PIDs of the latter short scripts were not all captured; no background loop is left. No Chrome, browser tab, tunnel, byrodin operation, load generator or external paid service was started. Compilation unexpectedly used its default home code cache despite TMPDIR/XDG_CACHE_HOME; all three cache entries identified by this worktree's path in their input manifests were deleted, including both app builds and the keys probe. Reproduction should set `HL_CACHE_DIR` as well. No `.env` was read.The unpacked `copy/` is deleted after stopping the server. Raw data is not left in the worktree. Logs, census aggregates, scripts, diagnostic patch and the worktree remain under scratch for review. Final port/process checks are recorded in `cleanup.txt`; port 8701 is free and the recorded servers are gone. The only authored main-repo file is this report; no LOG/STATUS edit or commit was made because the mission explicitly permits only this report there.Work took approximately 15 source/rule inspection interactions, 12 preparation/instrumentation/census interactions, 25 measurement/wait interactions and 7 reporting/cleanup interactions (roughly 60, including failed probes). Exact billed USD is not exposed by these tools; no subagents or separately billed external calls were used.
Branches
Latest commits
- d2e6d26bMerge branch 'records-park55' into mainTracker
- f567f025|||PR records: park #55, no Claude workers ruleTracker
- c21aff6bMerge branch 'records-hm55c' into mainTracker
- 9ba258d3|||PR records: HM55b resultTracker
- 64f2d300Merge branch 'records-hm55b2' into mainTracker
- ae3b80dc|||PR records: HM55b briefTracker
- 7ef3cb3bMerge branch 'records-st55' into mainTracker
- fec2e080|||PR records: STATUS HM55Tracker
- 8e174918Merge branch 'records-hm55b' into mainTracker
- b1ecee57|||PR records: HM55 stateTracker
- 28eab08cMerge branch 'records-hm55' into mainTracker
- d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
- 3059f86cMerge branch 'records-design-rule' into mainTracker
- 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
- d1390692Merge branch 'records-dp75b' into mainTracker
- a4d1a7d2|||PR records: later steps checked, branch auditTracker
- e070e16fMerge branch 'records-dp75' into mainTracker
- 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
- bfc4ea4dMerge branch 'ap62' into mainTracker
- 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker