Skip to content

core openusdconnect package code maintainability improvements - #43

Merged
RoboticHuman merged 22 commits into
masterfrom
core-maintainability
Sep 23, 2026
Merged

RoboticHuman merged 22 commits into
masterfrom
core-maintainability

Conversation

@RoboticHuman

@RoboticHuman RoboticHuman commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Improve readability and maintainability of the core openusdconnect package by consolidating shared code and making the flow from authored USD changes to network events, replay, and persistence easier to follow.

  • Simplify authored-opinion capture: unify camera and generic attribute handling, share property-source lookup and cache seeding, and make prim processing and Sdf field selection explicit.
  • Replace indirect projection dispatch and dense conditions with ordered calls, standalone readers, and named values. Simplify asset dependency refresh and share logical-layer routing between live replay and previous-stage updates.
  • Consolidate connection cleanup, recovery deadlines, shared-stage application, and token propagation. Keep sender and receiver credentials synchronized before persistence or application callbacks run.
  • Use one authoritative client-layer assignment map and share transaction preparation, persistence, and rollback. Clarify VFS snapshot replacement and rebuild scene caches consistently when replay history changes.
  • Decode receive records and playback controls directly from FlatBuffers, avoiding intermediate dictionaries while preserving dictionary-facing APIs and zero-copy geometry arrays. Reuse resolved tables for handshake and replay control messages.
  • Validate event data and transaction restrictions at admission, then rely on those guarantees internally. Remove repeated checks and rollback handlers, and narrow USD exception handling so unexpected internal errors remain visible.

The PR also fixes property edits lost during prim resyncs, sample caches seeded from the wrong authored opinions, prepared edits restored against stale layer topology, stale credentials reused on reconnect, and failed single-record SQLite appends that did not roll back.

Rescan authored Sdf fields when a prim resync absorbs property
notices from the same change block.

Cover combined clears, value blocks, sample updates and removals.
Verify exact layer contents after inactive variant removal.
Route camera values through generic attribute capture and remove
the separate camera channel and cache.

Use one property-source map and make per-prim processing and Sdf
field selection explicit. Reuse attribute handles and skip unchanged
transform reads during unrelated property edits.

Cover camera defaults, samples, clears and variant edit targets.
Replace string-based projection dispatch with direct ordered calls.
Extract stage readers into functions and remove fabricated
projection objects used to read previous state.

Preserve event-kind coverage checks and projection ordering.
Use one ordered routing path for live replay and previous-stage
updates. Validate routes before applying events and restore edit
targets and layer muting after success or failure.

Clarify stage session-state naming and cover routing failure cases.
Use client layer keys as the authoritative assignment map and
derive client_layers snapshots from the collaboration layer stack.

Remove redundant layer and department maps and clarify how
merge and delete release shared department assignments.
Share preparation, persistence and rollback across single and
grouped commits. Reuse prepared records for single transactions
and publish producer progress once after persistence succeeds.

Remove the redundant commit-lock alias, clarify transform cache
semantics, and verify failed groups can retry without duplicates.
Use shared deadline and remaining-time helpers consistently
across managed and shared-stage client connection and recovery.
Share replay counters and scene-cache rebuilding across compaction,
purge and snapshot replacement. Invalidate the composed prim count
when authored collaboration layers are cleared.

Add regression coverage for a cached prim count surviving purge.
Separate snapshot validation and temporary replacement preparation
from persistence, installation and publication. Consolidate rejection
reporting while preserving validation order and the exclusive barrier.
Share prepared-batch routing and restoration between Python and native
trackers. Recheck layer reachability after preceding batches attach or
detach sublayers so frozen edits target the current layer stack.

Cover tracker parity, frozen topology revisions and copied events.
Match dependencies once and carry refreshed dependencies alongside
their source events and replay operations. Preserve mapped edit targets,
payload load state and rollback across affected layers.

Verify a failed refresh restores every layer and can be retried.
Use one layer-content application path for immediate and deferred
records, retaining batching and updating tracker state after success.
Reuse recovery assessment construction from preserved source layers.

Cover failed application, unchanged tracker state and successful retry.
Give each connection attempt one cleanup boundary until its socket
is published. Keep cancellation checks, ownership transfer and outbox
replay ordering explicit under the existing locks.
Reuse the Hello decoder with an already-resolved FlatBuffers table
and preserve optional replay identity without reading the envelope
twice. Share admission responses and transaction rejection conversion.

Keep the payload-type guard before decoding and cover direct Hello
decoding alongside rejection of non-Hello first frames.
Group events whose builders already establish edit-target ownership
and construct prim-definition events once after the definition and
schema decisions. Retain filtering for composed values and samples.
Reuse mapped edit-target sample reads and matching value conversions
when seeding caches. Avoid retaining sample payloads during seeding
while preserving structural events on first encounter.

Cover masked layer and variant edits, matrix values, asset paths and
instancer orientations.
Centralize token precedence in the shared connection helper and remove
the shared-stage override. Prefer the current receiver token before
existing sender credentials or optional persisted credentials.

Cover managed synchronous and background reconnect after token
revocation, along with credential fallback behavior.
Use the SQLite connection context to commit or roll back while holding
the store lock. Retain the direct insert path and skip empty producer
progress updates in batch writes.

Verify a failed insert leaves subsequent single and batch writes usable
and that records and producer progress survive reopening the store.
Share tokens issued to either connection before persistence or
application callbacks run. Limit reconnect preparation to filling
missing credentials so stale tokens cannot overwrite replacements.

Cover both reconnect orders, synchronous and background reconnects,
callback failures, and token issuance during credential loading.
Share authored-default lookup and token propagation, and make dependency
selection and composed-state conditions explicit. Decode receive records
and playback controls directly from FlatBuffers while retaining public
dictionary APIs and zero-copy geometry arrays.

Cover typed playback defaults, zero-copy decoding, and shared replay
sequence handling.
Enforce transaction-wide restrictions at admission and trust validated
fields during commit. Consolidate managed sequence rollback and remove
the duplicate reservation rollback in idempotent processing.

Catch USD errors specifically in validation and projection recovery so
unexpected internal exceptions propagate. Cover early rejection, error
classification, and successful USD recovery.
@RoboticHuman
RoboticHuman merged commit 0469c40 into master Sep 23, 2026
1 check passed
@RoboticHuman
RoboticHuman deleted the core-maintainability branch September 23, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant