Skip to content

Allow callback-bound modules to take non-callback config updates - #119

Open
sx4im wants to merge 1 commit into
tinyhumansai:mainfrom
sx4im:fix-8725-tinybus-scoped-callback-config
Open

sx4im wants to merge 1 commit into
tinyhumansai:mainfrom
sx4im:fix-8725-tinybus-scoped-callback-config

Conversation

@sx4im

@sx4im sx4im commented Nov 14, 2026 •

Copy link
Copy Markdown

A callback-bound module's whole configuration is frozen for reinitialization, so any config change after load is refused with "scoped callback configuration is immutable" until the host restarts. That blocks tinyhumansai/openhuman#8725, where TinyComputer's browser, captcha and route settings change after load in security-module builds.

This adds HostCallbackBinding::with_frozen_config_keys, which narrows the freeze to the declared callback-bearing keys (such as the callback destination). Everything else in the config may change on reinitialize. With no keys declared the whole blob stays frozen, exactly as before. The stored fingerprint is still a SHA-256 hash, only key names are retained, and dropping a frozen key counts as a change.

Verified: new unit test for the scoped fingerprint, plus a cdylib test mirroring the existing immutability test (non-callback changes accepted, frozen-key change and removal refused). cargo fmt, clippy --all-targets --all-features -D warnings, and the module::host test module (105 passed) are clean. Full suite verdict is CI.

Summary by CodeRabbit

  • New Features
    • Callback-enabled modules can now specify which top-level configuration settings must remain unchanged during reinitialization. Changes to other settings, such as credentials, are allowed.
    • When no settings are specified, the existing behavior remains: the entire configuration must match. Changes to a specified setting—including removing it—are rejected.

A callback-bound module's whole configuration was frozen for
reinitialization, so any config change after load was refused until the
host restarted. HostCallbackBinding::with_frozen_config_keys narrows the
freeze to the declared callback-bearing keys (such as the callback
destination); every other key may change on reinitialize. With no keys
declared the whole blob stays frozen, as before. The stored fingerprint
is still a SHA-256 hash, only key names are retained, and dropping a
frozen key counts as a change.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Bindings can declare top-level configuration keys to freeze during reinitialization. Loading and reinitialization fingerprint those keys instead of the full configuration. An empty key list retains whole-configuration fingerprinting.

Changes: Scoped callback configuration

Layer / File(s) Summary
Declare keys and calculate fingerprints
crates/tinybus/src/module/host.rs, crates/tinybus/src/module/host_callbacks.rs, crates/tinybus/src/module/host_callbacks_tests.rs
HostCallbackBinding gains with_frozen_config_keys. Loading fingerprints the declared top-level keys and stores them with the loaded module. Tests cover declared keys, undeclared values, and the empty-list behavior.
Compare scoped fingerprints on reinitialization
crates/tinybus/src/module/host.rs, crates/tinybus/src/module/host_tests.rs
Reinitialization compares a fingerprint of the declared keys with the stored callback fingerprint. The integration test checks accepted and rejected configuration changes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Binding as HostCallbackBinding
  participant Loader as Module loader
  participant Loaded as LoadedModule
  participant Reinit as Reinitialization
  Binding->>Loader: Provide frozen configuration keys
  Loader->>Loader: Fingerprint selected configuration
  Loader->>Loaded: Store fingerprint and frozen keys
  Reinit->>Loaded: Read stored fingerprint and keys
  Reinit->>Reinit: Compare fingerprint for new configuration
Loading

Suggested reviewers: senamakel

Merge Risk: Minimal · up to ceee0

This change lets callback-bound modules accept configuration updates outside the declared frozen keys on reinitialize. When no keys are declared, the whole configuration stays frozen as before. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Allow callback-bound modules to take non-callback config updates" matches the main change. The PR adds HostCallbackBinding::with_frozen_config_keys so reinitialization freezes only declared…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Allow callback-bound modules to take non-callback config updates" matches the main change. The PR adds HostCallbackBinding::with_frozen_config_keys so reinitialization freezes only declared callback-bearing config keys, letting other configuration change. The title is specific and concise, and it describes the primary behavior change from the developer's perspective.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the keys in rows,
And picks the fields the callback knows.
The rest may change from day to day,
While frozen fields must stay their way.
The fingerprints keep watch in tune,
Beneath the quiet moon.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1fb8dae-83fd-4bb8-a542-f7aedbe9af9e
Commits

Reviewing files that changed from the base of the PR and between 1a4a2b1 and ceee034.

Files selected for processing: 4

  • crates/tinybus/src/module/host.rs
  • crates/tinybus/src/module/host_callbacks.rs
  • crates/tinybus/src/module/host_callbacks_tests.rs
  • crates/tinybus/src/module/host_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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