-
Notifications
You must be signed in to change notification settings - Fork 0
Collapse nested application-owned sharing beneath PreparedApp #648
Copy link
Copy link
Open
Labels
concurrencyConcurrency, parallelism, and synchronization work, including races and deadlocks.Concurrency, parallelism, and synchronization work, including races and deadlocks.enhancementNew feature or requestNew feature or requestlowBacklog work, hygiene, or technical debt planned opportunistically, without a strict deadline.Backlog work, hygiene, or technical debt planned opportunistically, without a strict deadline.mediumRoadmap items to schedule within the current quarter. Clear scope, normal review cycles.Roadmap items to schedule within the current quarter. Clear scope, normal review cycles.performancerefactorBehaviour-preserving restructuring that improves code health.Behaviour-preserving restructuring that improves code health.testingTest coverage, test infrastructure, and verification tooling work.Test coverage, test infrastructure, and verification tooling work.
Description
Activity
Metadata
Metadata
Assignees
Labels
concurrencyConcurrency, parallelism, and synchronization work, including races and deadlocks.Concurrency, parallelism, and synchronization work, including races and deadlocks.enhancementNew feature or requestNew feature or requestlowBacklog work, hygiene, or technical debt planned opportunistically, without a strict deadline.Backlog work, hygiene, or technical debt planned opportunistically, without a strict deadline.mediumRoadmap items to schedule within the current quarter. Clear scope, normal review cycles.Roadmap items to schedule within the current quarter. Clear scope, normal review cycles.performancerefactorBehaviour-preserving restructuring that improves code health.Behaviour-preserving restructuring that improves code health.testingTest coverage, test infrastructure, and verification tooling work.Test coverage, test infrastructure, and verification tooling work.
Summary
Once
PreparedAppis the deliberate shared root, remove innerArclayers for application-owned values that cannot escape with an independent lifetime.This is a follow-up to #641, #642, and #643. It should land only after the prepared-application and connection-runtime boundaries make each value's lifetime explicit.
Problem
WireframeAppcurrently stores several values behindArcbecause connections may use them concurrently:Concurrency alone does not require each child value to own a separate reference count when one
Arc<PreparedApp>already keeps the entire immutable object graph alive.Some children may still need independent ownership:
Arc;The task is therefore semantic classification, not mechanical replacement.
Scope
Lifecycle callbacks
Store setup and teardown callback definitions directly or behind
Box<dyn ... + Send + Sync>insidePreparedAppwhen they are only borrowed during one connection lifecycle.Do not clone callback owners per connection. The connection runtime should borrow the callback through its
Arc<PreparedApp>root and own only the produced stateC.Message assembler
If the assembler is immutable and only called through
&self, store it directly behindBox<dyn MessageAssembler>inPreparedAppand borrow&dyn MessageAssemblerfrom connection runtimes.Review the public
message_assembler()accessor tracked by #598. Choose and document one disposition:Option<&dyn MessageAssembler>in a semver-appropriate release;Arcownership only if downstream code genuinely needs to clone the assembler out of the app.Protocol definition
Coordinate with #644. Do not independently redesign protocol ownership here. The final graph should have no more protocol strong references than the accepted #644 representation requires.
Routes and handlers
Ensure the prepared route table is owned directly by
PreparedApp, as required by #641.Move handler ownership from the consumed builder into prepared services without an avoidable clone. Retain an
Arc<Handler>only where the public handler value may have legitimate owners outside Wireframe or where middleware/service representation requires independent cloning.Application data
Do not remove the per-value
Arccontract fromAppDataStorein this issue.SharedState<T>intentionally returns an owned handle that may outlive request extraction scope. Review map-level sharing separately only if benchmarks show repeated map cloning or contention.Acceptance criteria
Arcfield underPreparedApphas a documented independent-lifetime justification or is replaced by direct/boxed ownership.AppDataStoreshared-value semantics remain intact.PreparedApproot drops.Tests
Non-goals
AppDataStore,PushHandle, Tokio channels, or semaphores.Dependencies
References
src/app/builder/core.rssrc/app/builder/lifecycle.rssrc/app/builder/protocol.rssrc/app_data_store.rs