@@ -129,7 +129,7 @@ impl TestCapLocal for LocalImpl {
129129
130130// ── Helpers ──────────────────────────────────────────────────────────
131131
132- // Build a SharedInstanceFactory that always produces a fresh
132+ // Build a SharedInstanceFactory that always produces a new
133133// `Box<SharedImpl>` with the given value. Mimics the builder's
134134// clone-per-consumer output.
135135fn shared_instance_factory ( val : & ' static str ) -> crate :: capability:: SharedInstanceFactory {
@@ -517,11 +517,11 @@ fn test_consumed_tracking_persists_across_nodes_shared() {
517517
518518/// Regression for Option C: each node resolving a `SharedAsLocal`
519519/// binding receives its own clone of the shared extension instance.
520- /// This preserves per-caller-fresh semantics that a shared impl may
521- /// rely on (e.g. per-caller mutable state) — the adapter is not
520+ /// This preserves the per-node instance semantics that a shared impl
521+ /// may rely on (e.g. per-caller mutable state) — the adapter is not
522522/// pre-built once and shared across nodes.
523523#[ test]
524- fn test_shared_as_local_builds_fresh_adapter_per_node ( ) {
524+ fn test_shared_as_local_builds_new_adapter_per_node ( ) {
525525 use std:: sync:: Arc ;
526526 use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
527527
@@ -848,10 +848,10 @@ fn test_end_to_end_local_only_via_bundle() {
848848}
849849
850850#[ test]
851- fn test_end_to_end_shared_fresh_policy_mints_independent_instances ( ) {
852- // With the fresh (factory) policy, the instance factory invokes the
853- // user's closure on each produce(); each consumer should observe
854- // its own instance. Shared+Clone consumers observe
851+ fn test_end_to_end_shared_constructed_policy_mints_independent_instances ( ) {
852+ // With the `.constructed()` (factory) policy, the instance factory
853+ // invokes the user's closure on each produce(); each consumer
854+ // should observe its own instance. Shared+Clone consumers observe
855855 // clone-of-prototype semantics — also independent here since
856856 // SharedImpl has no interior mutability.
857857 use crate :: capability:: ExtensionCapabilities ;
@@ -868,11 +868,11 @@ fn test_end_to_end_shared_fresh_policy_mints_independent_instances() {
868868 ) ) ;
869869 let runtime_config = ExtensionConfig :: new ( "counter" ) ;
870870
871- // FreshImpl : each `start()` increments a shared counter so we can
872- // confirm the factory ran per-consumer.
871+ // ConstructedImpl : each `start()` increments a shared counter so
872+ // we can confirm the factory ran per-consumer.
873873 #[ derive( Clone ) ]
874- struct FreshImpl ( Arc < AtomicUsize > , & ' static str ) ;
875- impl TestCapShared for FreshImpl {
874+ struct ConstructedImpl ( Arc < AtomicUsize > , & ' static str ) ;
875+ impl TestCapShared for ConstructedImpl {
876876 fn value ( & self ) -> & str {
877877 self . 1
878878 }
@@ -883,10 +883,10 @@ fn test_end_to_end_shared_fresh_policy_mints_independent_instances() {
883883
884884 let bundle = ExtensionWrapper :: builder ( name. clone ( ) , user_config, & runtime_config)
885885 . passive ( )
886- . fresh ( )
887- . shared :: < FreshImpl , _ > ( move || {
886+ . constructed ( )
887+ . shared :: < ConstructedImpl , _ > ( move || {
888888 let _ = counter_for_closure. fetch_add ( 1 , Ordering :: SeqCst ) ;
889- FreshImpl ( Arc :: clone ( & counter_for_closure) , "fresh " )
889+ ConstructedImpl ( Arc :: clone ( & counter_for_closure) , "constructed " )
890890 } )
891891 . build ( )
892892 . expect ( "bundle builds" ) ;
@@ -897,7 +897,7 @@ fn test_end_to_end_shared_fresh_policy_mints_independent_instances() {
897897 register_shared : |ext_id, factory, registry| {
898898 registry. register_shared (
899899 TypeId :: of :: < TestCap > ( ) ,
900- TestCap :: shared_entry :: < FreshImpl > ( ext_id, factory) ,
900+ TestCap :: shared_entry :: < ConstructedImpl > ( ext_id, factory) ,
901901 )
902902 } ,
903903 register_local : ExtensionCapabilities :: none ( ) . register_local ,
@@ -925,18 +925,19 @@ fn test_end_to_end_shared_fresh_policy_mints_independent_instances() {
925925 . expect ( "resolve" ) ;
926926
927927 // One claim per resolved Capabilities (one-shot contract). The
928- // `fresh` policy invokes the user's factory on each `produce()`,
929- // so two consumers should observe two factory invocations and no
930- // resolve-time mint (the `SharedAsLocal` fallback is deferred to
931- // the `require_local` call, which is never made here).
928+ // `.constructed()` policy invokes the user's factory on each
929+ // `produce()`, so two consumers should observe two factory
930+ // invocations and no resolve-time mint (the `SharedAsLocal`
931+ // fallback is deferred to the `require_local` call, which is never
932+ // made here).
932933 let s1 = resolved_a. require_shared :: < TestCap > ( ) . unwrap ( ) ;
933934 let s2 = resolved_b. require_shared :: < TestCap > ( ) . unwrap ( ) ;
934- assert_eq ! ( s1. value( ) , "fresh " ) ;
935- assert_eq ! ( s2. value( ) , "fresh " ) ;
935+ assert_eq ! ( s1. value( ) , "constructed " ) ;
936+ assert_eq ! ( s2. value( ) , "constructed " ) ;
936937 assert_eq ! (
937938 counter. load( Ordering :: SeqCst ) ,
938939 2 ,
939- "fresh factory should have been invoked exactly 2x (one per require_shared consumer)"
940+ "constructed factory should have been invoked exactly 2x (one per require_shared consumer)"
940941 ) ;
941942}
942943
0 commit comments