Repository navigation
v1.0.0-pre.3
Pre-release
Pre-release
This release introduces a major overhaul of dependency resolution, including transitive "cascade" unloads, a generic topological sort implementation, and granular failure logging.
Core Architecture Changes
Dependency Graph & Topological Sorting
- Generic Kahn's Sort: Refactored the topological sort into
stk_kahn_sort(). It now acceptshas_depandon_cyclecallbacks, decoupling the core algorithm from thestk_modulesstructure. - Batch Load Ordering:
stk_sort_load_order()now usesstk_batch_has_depto inspect temporary files. This allows simultaneous load events to be processed in dependency-first order without requiring a retry cycle. - Transitive Unloads (Cascade): On
UNLOADevents,stk_poll()now expands the target set viastk_collect_dependents()to include all transitively dependent modules. - Unload Ordering: Added
stk_sort_unload_order()to ensure that dependents are always shut down before their dependencies (reverse topological order).
Module Lifecycle Refactor
- Phased Loading:
stk_module_load()has been decomposed intostk_module_preload(),stk_module_activate(),stk_module_discard(), andstk_validate_dependencies_single(). - Activation Guard: Module
initis no longer called if dependencies are unmet during the validation phase. - Pending Queue Persistence: Modules with unmet dependencies are now added to the pending queue instead of being dropped.
stk_pending_retry()now prunes entries for files that no longer exist and skips already-loaded entries.
Logging & Diagnostics
- Granular Failure Reporting: Replaced vague "unmet dependencies" logs with
stk_log_dependency_failures(). - Error Context: Logs now specify the exact reason for a dependency failure:
not found: Missing dependency ID.requires <constraint>, have <version>: Version mismatch.
- Buffer Configuration: Added
STK_MOD_DEP_LOG_BUFFER(2048) tostk.hto define the failure message buffer size.
Technical Changelog
Added
STK_MOD_DEP_LOG_BUFFERconstant instk.h.stk_kahn_sortgeneric callback-based implementation.stk_log_dependency_failuresfor detailed mismatch reporting.stk_collect_dependentsfor transitive dependency tracking.
Changed
stk_module_loadlogic split into discrete preload, validate, activate, and discard steps.stk_pollevent loop updated to support cascade unloads and improved retry paths.- Kahn sort refactored to eliminate direct coupling to
stk_modules.
Fixed
- Fixed silent deferrals during
stk_init. - Fixed logic error where
stk_pending_retrycould be bypassed in certainstk_pollexit paths.
Full Changelog: v1.0.0-pre.2...v1.0.0-pre.3