Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule shared.module·originates fromworld 07158574-5…

observe

The record of what a scene load did, and what each loaded scene costs. Backs `layers.observe`, `layers.lastLoad`, `layers.lastUnload`, `layers.loadHistory`, `layers.problems`, `layers.whyPartial`, `layers.inventory`, `layers.cost` and `layers.resetCostWindow`, and the `scene` too…

by◐lumi·posted 1mo ago
What it does

scene_observe

The record of what a scene load did, and what each loaded scene costs. Backs layers.observe, layers.lastLoad, layers.lastUnload, layers.loadHistory, layers.problems, layers.whyPartial, layers.inventory, layers.cost and layers.resetCostWindow, and the scene toolbox's observe, whyPartial and cost above them. layers and scene_loader are its writers.

One record per load

A load opens a record; the loader, the lifecycle dispatchers and the scene's own build write their failures and phase timings into it; the load's own completion point closes it with the duration the engine already measured for its DONE line. Reading is lazy — nothing here walks the world, and the only writer that runs every frame is noteUpdate, which the entrypoint tick calls once per scene that declares one.

local r = layers.lastLoad()
print(r.name, r.outcome, r.durationMs)
print(r.entities.added, "arrived,", r.entities.removed, "left")
print(r.phases.teardown, r.phases.instantiate, r.phases.settle)

outcome is "ok" when everything the scene declared was produced, "partial" when the load finished with failures in it, "failed" when the load raised and left no layer, and "unchanged" when the scene asked for was already the active root — that load rebuilt nothing, so the layer keeps the record of the load that built it and still answers why it is not whole.

reason names the nearest cause from the closed set — loaderRaised, entrypointCompileFailed, entrypointBodyRaised, entrypointRaised, buildRaised, entityFailed, parentMissing, parentRefused, parentAbandoned, componentUnresolved, componentRefused, subscriberRaised, updateRaised — ranked so it names the thing to fix rather than the last thing to break.

Failures reach the layer they belong to

Every write of a failure calls the subscriber layers registers through M.onFailure, which republishes the record onto that layer's proxy: ok false, failures the records, and "partial" in place of "ready" once the layer has settled. A tick that starts raising on frame 400 moves the layer the same way one raised during the load does.

A failure identical to one already held raises that one's count, so a tick raising every frame keeps one record. FAILURE_LIMIT bounds the distinct records a report holds, and failuresOmitted states how many arrived past it.

Cost

noteUpdate accumulates each layer's entrypoint tick into a per-guid entry — calls, total, last, max, average and how many raised — summed across the window M.window() reports. M.resetWindow() opens a new one, leaving the load history alone. An unload drops the layer's entry.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

The record of what a scene load did, and what each loaded scene costs. One observation, recorded where the work happens and read lazily. A load opens a record, the loader and the lifecycle dispatchers write their failures and phase timings into it, and the load's own completion point closes it with the duration the engine already measured. Nothing here runs per frame except `noteUpdate`, which the per-frame entrypoint tick calls once per scene that declares one — two clock reads per loaded entrypoint, independent of how many entities the world holds. `layers.observe` and its composed accessors are the public reading of this module; `layers` and `scene_loader` are the writers.

nowMs( ) → number

newPhases( ) → SceneLoadPhases

recordFor(guid: string?) → SceneLoadReport

The record a failure for `guid` belongs to: the load still running for that scene, else the last one that finished. Returns nil when nothing about that guid has ever been recorded, which is what a failure raised by content the observation never saw load looks like.

argtypedescription
guidstring?

resolveOutcome(record: SceneLoadReport) → void

Rank a report's failures and write the nearest cause onto it.

argtypedescription
recordSceneLoadReport

noteCollection(record: SceneLoadReport?, collection: SceneLoadCollection) → void

Record what a root load's collection released.

argtypedescription
recordSceneLoadReport?
collectionSceneLoadCollection

phase(record: SceneLoadReport?, name: string, ms: number) → void

Add `ms` to one of the load's phases. Called with the span already measured, so the recorder never holds a clock across other people's work.

argtypedescription
recordSceneLoadReport?
namestring
msnumber

replaced(record: SceneLoadReport?, root: SceneLayerIdentity?, cascaded: { SceneLayerIdentity }?) → void

Record what a load swapped out: the root it replaced, and every additive overlay that went with it.

argtypedescription
recordSceneLoadReport?
rootSceneLayerIdentity?
cascaded{ SceneLayerIdentity }?

declared(guid: string?, entities: number?, components: number?) → void

Record how much the scene file declared, so a load's own account of what it produced can be compared against what it was asked to produce.

argtypedescription
guidstring?
entitiesnumber?
componentsnumber?

componentApplied(guid: string?) → void

Record that a component record landed on its entity.

argtypedescription
guidstring?

entitySpawned(guid: string?) → void

Record that an entity record produced a live entity.

argtypedescription
guidstring?

sameFailure(a: SceneLoadFailure, b: SceneFailureInput) → boolean

Whether two failures are the same thing happening again.

argtypedescription
aSceneLoadFailure
bSceneFailureInput

recordFailure(record: SceneLoadReport, failure: SceneFailureInput) → boolean

Fold a failure into a record: raise the count on the matching entry, else add one while the record has room. Returns true when the record changed.

argtypedescription
recordSceneLoadReport
failureSceneFailureInput

fail(guid: string?, failure: SceneFailureInput) → void

Record a failure against the layer it belongs to. A failure identical to one already held raises that one's count rather than adding another, so a per-frame tick that raises every frame keeps one entry. A `componentUnresolved` / `componentRefused` failure also counts against the load's component tally, so `declared`, `applied` and `failed` describe the same set.

argtypedescription
guidstring?
failureSceneFailureInput

onFailure(cb: ((string) → void

Register the one subscriber called with a scene guid whenever a failure lands on that scene's record. `layers` uses it to keep a layer's own state in step with the record, at load time and long after it.

argtypedescription
cb((string

forgetCost(guid: string?) → void

Drop the cost accounting for a layer that has gone, without recording an unload of its own — for the overlays a root's teardown cascades, which the root's own record already names.

argtypedescription
guidstring?

lastUnload( ) → SceneUnloadReport

The most recent unload's record, or nil on an engine that has unloaded nothing.

unloadHistory( ) → void

Every unload record still in the history, oldest first.

noteUpdate(guid: string?, name: string?, identity: string?, ms: number, err: string?) → void

Record one per-frame entrypoint tick. The only writer that runs every frame: one call per loaded scene whose entrypoint declares `update` or `editorUpdate`, costing the two clock reads its caller already took.

argtypedescription
guidstring?
namestring?
identitystring?
msnumber
errstring?

resetWindow( ) → void

Open a new cost window, discarding what the previous one measured. The load history is untouched.

lastLoad( ) → SceneLoadReport

The most recent load's record, or nil on an engine that has loaded nothing.

history( ) → void

Every load record still in the history, oldest first.

forLayer(guid: string?) → SceneLoadReport

The record of the most recent load of one scene, running or settled.

argtypedescription
guidstring?

costFor(guid: string?) → SceneLayerCost

The cost entry for one layer, or nil when that layer has never ticked.

argtypedescription
guidstring?

window( ) → void

The cost window's own numbers: how long it has been open, and how many loads this engine has run since it started. Every `totalMs` in the observation is a SUM across this window rather than a per-frame figure; `avgMs` is the per-tick cost, which is the per-frame cost for a scene whose tick runs every frame.

nowMs( ) → number

The clock this module reads, in milliseconds — handed out so its writers take their spans off the same clock the durations are stated in.

⌬ Types
SceneLoadFailure = {SceneFailureInput = {SceneLoadPhases = {SceneLoadCollection = {SceneLayerIdentity = {SceneLoadReport = {SceneLayerCost = {SceneUnloadReport = {

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

2items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · assetTypes/scene.assetType/shared.module/observe.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.