LearnNewsExamplesServices
Frontmatter
id6963
titleAdd test case for circular dependencies in batched set() operations
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 6, 2025, 7:02 PM
updatedAtJul 6, 2025, 7:03 PM
githubUrlhttps://github.com/neomjs/neo/issues/6963
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 6, 2025, 7:03 PM

Add test case for circular dependencies in batched set() operations

Closed v10.0.0-beta.5 enhancement
tobiu
tobiu commented on Jul 6, 2025, 7:02 PM

Description

To verify the fixes for the regressions introduced in the v10 core.Config system, a new test case has been added: test/siesta/tests/config/CircularDependencies.mjs.

This test specifically targets the atomicity of core.Base#set() and ensures that all config hooks and field setters have a consistent, updated view of the instance's state during a batched update.

What the Test Verifies

The test creates a TestComponent with multiple reactive configs, a non-reactive config, a public class field, and a public field with a custom setter (customProp).

It then calls instance.set() with new values for all of these properties simultaneously and asserts the following:

  1. afterSet<Config>() Hooks: Each afterSet hook correctly sees the new values of all other configs and fields that were part of the same set() call.
  2. Custom Field Setters: The custom setter for customProp also correctly sees the new values of all reactive configs and public fields from the same batch.
  3. Partial Updates: It verifies that when only a single config is updated, the other properties on the instance retain their previous values.

Benefit

This test provides a critical safety net to prevent future regressions in the complex config initialization logic. It ensures that the set() method behaves as a predictable, atomic operation, which is fundamental to the framework's reactivity model.

tobiu assigned to @tobiu on Jul 6, 2025, 7:02 PM
tobiu added the enhancement label on Jul 6, 2025, 7:02 PM
tobiu referenced in commit c3bcf7c - "Add test case for circular dependencies in batched set() operations #6963" on Jul 6, 2025, 7:03 PM
tobiu closed this issue on Jul 6, 2025, 7:03 PM