Skip to content

state_test/state.h: route cvcstate through file-scope cvc::app; fix valueData<T> ctx - #35

Merged
transfix merged 1 commit into
masterfrom
cvc-singleton/state-test-ctx
May 4, 2026
Merged

transfix merged 1 commit into
masterfrom
cvc-singleton/state-test-ctx

Conversation

@transfix

@transfix transfix commented May 4, 2026

Copy link
Copy Markdown
Owner

Migrates the broad TEST(StateTest, ...) cases off the deprecated cvcstate macro / zero-arg cvc::state::instance() singleton onto a file-scope cvc::app test_ctx plus cvc::state::instance(test_ctx).

Fixture-based tests (StateDataFixture, StateObjectFixture) continue to use their per-test cvc::app ctx member, so each test still gets its own isolated app.

Also fixes state::valueData<T>() in inc/cvc/state.h: it was looking up referenced data nodes through the global zero-arg singleton, which caused StateDataFixture.ValueData to fail once that fixture stopped using the global root. It now routes through the bound _ctx so it shares the per-app state root the parent node belongs to.

Local: 590/590 with -DCVC_USING_XMLRPC=ON and OFF (one rare flaky concurrency test, pre-existing).

…fix valueData<T> to use bound _ctx

Replaces the deprecated cvcstate macro / cvc::state::instance()
zero-arg singleton in the broad TEST(StateTest, ...) cases with a
file-scope cvc::app test_ctx and cvc::state::instance(test_ctx).
Fixture-based tests (StateDataFixture, StateObjectFixture) keep
using their per-test cvc::app ctx member.

Also fixes state::valueData<T>() in inc/cvc/state.h: it was looking
up referenced data nodes through the global zero-arg singleton; it
now routes through the bound _ctx so it shares the same per-app
state root the parent state belongs to.

590/590 with CVC_USING_XMLRPC=ON and OFF locally.
@transfix
transfix merged commit 237be3f into master May 4, 2026
19 checks passed
@transfix
transfix deleted the cvc-singleton/state-test-ctx branch May 4, 2026 20:16
transfix added a commit that referenced this pull request May 4, 2026
…macro (#36)

All production and test callers now route through cvc::state::instance(app&)
(see PRs #30-#35). Remove the deprecated singleton API surface:

  - cvcstate macro (inc/cvc/state.h)
  - cvc::state::instance() zero-arg overload (declaration + definition)
  - cvc::state::instancePtr() zero-arg shim
  - state::_instance static cache and the &ctx == &app::instance()
    cache-write block in instancePtr(app&)

State roots are now exclusively per-app, stored on the app's data map
under "__state". 590/590 with CVC_USING_XMLRPC=ON and OFF locally.
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