Commit graph

2862 commits

Author SHA1 Message Date
Erik
58e7c2eb99 feat(rendering): journal live scene projections
Mirror exact live-root and equipped-child lifetimes behind the non-drawing render-scene boundary. Ready, visibility, final-pose, rebucket, removal, and resource teardown edges retain canonical LiveEntityRuntime identity while active-only synchronization avoids resident-static scans.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 22:05:42 +02:00
Erik
5d19c56d15 feat(rendering): journal static scene projections
Append exact static and EnvCell-shell projection deltas only at committed spatial activation and detach receipts. Same-landblock rehydrate now reconciles retained, new, and omitted presentation identities without constructing or drawing the shadow scene in production.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 21:57:33 +02:00
Erik
dbd8318417 feat(rendering): contain incremental render scene
Pin Arch behind acdream-owned identities, deltas, queries, generation gates, and memory diagnostics. The new five-archetype store is unbound and non-drawing so static publication can be shadowed without changing production behavior.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 21:42:42 +02:00
Erik
f9b68f8f2a feat(rendering): complete current-path render referee
Extend the non-drawing oracle through ordered PView routes, dispatcher visibility and final instance payloads, and accepted retail selection parts. Lifecycle artifacts can now referee the later shadow scene without influencing production visibility or draw decisions.
2026-07-24 21:28:12 +02:00
Erik
dbaea19269 test(streaming): decouple lifecycle assertions from wall time
Use an explicit generous work profile in multi-operation behavior tests. Their contract is failure isolation and retirement ordering, not whether cold JIT work fits the production two-millisecond frame budget.
2026-07-24 21:26:53 +02:00
Erik
b2b67341ac feat(rendering): establish current-path scene referee
Capture deterministic, landblock-aware fingerprints from the accepted partition only during lifecycle automation. This gives the F/G shadow scene an independent oracle without changing normal draw decisions or adding disabled-path per-entity cost.
2026-07-24 21:13:11 +02:00
Erik
5ecaa5612d docs(runtime): approve render scene program 2026-07-24 21:01:40 +02:00
Erik
e7d9d6fa7d docs(runtime): close cost-budgeted streaming slice
Record the exact physical-display evidence, ownership fixes, budget semantics, and performance deltas that close Slice E. Reconcile the architecture, roadmap, milestones, issues, documentation map, and session instructions before the explicit F/G approval gate.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 20:52:20 +02:00
Erik
91e82c3c68 fix(streaming): prepare quiesced destination entities
Separate loaded spatial residency from the world presentation gate so destination live objects acquire mesh owners behind portal space while drawing and simulation stay quiesced. Prevent unowned CPU-cache hits from recreating stale GPU staging work.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 20:21:57 +02:00
Erik
e991eeca34 fix(render): make reveal warmup mutation-resumable
Retain composite candidate progress across live membership generations and run a stable follow-up pass after churn, preventing ACE object-stream updates from resetting portal readiness forever.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 19:54:40 +02:00
Erik
a77ba06722 fix(audio): keep unavailable world slots quiescent
Construct the retail-sized world voice ledger independently of OpenAL device availability so world reveal suspension is a safe no-op on machines without an audio backend.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 19:49:25 +02:00
Erik
3f1548b952 fix(net): preserve failed session tick stacks
Keep the original exception stack when cleanup succeeds so connected lifecycle failures identify the real packet/event handler instead of the session wrapper.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 19:48:11 +02:00
Erik
621f70eab6 test(streaming): enforce slice E physical evidence
Record route-lifetime streaming overruns and maximum operation costs, require canonical reveal/resource convergence at every connected checkpoint, and keep recenter semantics independent of the production wall-clock budget.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
2026-07-24 19:46:17 +02:00
Erik
2ff8f844b0 perf(streaming): reserve destination reveal capacity
Join destination scheduling to the canonical reveal generation, protect its share across every typed frame-budget dimension, and prevent stale work from clearing a replacement reservation. Remove forced incomplete materialization and project retail's centered portal wait cue while the authored tunnel remains active.

Tests: Release build clean; 91 focused reservation/reveal tests; full solution 8,158 passed, 5 skipped.

Co-authored-by: Codex <noreply@openai.com>
2026-07-24 19:39:23 +02:00
Erik
98f1ac8934 perf(streaming): cursor publication across frame budgets 2026-07-24 19:10:18 +02:00
Erik
bb16f74fd4 perf(streaming): quiesce retired generations and budget teardown
Publish the retail blocking-for-cells edge before deferred recenter work, freeze old-world presentation/simulation/audio, and advance full-window retirement from exact metered entity and owner cursors. This removes synchronous portal teardown without allowing retained owners to remain observable.
2026-07-24 18:29:52 +02:00
Erik
b8f6317fe1 feat(streaming): enforce typed completion queues
Replace the flat deferred list, priority scan, unload bypass, and count-only execution cap with exact destination/control/unload/Near/Far FIFOs behind one typed frame meter. Price worker results before adoption, retain exact retry identity, reject stale generations without payload retention, and publish queue pressure through lifecycle diagnostics.

Tests: dotnet build AcDream.slnx -c Release --no-restore; dotnet test AcDream.slnx -c Release --no-restore (8138 passed, 5 skipped)
2026-07-24 17:48:24 +02:00
Erik
ac45cb1bd7 feat(streaming): establish cost budget ledger
Add the validated frame-work profile, deterministic completion charges, and shadow admission meter before enforcing the scheduler in Slice E2. Lifecycle artifacts now expose elapsed work, would-yield limits, backlog bytes/age, and pending owner ledgers without changing accepted execution.

Tests: dotnet build AcDream.slnx -c Release --no-restore; dotnet test AcDream.slnx -c Release --no-build --no-restore (8124 passed, 5 skipped)
2026-07-24 17:26:34 +02:00
Erik
2945896a6f docs(streaming): define cost-budgeted lifecycle 2026-07-24 17:11:54 +02:00
Erik
66690805c5 docs(render): close unified residency slice 2026-07-24 17:06:17 +02:00
Erik
1853a57c12 feat(diagnostics): complete residency pressure ledger
Complete Slice D4 by adding aggregate lifecycle occupancy and traffic facts, validating physical source reports, and including decoded audio under the typed startup budget. Exercise every domain under forced pressure and retain the real cache/fence convergence gates.
2026-07-24 16:40:17 +02:00
Erik
f2644d42c2 perf(render): bound animation and alpha scratch residency
Complete Slice D3 by replacing the unbounded animation dictionary with a concurrent byte/count LRU and by putting the three retail alpha scratch owners behind one typed aggregate budget. Preserve immediate growth and draw order while reclaiming one-frame density spikes after sustained under-use. Close stale bounds-cache issue evidence without inventing a cache.
2026-07-24 16:34:28 +02:00
Erik
3e18fc2730 feat(render): unify physical residency accounting 2026-07-24 16:20:48 +02:00
Erik
1866ea0c6d feat(render): establish typed residency policy ledger
Define Slice D's transition and concurrency contract, add generation-safe asset handles and owner leases, and parse the existing cache ceilings through typed runtime budgets. Stale generations cannot release or revive replacements, and worker observations are bounded and coalesced.

Co-authored-by: Codex <noreply@openai.com>
2026-07-24 16:05:46 +02:00
Erik
a564c4b782 perf(content): close prepared asset cutover 2026-07-24 15:49:24 +02:00
Erik
b1ad4b7c0a perf(diagnostics): expose prepared asset source counters 2026-07-24 15:16:32 +02:00
Erik
230a7df454 perf(content): remove exception-driven setup probes 2026-07-24 15:12:21 +02:00
Erik
f05afc07c1 perf(render): consume prepared mesh package at runtime 2026-07-24 15:07:25 +02:00
Erik
c42f93b323 perf(content): add typed prepared asset source
Introduce explicit loaded, missing, and corrupt outcomes over typed pak keys, validate package/DAT identity at open, add zero-I/O TOC probes, preserve cancellation, and route the package path through RuntimeOptions. Production injection follows in the next checkpoint.
2026-07-24 14:52:12 +02:00
Erik
7fb7189de8 docs(perf): bind Slice C prepared-asset cutover
Define the typed prepared-source contract, runtime identity rules, production injection and lifetime order, activation probe cleanup, and the exact equivalence/performance gates for MP1c.
2026-07-24 14:46:00 +02:00
Erik
2421d09f5d docs(perf): commit physical Slice A baselines
Capture the authoritative capped, uncapped, and dense-Arwic routes on the physical AMD display path. Preserve the portal allocation, exception-storm, and repeated-Caul memory failures as MP1c's before-state while unblocking the prepared-asset cutover.
2026-07-24 14:41:50 +02:00
Erik
49f3a48ee6 docs(perf): close Slice B with full-bake evidence 2026-07-24 14:10:50 +02:00
Erik
90bf6bbf45 perf(bake): stream catalog and bound validation residency 2026-07-24 14:05:30 +02:00
Erik
b7b9aaa9dd fix(render): eliminate EnvCell identity collisions 2026-07-24 13:44:56 +02:00
Erik
999201cca7 feat(bake): publish validated pak artifacts atomically 2026-07-24 13:40:58 +02:00
Erik
90b378cc70 feat(bake): extract each EnvCell geometry once 2026-07-24 13:38:44 +02:00
Erik
0dee14765b feat(content): add physical blob aliases to pak writer 2026-07-24 13:33:53 +02:00
Erik
86fadf8661 refactor(content): share EnvCell geometry identity 2026-07-24 13:32:03 +02:00
Erik
05a22dee99 docs(perf): record corrected Slice A RDP baselines 2026-07-24 13:29:23 +02:00
Erik
24f898c54d fix(diag): identify the binary measured by soak reports 2026-07-24 13:21:08 +02:00
Erik
1560c0513f docs(perf): plan Slice B EnvCell dedup gate 2026-07-24 13:16:33 +02:00
Erik
4285f1dbb1 fix(diag): attach EventPipe observers after client startup
Starting dotnet-counters in the process-creation race can suspend the CLR before the graphical host creates its window. Wait for the guaranteed in-world boundary, then attach counters and contention tracing during the route's warm-up interval.

Co-Authored-By: Codex <noreply@openai.com>
2026-07-24 13:09:24 +02:00
Erik
2c874b0977 fix(diag): bind stationary samples to route checkpoints
Free-running sleeps could label a sample as the old scene exactly when automation began the next teleport. Give every route stop an explicit post-input liveness dwell and post-checkpoint hold, then capture process and frame facts only after its named canonical barrier.

Co-Authored-By: Codex <noreply@openai.com>
2026-07-24 12:54:57 +02:00
Erik
e797e7482a fix(diag): gate connected soak on guaranteed login boundary
The first-player-position line is emitted only when initial streaming must recenter. Treating it as a required login event made a valid same-landblock login time out while route automation was already running. Gate on in-world and the route's authoritative materialization barriers instead.

Co-Authored-By: Codex <noreply@openai.com>
2026-07-24 12:49:59 +02:00
Erik
3ee8ec537a perf(diag): complete trustworthy Slice A capture tooling
Correct whole-frame GPU timestamps so they bracket only the accepted render transaction and associate delayed query results with the owning CPU frame. Add route-wide frame-history summaries, fixed-camera screenshot comparison, process counters, contention traces, a pinned Arwic workload, and credential-safe launch disclosure.

The reference hardware/display contract now keeps local and RDP populations separate and defines the screenshot and re-baseline rules needed by later prepared-content gates.

Co-Authored-By: Codex <noreply@openai.com>
2026-07-24 12:46:51 +02:00
Erik
bf7ec12f68 docs(handoff): correct worktree-cleanup status (three orphaned dirs remain file-locked)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 12:19:24 +02:00
Erik
7cb64ac2c7 docs(handoff): 2026-07-24 audit-review remediation handoff for the next agent
Condenses the adversarial review's binding findings (uncapped-capture
provenance, frame-thread vs process-wide allocation attribution split,
cache-undersizing reality, unattributed lock contention), the eight
landed commits (both render changes user-accepted via visual pass), the
ordered next-action list (baselines -> Slice A remainder -> Slice B;
M4 main line wins; F/G stays user-gated), deferred issues #236-#244,
and the worktree-agent base-skew gotcha.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 12:16:42 +02:00
Erik
7b456b49d6 perf(diag): per-frame history export + checkpoint LOH/cache counters + soak capped mode (2026-07-24 audit review)
An adversarial performance review found our own instruments cannot
measure the project's own performance gates:

- FrameProfiler aggregated CPU/GPU/alloc/stage samples into ~5-second
  windows and reset the ring buffers after each report, so route-wide
  p50/p95/p99 distributions across a whole soak could not be
  reconstructed after the fact. ACDREAM_FRAME_HISTORY=<path> now opts
  into a separate per-frame history (one record per frame, ~72
  bytes/record, accumulated in memory with zero frame-thread I/O) that
  a shutdown-only Dispose() writes as CSV. The aggregated [frame-prof]
  report format and its existing metrics are unchanged.

- The canonical checkpoint JSON tracked cache residency (entry/byte
  counts) but never LOH size/fragmentation, process-wide allocated
  bytes, or cache hit/miss/eviction traffic — a committed audit JSON
  showed 65% LOH fragmentation that no tracked instrument recorded,
  and "does a revisit portal hit or miss the caches" was unanswerable
  from an artifact alone. WorldLifecycleResourceSnapshot now carries
  loh_size_bytes/loh_fragmentation_bytes (GCMemoryInfo.GenerationInfo
  index 3), process_total_allocated_bytes (GC.GetTotalAllocatedBytes),
  and Interlocked hit/miss/eviction counters for the CPU mesh cache,
  decoded-texture cache, and the four bounded DAT-object caches
  (portal/cell/highRes/language, aggregated).

- run-connected-r6-soak.ps1 unconditionally forced
  ACDREAM_UNCAPPED_RENDER=1 with no capped mode, while its sibling
  lifecycle-gate script correctly gated it behind a switch. Added
  -Uncapped (default capped, matching the sibling script's pattern),
  fixed the stationary dwell (12s -> 26s, past the 25s
  LiveEntityLivenessController deadline the adjacent comment already
  cited), and now write an env-disclosure.json into the automation
  artifact directory before every launch listing every ACDREAM_* var
  the script sets plus -Uncapped, since the prior audit could only see
  ACDREAM_DUMP_MOVE_TRUTH and nothing else was ever recorded anywhere.

Cache counters are wired via the existing composition path
(ObjectMeshManager already owns the CPU mesh cache and the mesh
extractor directly; content.Dats is threaded into
WorldLifecycleResourceSnapshotSource the same way every other
composition consumer receives it). The DAT-object cache lives behind
IDatReaderWriter, a third-party interface from the DatReaderWriter
package that cannot be extended; RuntimeDatCollection (the one
production implementation) exposes the aggregate stats directly and a
pattern match reads them, degrading to zero for any test double —
no new static registry was introduced (GpuMemoryTracker remains the
one precedented process-wide static).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 1da2c33c875b41fa383dd79694ee2765f0e21896)
2026-07-24 12:00:30 +02:00
Erik
bfc5e47365 docs(issues): file #236-#244 - deferred P2 findings from the 2026-07-24 audit review
Nine tactical entries for verified findings the review chose not to fix
inline: UiText per-frame re-wrap (#236), Transition per-resolve allocation
graph (#237, pooling gated on Slice I lifetime tests),
EquippedChildRenderController double-tick + ToArray snapshots (#238),
inbound per-packet allocation chain (#239, Slice H-c scope),
RetailAnimationLoader unbounded cache (#240), InteriorEntityPartition
landblock frustum cull reusing the diagnostics AABB results (#241),
publication third-dictionary + per-attempt re-sort (#242), _boundsCache
bound (#243), SequencerFactory unguarded Setup probe + [dat-miss]
under-lock logging (#244).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 11:52:31 +02:00
Erik
1e9031e7b7 fix(audio): bound decoded-wave and AL-buffer caches (2026-07-24 audit review)
Two audit-verified caches grew monotonically for process lifetime, which is
fatal for the 30-bot long-uptime headless-fleet goal:

- DatSoundCache._waves (Core) memoized every decoded PCM WaveData forever
  in a bare ConcurrentDictionary — no LRU, no byte budget.
- OpenAlAudioEngine._bufferByWaveId (App) retained a native OpenAL buffer
  copy of the same PCM per wave id until engine disposal — a second,
  independent unbounded cache.

DatSoundCache now bounds payload residency with a 32 MiB byte-budget LRU
(decoded PCM waves run ~100-500 KB each, so this holds a comfortable
working set). Missing/unsupported-format waves are memoized separately in
an unbounded-but-cheap negative-result set (bounded by the finite Wave dat
id space) so they can never compete with or get evicted alongside payload
entries. Concurrent first-touch decodes of the same wave id are deduped
via a shared Lazy<T> so racing callers don't pay for WaveDecoder.Decode
twice. AcDream.Core cannot reference AcDream.Content (code-structure rule
2), so the LRU is a local reimplementation mirroring
BoundedDatObjectCache/DecodedTextureCache's shape rather than a shared
dependency.

OpenAlAudioEngine._bufferByWaveId now bounds native buffer residency with
a 48 MiB byte-budget LRU (AlBufferBudgetTracker), evicting least-recently-
used buffers once oversized. alDeleteBuffers fails on a buffer still
attached to a source, so eviction queries live AL per-source state
(GetSourceInteger.Buffer) rather than tracking a second, easily-stale
copy — several call sites (Play3DWave, PlayUiWave) set a source's buffer
directly. The buffer EnsureBuffer just created is explicitly protected
from its own eviction pass, since the caller hasn't attached it to a
source yet at that point. Evicted waves simply replay through
DatSoundCache -> EnsureBuffer on next use, identical to a first play.

Verified before implementing: AudioHookSink is the only GetWave caller
(single per-frame render-thread path per AnimationHookRouter's own
threading doc), and PcmBytes is read only at DatSoundCache.Admit (byte
accounting) and EnsureBuffer's first-upload branch — confirmed dead after
AL upload on the steady-state replay path, so bounding either cache
independently is correctness-safe; a cold replay after both evict simply
falls back to a full re-decode + re-upload, identical to a first play.

AlBufferBudgetTracker's eviction/budget decision is extracted as pure
logic (no AL dependency) specifically so it's unit-testable: the existing
OpenAlResourceLifetimeTests fake exposes a null AL, which short-circuits
every native buffer call before it runs, so the engine's actual AL wiring
isn't testable headless.

Tests: 9 new DatSoundCacheTests (Core.Tests) covering eviction order, byte
accounting, negative-result memoization, oversize-single-entry handling,
and concurrent-access smoke tests; 10 new AlBufferBudgetTrackerTests
(App.Tests) covering the pure LRU/budget/protection logic. Full suite:
3214/2 skip (Core.Tests), 3471/3 skip (App.Tests) plus one pre-existing,
unrelated failure (LandblockBuildOriginTests.FarLoad_..., reproduces
identically with these changes stashed out — landblock streaming, not
audio).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 76c880d35bcf30b50e3f7b4cb8635dc9ab9e3ec7)
2026-07-24 11:49:57 +02:00