Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
154507b
feat(connection): add catch observer hook for method panics
senamakel Oct 12, 2026
bb79088
feat(connection): notify catch observer on dispatch panic
senamakel Oct 12, 2026
6aba6d9
test(module): harden host test fixtures and attach race
senamakel Oct 12, 2026
81ae954
test(tinybus): cover native attach wait timing and failure
senamakel Oct 12, 2026
309b67d
test(tinybus): harden native attach watchdog and cover stuck preload
senamakel Oct 12, 2026
f7b040f
test(module): cover controlled release on early unwind
senamakel Oct 12, 2026
2a3f3f7
chore: files changed crates/tinybus/src/connection.rs,crates/tinybus/…
senamakel Oct 12, 2026
6ec8a2d
test(tinybus): cover native early unwind and finish gate
senamakel Oct 12, 2026
1250dde
test(tinybus): assert loader poll outcomes instead of panicking in po…
senamakel Oct 12, 2026
13d87e7
test(module): cover release owner surviving canceled waiter
senamakel Oct 12, 2026
6062ba8
test(module): distinguish load failure kinds in attach tests
senamakel Oct 12, 2026
30f9a20
test(transport): hold the vtable fixture lock until physical cleanup
senamakel Oct 12, 2026
de2d530
test(transport): await physical cleanup before releasing fixture lock
senamakel Oct 12, 2026
39036ce
test(transport): defer assertions until after terminal cleanup
senamakel Oct 12, 2026
a7dd63a
Merge remote-tracking branch 'origin/main' into security-bus-7328
senamakel Oct 12, 2026
5a0c17e
test(module): cover host stop drain timeout and cancellation
senamakel Oct 12, 2026
e8098c6
fix(module): drain host callbacks before physical teardown
senamakel Oct 12, 2026
67c0006
test(module): cover host drop during cancelled stop drain
senamakel Oct 12, 2026
15ae3c1
chore: files changed crates/tinybus/src/module/host_callback_lifecycl…
senamakel Oct 12, 2026
aab489a
docs(module): document callback lifecycle validation
senamakel Oct 12, 2026
a358cc8
chore: files changed crates/tinybus/src/module/host_callbacks.rs,crat…
senamakel Oct 12, 2026
ccd70a3
docs(plans): clarify native terminal stop commit points
senamakel Oct 12, 2026
ef89141
Merge remote-tracking branch 'origin/security-bus-7328' into security…
senamakel Oct 12, 2026
b4ea8fa
test(tinybus-module): cover shutdown suppression of captured caller d…
senamakel Oct 12, 2026
b27285f
chore: files changed crates/tinybus-module/src/execution_context_test…
senamakel Oct 12, 2026
acceb53
fix(module): validate start arguments before installing execution owner
senamakel Oct 12, 2026
bfabd2d
test(module): harden shutdown and reload test fixtures
senamakel Oct 12, 2026
5add882
test(module): cover unavailable log storage and document runtime owner
senamakel Oct 12, 2026
09820cb
test(host_reload): use key variable in poison recovery fixture
senamakel Oct 12, 2026
e9737b5
Merge branch 'main' of https://github.com/tinyhumansai/tinybus into s…
senamakel Oct 12, 2026
3f4807e
test(module): cover stop completion with a held denial probe
senamakel Oct 12, 2026
aaada9a
test(module): reorder denial observation after stop and cleanup
senamakel Oct 12, 2026
5fc7575
chore: files changed crates/tinybus/src/module/host_callback_lifecycl…
senamakel Oct 12, 2026
73557c4
feat(module): add terminal runtime hooks and completion types
senamakel Oct 12, 2026
5ee28a3
fix(terminal): latch native liveness closed once it stops being live
senamakel Oct 12, 2026
cfe905b
feat(terminal): add bounded instance admission and cleanup ownership
senamakel Oct 12, 2026
d01d1da
test(terminal): cover permit anchoring and request completion
senamakel Oct 12, 2026
d211fc3
chore: files changed crates/tinybus-module/src/terminal.rs
senamakel Oct 12, 2026
91a96e0
feat(module): add terminal reconfigurable module entry point
senamakel Oct 12, 2026
2bed745
feat(module): add linked terminal factory startup mode
senamakel Oct 12, 2026
a81fcd4
refactor(tinybus-module): split terminal transport ownership from mod…
senamakel Oct 12, 2026
b776e9a
test(module): cover shutdown rechecking native fault after local stop
senamakel Oct 12, 2026
c230af3
fix(module): sample host fault during terminal shutdown
senamakel Oct 12, 2026
bb33a48
chore: files changed crates/tinybus-module/src/lib.rs
senamakel Oct 12, 2026
7b8404d
refactor(module): resolve terminal callbacks through generation tokens
senamakel Oct 12, 2026
545911b
test(tinybus-module): cover linked terminal cancellation and setup pa…
senamakel Oct 12, 2026
aeaefd3
fix(module): retain terminal anchor when a published vtable faults
senamakel Oct 12, 2026
b467d2f
test(module): cover native terminal cancellation and reinit
senamakel Oct 12, 2026
20e918a
test(module): wrap module host in arc for terminal tests
senamakel Oct 12, 2026
1983333
test(tinybus-module): wait for factory drop event in reinit test
senamakel Oct 12, 2026
c96ff68
test(module): verify terminal fixture teardown via drop counter
senamakel Oct 12, 2026
207adfd
test(tinybus-module): track cumulative drop counts across terminal modes
senamakel Oct 12, 2026
1eefc67
feat(tinybus): add early-finish and native query test hooks
senamakel Oct 12, 2026
ba25205
test(tinybus-module): cover rejected native terminal admission
senamakel Oct 12, 2026
ec54077
test(module): qualify terminal flag constants in assertions
senamakel Oct 12, 2026
5c4e51c
feat(module): add reconfigurable terminal module support
senamakel Oct 12, 2026
92b9b33
test(terminal): cover cleanup panic retaining later resource owners
senamakel Oct 12, 2026
858a9f2
fix(terminal): release resource owners one at a time during cleanup
senamakel Oct 12, 2026
3073662
chore: files changed docs/modules/module/README.md,docs/modules/modul…
senamakel Oct 12, 2026
09a4a12
test(module): cover connection teardown after runtime timeout
senamakel Oct 12, 2026
fdbeda1
test(module): cover panicking connection teardown fault fencing
senamakel Oct 12, 2026
02d1f98
fix(module): report panics caught during sdk teardown
senamakel Oct 12, 2026
bcd1bb5
test(module): cover reinit future disposal and fault paths off the lock
senamakel Oct 12, 2026
2224bb7
fix(module): serialize terminal reinitialization with setup retirement
senamakel Oct 12, 2026
022ab8b
test(tinybus-module): drain events before asserting reinit failure
senamakel Oct 12, 2026
2d4667c
refactor(terminal): split execution settlement from setup disposal
senamakel Oct 12, 2026
1d40249
test(module): cover prior reinit future drop during reinitialization
senamakel Oct 12, 2026
a726bb1
test(module): cover terminal delivery caller restoration
senamakel Oct 12, 2026
2823b59
fix(terminal): track disposal failure separately from execution settl…
senamakel Oct 12, 2026
dd3bfda
refactor(module): box terminal setup factory and expand teardown tests
senamakel Oct 12, 2026
931aa36
refactor(tinybus): name terminal example fixture types
senamakel Oct 12, 2026
adc2c9d
test(tinybus-module): wait for inner settlement in terminal drop tests
senamakel Oct 12, 2026
cc10429
test(module): assert config drop runs on the physical worker
senamakel Oct 12, 2026
aab34bb
test(tinybus-module): hold config fixture via weak reference
senamakel Oct 12, 2026
364e324
fix(module): defer reinit config parsing to the worker thread
senamakel Oct 12, 2026
e359a87
style: reformat long lines and expand single-line if/else blocks
senamakel Oct 12, 2026
79bdc75
test(module): cover stop during reinit config parse
senamakel Oct 12, 2026
779e98a
chore: files changed crates/tinybus-module/src/lib_terminal_tests.rs
senamakel Oct 12, 2026
e6bb76d
fix(tinybus-module): enter retained runtime during synchronous reinit
senamakel Oct 12, 2026
b7923e9
test(tinybus-module): assert timer cleanup runs outside a runtime
senamakel Oct 12, 2026
14ec15f
test(module): cover native query flag gating and invalid config rejec…
senamakel Oct 12, 2026
6f63af7
test(terminal): cover worker spawn failure and hook panic paths
senamakel Oct 12, 2026
963072a
test(module): cover linked hook panic and rejected spawn terminal paths
senamakel Oct 12, 2026
aecd95c
test(module): cover linked factory failure config disposal
senamakel Oct 12, 2026
799c1be
test(terminal): cover native fault fencing before blocked payload drop
senamakel Oct 12, 2026
f973d74
test(tinybus-module): drop unused generic from proxy call
senamakel Oct 12, 2026
684aeb8
chore: files changed crates/tinybus-module/src/lib.rs,crates/tinybus-…
senamakel Oct 12, 2026
e4cb25d
test(terminal): assert transport drops on the terminal thread
senamakel Oct 12, 2026
4b2e091
fix(module): retain sdk transport across startup failures
senamakel Oct 12, 2026
96fa5b1
chore: files changed crates/tinybus-module/src/lib_terminal_tests.rs,…
senamakel Oct 12, 2026
e446e11
test(module): add startup failure fixture before transfer
senamakel Oct 12, 2026
54b4690
feat(tinybus): add fault injection modes to terminal example
senamakel Oct 12, 2026
84ceb88
feat(tinybus-module): expose native lifecycle fixture hooks behind a …
senamakel Oct 12, 2026
b57d555
feat(tinybus): add native fixture lifecycle observation to terminal e…
senamakel Oct 12, 2026
32333c4
test(tinybus-module): assert fixture owner liveness events
senamakel Oct 12, 2026
b954b95
feat(module_terminal): seed test controls before factory evaluation
senamakel Oct 12, 2026
690594e
fix(tinybus): read test controls from raw json in terminal example
senamakel Oct 12, 2026
ababe15
chore(examples): remove stray field access in terminal module
senamakel Oct 12, 2026
6262de2
test(module): cover native factory and hook failure paths
senamakel Oct 12, 2026
ca1001f
test(tinybus-module): annotate terminal channel types and panic payload
senamakel Oct 12, 2026
3c0e426
test(tinybus-module): fix event comparison in terminal tests
senamakel Oct 12, 2026
e5fabe5
test(module): cover factory denial after entered init barrier
senamakel Oct 12, 2026
14a2132
chore: files changed crates/tinybus-module/src/lib_terminal_tests.rs,…
senamakel Oct 12, 2026
e9f3710
test(tinybus-module): use closure in stale token probe
senamakel Oct 12, 2026
9504d66
feat(tinybus-module): add fixture hooks for runtime builder failures
senamakel Oct 12, 2026
12f0ec4
refactor(tinybus-module): drop unused native fixture hooks
senamakel Oct 12, 2026
1685c57
test(tinybus-module): use contains for event assertion
senamakel Oct 12, 2026
180d366
test(tinybus-module): wait for terminal entry event before probing st…
senamakel Oct 12, 2026
c8d841a
feat(tinybus-module): expose terminal fixture hooks for resource and …
senamakel Oct 12, 2026
f0bb676
chore: files changed crates/tinybus-module/src/lib_terminal_tests.rs
senamakel Oct 12, 2026
29d29f2
refactor(module): remove fixture-only runtime build failure hook
senamakel Oct 12, 2026
903c678
feat(tinybus): add native reinit and unowned fixture hooks
senamakel Oct 12, 2026
d249e33
test(tinybus-module): cover native terminal shutdown barriers
senamakel Oct 12, 2026
7438870
test(module): cover sdk owner retention across payload and connection…
senamakel Oct 12, 2026
270ed04
chore: files changed crates/tinybus-module/src/lib_terminal_tests.rs,…
senamakel Oct 12, 2026
c6e4de9
test(tinybus-module): cover first foreign cleanup panic keeping later…
senamakel Oct 12, 2026
91b6f43
test(module): assert retained resources after first foreign cleanup p…
senamakel Oct 12, 2026
7ddcefe
test(module): cover prior reinit future drop settlement
senamakel Oct 12, 2026
8ad52bf
test(tinybus-module): assert owner restoration in prior reinit drop
senamakel Oct 12, 2026
5e6beda
chore(examples): observe mode 39 in terminal setup drop
senamakel Oct 12, 2026
52b3ca4
test(tinybus-module): cover terminal callback context and argument va…
senamakel Oct 12, 2026
6241d38
fix(tinybus-module): drop redundant null checks on terminal ctx
senamakel Oct 12, 2026
e17a70b
chore: files changed crates/tinybus-module/src/lib_terminal_tests.rs
senamakel Oct 12, 2026
ff6c00d
feat(module): document terminal setup factory contract
senamakel Oct 12, 2026
a196081
docs(module): clarify uncertain terminal cleanup semantics
senamakel Oct 12, 2026
5aad621
Merge origin/main into security-bus-7328 preserving fixture cleanup
senamakel Oct 12, 2026
7231f0c
Merge branch 'main' into security-bus-7328
senamakel Oct 12, 2026
f4d3ee2
Merge remote-tracking branch 'refs/remotes/upstream/main' into pr/61
senamakel Oct 13, 2026
eb05eac
test: run terminal fixture scenarios in isolated processes
senamakel Oct 13, 2026
9dfaf03
fix(scripts): collect compiled terminal tests before running them
senamakel Oct 13, 2026
3ce209c
fix(scripts): enable tinybus/macros for compiled terminal scenarios
senamakel Oct 13, 2026
1df4c0a
fix(scripts): use cargo llvm-cov test for per-test coverage runs
senamakel Oct 13, 2026
83ea9d7
fix(scripts): drop --no-clean from per-test coverage runs
senamakel Oct 13, 2026
ee42b0c
chore(scripts): move private coverage fixtures under target/private-m…
senamakel Oct 13, 2026
6321d15
test(module): cover fixture calls, terminal ownership, and runtime id…
senamakel Oct 13, 2026
b65f241
test(tinybus-module): wait for worker finish before asserting shutdown
senamakel Oct 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/tinybus-module/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ description = "Module-side runtime and export macro for trusted tinybus cdylibs.

[features]
static-link = []
# Private, off-by-default instrumentation for compiled native lifecycle fixtures.
# Not a production API or a source of native authority.
__native-fixture-support = []

[dependencies]
async-trait.workspace = true
Expand Down
12 changes: 12 additions & 0 deletions crates/tinybus-module/src/execution_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ impl ExecutionOwner {
live,
}
}
#[cfg(feature = "__native-fixture-support")]
pub(super) fn is_current_for_fixture(&self) -> bool {
OWNER.with(|slot| {
slot.borrow()
.as_ref()
.is_some_and(|current| Arc::ptr_eq(&self.live, &current.live))
})
}
#[cfg(feature = "__native-fixture-support")]
pub(super) fn is_stopped_for_fixture(&self) -> bool {
!self.live.load(Ordering::Acquire)
}
pub(super) fn enter(&self) -> ExecutionGuard {
let previous = OWNER.with(|slot| slot.replace(Some(self.clone())));
let dispatch = tracing::dispatcher::set_default(&self.dispatch);
Expand Down
135 changes: 135 additions & 0 deletions crates/tinybus-module/src/execution_context_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,138 @@ fn unowned_and_reentrant_panic_contexts_never_select_a_host_callback() {
assert_eq!(count.load(Ordering::SeqCst), 0);
assert!(owner.panic_location.lock().unwrap().is_none());
}

static CONFIG_DISPATCH: StdMutex<Option<tracing::Dispatch>> = StdMutex::new(None);
struct CapturedConfig;
impl<'de> serde::Deserialize<'de> for CapturedConfig {
fn deserialize<D: serde::Deserializer<'de>>(
deserializer: D,
) -> std::result::Result<Self, D::Error> {
let _ = serde_json::Value::deserialize(deserializer)?;
*CONFIG_DISPATCH.lock().unwrap() = Some(tracing::dispatcher::get_default(Clone::clone));
Ok(Self)
}
}

#[test]
fn shutdown_suppresses_the_exact_factory_and_configuration_caller_dispatch() {
for factory in [true, false] {
let (fixture, count) = owner();
let mut host = fixture.host.0;
host.config = tinybus::module::abi::TbSlice {
ptr: b"{}".as_ptr(),
len: 2,
};
let captured = Arc::new(StdMutex::new(None));
let capture = captured.clone();
let mut module = TbModuleVtable::default();
let started = if factory {
unsafe {
start_reconfigurable_module_with_factory::<serde_json::Value, _, _>(
&host,
&mut module,
1,
false,
move || {
*capture.lock().unwrap() =
Some(tracing::dispatcher::get_default(Clone::clone));
|_, _| async { Ok(()) }
},
)
}
} else {
unsafe {
start_module_with_config::<CapturedConfig, _, _>(
&host,
&mut module,
1,
false,
|_, _| async { Ok(()) },
)
}
};
let dispatch = if factory {
captured.lock().unwrap().take()
} else {
CONFIG_DISPATCH.lock().unwrap().take()
};
let before = count.load(Ordering::SeqCst);
if let Some(dispatch) = &dispatch {
tracing::dispatcher::with_default(dispatch, || {
tracing::info!("captured caller before stop")
});
}
let live = count.load(Ordering::SeqCst);
let stopped = if started == TB_OK {
unsafe { (module.shutdown)(module.module_ctx, 1000) }
} else {
TB_CLOSED
};
let after_shutdown = count.load(Ordering::SeqCst);
let (replacement_fixture, replacement_count) = owner();
let mut replacement_host = replacement_fixture.host.0;
replacement_host.config = host.config;
let mut replacement = TbModuleVtable::default();
let replaced = unsafe {
start_module(&replacement_host, &mut replacement, 1, false, |_| async {
Ok(())
})
};
let replacement_before = replacement_count.load(Ordering::SeqCst);
if let Some(dispatch) = &dispatch {
tracing::dispatcher::with_default(dispatch, || {
tracing::info!("captured caller after actual shutdown")
});
}
let late = count.load(Ordering::SeqCst);
let replacement_after = replacement_count.load(Ordering::SeqCst);
let replacement_stopped = if replaced == TB_OK {
unsafe { (replacement.shutdown)(replacement.module_ctx, 1000) }
} else {
TB_CLOSED
};
eprintln!(
"factory={factory}: start={started}, stop={stopped}, before={before}, live={live}, after_shutdown={after_shutdown}, late={late}, replacement={replacement_before}/{replacement_after}, replacement_stop={replacement_stopped}"
);
assert_eq!(started, TB_OK);
assert!(dispatch.is_some());
assert!(
live > before,
"real caller dispatch forwards before shutdown"
);
assert_eq!(stopped, TB_OK);
assert_eq!(replaced, TB_OK);
assert_eq!(replacement_stopped, TB_OK);
assert_eq!(
late, after_shutdown,
"stopped caller dispatch must not forward"
);
assert_eq!(
replacement_after, replacement_before,
"old dispatch cannot select replacement"
);
}
}

unsafe extern "C" fn tracing_native_query(_: *mut c_void) -> u32 {
tracing::info!("terminal delivery query");
tinybus::module::abi::TB_NATIVE_TERMINAL_LIVE
}
#[test]
fn terminal_deliver_enters_exact_instance_and_restores_nested_caller() {
let (caller, caller_count) = owner();
let (instance, instance_count) = owner();
let host = HostCalls(TbHostVtable {
native_terminal_state: Some(tracing_native_query),
..instance.host.0
});
let state = super::super::terminal::TerminalState::admit(host, Some(instance)).unwrap();
let _outer = caller.enter();
let byte = 0;
let code = unsafe { super::super::terminal_deliver(state.context(), &byte, 1) };
tracing::info!("restored caller");
state.empty_factory_failure();
assert_eq!(code, TB_CLOSED); // No inbound queue was installed.
assert_eq!(instance_count.load(Ordering::SeqCst), 1);
assert_eq!(caller_count.load(Ordering::SeqCst), 1);
}
Loading
Loading