Skip to content

state: move the state subsystem from core/ to its own state/ directory (layout refactor Phase 1, + compat shims) - #577

Merged
transfix merged 2 commits into
masterfrom
refactor/state-dir-layout
Oct 7, 2026
Merged

transfix merged 2 commits into
masterfrom
refactor/state-dir-layout

Conversation

@transfix

@transfix transfix commented Oct 7, 2026

Copy link
Copy Markdown
Owner

What

Phase 1 of docs/roadmap/STATE_DIR_LAYOUT_REFACTOR.md, the plan merged in #574. The state subsystem moves out of core/ into its own state/ directory, matching the per-API layout ariadne uses. This is a layout change only: no logic, symbol or ABI changes.

src/cvc/state/            32 .cpp   (was src/cvc/core/state*.cpp + distributed_state_session.cpp)
  state_exec/             16 .cpp   (was src/cvc/core/state_exec/)
inc/cvc/state/            37 .h     (was inc/cvc/core/state*.h + distributed_state_session.h)
  state_exec/             20 .h     (was inc/cvc/core/state_exec/)

core/ now holds only what the plan says stays there: app, async_lane/task, text, thread_pool, world_clock/units, exception, namespace, types and config.h.cmake. volren/state_settings and ariadne's state_io/uri_state do not move.

Includes are now <cvc/state/state.h>, <cvc/state/state_exec/evaluator.h>, etc.

Commits

  1. Move + rename (279 files): git mv for all 105 files (every one registers as a rename, so history is kept), CMake list paths, include rename across libcvc / cvcGL / cvc-cli / tests / pycvc (SWIG + C++), and docs.
  2. Compat shims (62 files): installed forwarding headers for the old paths, plus a test for them, and doc updates.

Details worth a look

  • CMake: three spellings besides the two file lists. The WIN32 list(REMOVE_ITEM … state_transport_ipc.cpp), the CVC_STATE_MEMORY_MANAGER=OFF REMOVE_ITEM, and the gRPC block's state_transport_grpc.cpp all needed new paths. REMOVE_ITEM with a path that matches nothing does nothing and reports nothing, so a stale path would only show up as a Windows link failure or a flag that silently stops working. Also added the missing state_exec/generator.h + utf8.h to INCLUDE_FILES.
  • Include order. .clang-format sorts and regroups includes, and <cvc/state/…> sorts after <cvc/gl/…>, <cvc/lod/…>, etc., so 55 include blocks were re-sorted. In 5 files, the one-character-longer path also broke clang-format's trailing-comment alignment against unchanged neighbouring lines, so those comments were realigned. Note: CI's git clang-format diffs with diff-index, which does not detect renames, so the format check treats all 105 moved files as new and checks them in full.
  • Shims live in compat/inc/cvc/core/, not at the old inc/cvc/core/ paths. This departs from step 6 of the plan. PRs here are squash-merged. With a shim at inc/cvc/core/state.h, the squashed commit would record that path as modified (872 lines → a 5-line forwarder) and inc/cvc/state/state.h as added. Git only pairs renames from deleted paths, so --follow/blame would lose the history of all 57 headers.
    • A separate install(DIRECTORY compat/inc/cvc/ …) rule installs the shims at the same paths (include/cvc/core/state*.h, include/cvc/core/state_exec/), so installed consumers see no difference.
    • compat/inc is not on libcvc's include path, so in-tree code cannot drift back to the old paths before Phase 2 removes them.
    • Trade-off: projects that consume libcvc via add_subdirectory/FetchContent (not an install) don't get the shims.
  • state_compat_headers_test (new) is the only target with compat/inc on its include path. It includes all 57 shims by their old paths, and sizeof-asserts that a type from each area (state tree, distributed, exec) is complete. If a shim's target header moves, this test fails in CI instead of a consumer's build. Phase 2 deletes it along with compat/ and the install rule.
  • Docs: path references updated in the plan's list plus README.md (its project tree gains a state/ entry), USAGE.md, ARIADNE.md and UNICODE_SUPPORT_ROADMAP.md. Fixed pre-existing stale paths (from before core/ existed) in STATE_EXEC_ROADMAP.md and STATE_EXEC_PORTING_PLAN.md. STATE_API.md now names cvc/state/ as canonical. The plan doc is marked Phase 1 implemented and has implementation notes. The release.yml:459 comment is left as is, per the plan.

Verification

Local (this machine has no Boost, gtest or clang-format binary, so there was no full build; the CI matrix is the build/test gate):

  • Every #include <cvc/…> / %include "cvc/…" in the tree resolves to a file, on every #if branch. No new unresolved repo-path references in docs, and 10 stale ones fixed.
  • Every path in src/cvc/CMakeLists.txt resolves. Each moved file appears in the lists the expected number of times, REMOVE_ITEM entries included.
  • check_test_targets.py passes (161 targets).
  • clang-format: emulated CI's git clang-format --diff <base> over all 324 files it will check (moved files in full, since diff-index does no rename detection). It uses the same line ranges and calls clang-format's own sortIncludes + reformat through the system's libclang-cpp 14. All are clean except state/state_telemetry_aggregator.cpp. There, v14 wants to re-break << chains on lines this PR doesn't touch; v18 (CI) already accepted those lines when they last changed in 4487598f.
  • Compat test compiles: the test TU was compiled against the real headers with g++ 11 (-std=c++20 -Wall -Wextra, Boost/gtest stand-ins), including with all 57 shims in reverse order and with task.h's MSVC coroutine branch forced on. No errors and no new warnings. There are no namespace-scope name or macro collisions across the 57 headers.
  • Install layout: the two install(DIRECTORY) rules were run in a throwaway CMake project. #include <cvc/core/state.h> and <cvc/core/state_exec/evaluator.h> against the installed prefix resolve through the shims to the real headers, with nothing unresolved.
  • Squash view (git diff -M origin/master HEAD): all 105 moves show as renames (lowest similarity 94%), and git log --follow inc/cvc/state/state.h reaches pre-move history.

Plan gate still to run (from the PR-1 row): full ctest (all CI lanes), cvcpkg recipe builds (libcvc, cvcgl, cvcgl-examples, pycvc-cp313), the wasm job, and nav_abi_smoke. pycvc wrappers need regenerating, since only the include paths changed.

Rebased on #561, which touched four of the files this PR renames includes in. Its changes are preserved.

Phase 2 (next minor)

Delete compat/, the compat/inc install rule and state_compat_headers_test. Drop the "old paths still compile" note in docs/STATE_API.md, then bump cvc_revision for cvcpkg libcvc and republish.

Phase 1 of docs/roadmap/STATE_DIR_LAYOUT_REFACTOR.md: give cvc::state the same
per-API layout as ariadne. Layout change only -- no logic, symbol or ABI change.

- git mv: src/cvc/core/state*.cpp, distributed_state_session.cpp and
  core/state_exec/ -> src/cvc/state/; the matching 57 headers ->
  inc/cvc/state/. All 105 register as renames (94-100% similarity; 84 also
  carry the include rewrite). core/ keeps app, async_lane/task, text,
  thread_pool, world_clock/units, exception, namespace, types and
  config.h.cmake.
- src/cvc/CMakeLists.txt: path prefixes in INCLUDE_FILES / SOURCE_FILES, plus
  the three other spellings that must move with them -- the WIN32
  REMOVE_ITEM for state_transport_ipc.cpp, the CVC_STATE_MEMORY_MANAGER=OFF
  REMOVE_ITEM, and the gRPC block's state_transport_grpc.cpp (a stale
  REMOVE_ITEM path is a silent no-op). Adds the missing
  state_exec/generator.h + utf8.h to INCLUDE_FILES (list hygiene).
- <cvc/core/state...> -> <cvc/state/state...> and
  <cvc/core/state_exec/...> -> <cvc/state/state_exec/...> across the tree
  (libcvc, cvcGL, cvc-cli, tests, pycvc SWIG + C++). Re-sorts the 55 include
  blocks whose order changes under .clang-format's SortIncludes, and
  realigns trailing comments on include lines in 5 files, where the
  one-character-longer path broke clang-format's alignment.
- Docs: path references updated (incl. README's project tree, which gains a
  state/ entry); pre-existing stale paths in STATE_EXEC_ROADMAP.md and
  STATE_EXEC_PORTING_PLAN.md fixed. release.yml's historical comment kept.
…one release

Step 6 of docs/roadmap/STATE_DIR_LAYOUT_REFACTOR.md: keep out-of-tree code
that includes the old <cvc/core/state*.h>, <cvc/core/distributed_state_session.h>
or <cvc/core/state_exec/*.h> paths compiling for one release cycle.

The 57 shims live in compat/inc/cvc/core/, not at the old inc/cvc/core/ paths,
and a separate install(DIRECTORY) rule ships them to the same installed paths
(include/cvc/core/...), so installed consumers see no difference. Why not the
old source paths: PRs here are squash-merged, and with a shim at
inc/cvc/core/state.h the squashed commit would record that path as modified
and inc/cvc/state/state.h as added. Git only pairs renames from deleted paths,
so --follow and blame would lose all 57 headers' history. It also keeps
compat/inc off libcvc's include path, so in-tree code cannot drift back to the
old spellings before Phase 2 deletes them.

state_compat_headers_test is the one target with compat/inc on its include
path: it includes every shim by its old spelling, so a shim whose target moves
or is renamed fails CI rather than a consumer's build.

Docs: STATE_API.md names cvc/state/ as canonical; the refactor plan is marked
Phase 1 implemented, with implementation notes and the Phase 2 removal list.
@transfix
transfix merged commit c7a0000 into master Oct 7, 2026
14 checks passed
transfix added a commit that referenced this pull request Oct 7, 2026
…r (layout refactor Phase 2)

Phase 2 of docs/roadmap/STATE_DIR_LAYOUT_REFACTOR.md, as a hard cutover. Phase 1
(#577) moved the state subsystem to <cvc/state/...> and added forwarding
headers at the old <cvc/core/state*.h> / <cvc/core/state_exec/*.h> paths;
this removes them before any release ships them, so libcvc 3.5.0 has only
the new layout.

- Delete compat/ (57 forwarding headers), its install(DIRECTORY) rule and
  state_compat_headers_test with its src/cvc/tests/CMakeLists.txt entries.
  Both CMake files are back to their pre-shim content. In-tree code was never
  able to use the old paths, so nothing else changes.
- Source break for out-of-tree code on the old paths (no ABI change): in
  includes, cvc/core/state -> cvc/state/state and
  cvc/core/distributed_state -> cvc/state/distributed_state.
- docs: STATE_API.md says the old paths are gone as of 3.5.0; the refactor
  plan is marked complete (hard cutover) with Phase 2 notes. No cvc_revision
  bump here: the 3.5.0 version bump restarts revisions at 1.
transfix added a commit that referenced this pull request Oct 7, 2026
…r (layout refactor Phase 2)

Phase 2 of docs/roadmap/STATE_DIR_LAYOUT_REFACTOR.md, as a hard cutover. Phase 1
(#577) moved the state subsystem to <cvc/state/...> and added forwarding
headers at the old <cvc/core/state*.h> / <cvc/core/state_exec/*.h> paths;
this removes them before any release ships them, so libcvc 3.5.0 has only
the new layout.

- Delete compat/ (57 forwarding headers), its install(DIRECTORY) rule and
  state_compat_headers_test with its src/cvc/tests/CMakeLists.txt entries.
  Both CMake files are back to their pre-shim content. In-tree code was never
  able to use the old paths, so nothing else changes.
- Source break for out-of-tree code on the old paths (no ABI change): in
  includes, cvc/core/state -> cvc/state/state and
  cvc/core/distributed_state -> cvc/state/distributed_state.
- docs: STATE_API.md says the old paths are gone as of 3.5.0; the refactor
  plan is marked complete (hard cutover) with Phase 2 notes. No cvc_revision
  bump here: the 3.5.0 version bump restarts revisions at 1.
transfix added a commit that referenced this pull request Oct 7, 2026
…r (layout refactor Phase 2) (#578)

Phase 2 of docs/roadmap/STATE_DIR_LAYOUT_REFACTOR.md, as a hard cutover. Phase 1
(#577) moved the state subsystem to <cvc/state/...> and added forwarding
headers at the old <cvc/core/state*.h> / <cvc/core/state_exec/*.h> paths;
this removes them before any release ships them, so libcvc 3.5.0 has only
the new layout.

- Delete compat/ (57 forwarding headers), its install(DIRECTORY) rule and
  state_compat_headers_test with its src/cvc/tests/CMakeLists.txt entries.
  Both CMake files are back to their pre-shim content. In-tree code was never
  able to use the old paths, so nothing else changes.
- Source break for out-of-tree code on the old paths (no ABI change): in
  includes, cvc/core/state -> cvc/state/state and
  cvc/core/distributed_state -> cvc/state/distributed_state.
- docs: STATE_API.md says the old paths are gone as of 3.5.0; the refactor
  plan is marked complete (hard cutover) with Phase 2 notes. No cvc_revision
  bump here: the 3.5.0 version bump restarts revisions at 1.
transfix added a commit that referenced this pull request Oct 7, 2026
New minor version carrying the state subsystem's move from cvc/core/ to
cvc/state/ (#577) as a hard cutover (#578): <cvc/core/state*.h>,
<cvc/core/distributed_state_session.h> and <cvc/core/state_exec/*.h> are gone,
a source break (no ABI change) that warrants the minor. Bumps project(VERSION)
3.4.0 -> 3.5.0 and every cvcpkg recipe's upstream_version to match
(cvc_revision reset to 1, per the recipe-version gate).
@transfix
transfix deleted the refactor/state-dir-layout branch October 8, 2026 18:44
transfix added a commit to transfix/volrover that referenced this pull request Oct 9, 2026
…3.5.0)

libcvc 3.5.0 moved the state subsystem out of cvc/core/ into cvc/state/ as a
hard cutover (transfix/libcvc#577, #578): <cvc/core/state*.h> and
<cvc/core/state_exec/*.h> no longer exist, and volrover3 consumes libcvc as an
unpinned external SDK, so it cannot compile against 3.5.0 without this.

Rewrites the 41 includes in 25 files (cvc/core/state -> cvc/state/state).
Path change only; volrover has no .clang-format, so includes stay in place.
transfix added a commit to transfix/volrover that referenced this pull request Oct 9, 2026
…3.5.0) (#48)

libcvc 3.5.0 moved the state subsystem out of cvc/core/ into cvc/state/ as a
hard cutover (transfix/libcvc#577, #578): <cvc/core/state*.h> and
<cvc/core/state_exec/*.h> no longer exist, and volrover3 consumes libcvc as an
unpinned external SDK, so it cannot compile against 3.5.0 without this.

Rewrites the 41 includes in 25 files (cvc/core/state -> cvc/state/state).
Path change only; volrover has no .clang-format, so includes stay in place.
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