Skip to content

nav: CoPH's records and stage ledger (C1) - #1210

Merged
transfix merged 3 commits into
masterfrom
nav/coph-c1
Nov 15, 2026
Merged

transfix merged 3 commits into
masterfrom
nav/coph-c1

Conversation

@transfix

Copy link
Copy Markdown
Owner

This is C1 of docs/roadmap/NAV-COPH-ROADMAP.md. It starts the C++ twin of GRL-SNAM's grl_snam.coph (CoPH-Stagewise, vendored at c1f1ff3) with the configuration records and the stage ledger. It is additive and default-off: two new headers, two new TUs and one test. Nothing existing calls them yet.

What lands

inc/cvc/nav/coph_config.h

  • coph_config and coph_communication_config: every field of Config and CommunicationConfig, with Python's defaults. The modes are strings, as in Python, so a mode Python refuses is refused here with Python's message.
  • validate() is __post_init__: the same refusals, the same messages, the same order. It fills replay_update_cap the same way, and leaves the config unchanged when it throws. It mirrors Python's min(), so a NaN dt, stage width, sensor radius or safety margin passes, as it does upstream. That was checked against Python, and a test pins it.
  • The profile (D7):
    • outside_profile() names the mode fields that differ from the demos' profile;
    • require_profile() throws on them;
    • coph_profile() and coph_communication_profile() are the demos' configurations.

inc/cvc/nav/coph_ledger.h, built with -ffp-contract=off (/fp:precise on MSVC):

  • The records:
    • coph_shape, a disk or a slab, with reach();
    • coph_reading, coph_transition, coph_footprint and coph_observation;
    • coph_stage: new_stage and contains;
    • coph_intersects.
  • coph_ledger keeps the current stage and the previous cfg.previous, with observe, advance and set_geometry. Its constructor validates and refuses configurations outside the profile.
  • The geometry store (observe_geometry, refresh_geometry) belongs to the navigation layer, which hands it to set_geometry.

A correction to the roadmap

The demos' learner is crossing_demo.CrossingLearner, a maze_learning.MazeLearner. Its stage rule is not learner.Learner.advance's, which is what §1 and §4.1 described:

  • The axis. It advances along whichever axis left the inner box, by size × (1 − overlap), in either direction. So y steps are 2.8 m.
  • Readings and footprints. A new stage pools them from every kept stage: each reading uid once, at its first place, and each footprint once.
  • No anchors. It never sets Stage.anchors. _field_fit's overlap continuity rows read those anchors, so the rows are always empty in the demos. coph_stage has no anchors, and there are no overlap rows to build.

The ledger implements the demos' rule, which the golden pins. The roadmap's §1 table, §4.1, §4.3's field fit and the G4 row now say so.

The golden

src/cvc/tests/data/coph_golden.json is written by GRL-SNAM (python -m grl_snam.tools.coph_golden --out DIR, CVC-Lab/GRL-SNAM#168). It is the same git blob as GRL-SNAM's tests/fixtures/coph_golden/coph_golden.json (c5b3e4dc). Every double is its raw bits.

nav_coph_test reproduces it bit for bit.

  • G1:

    • all 74 Config and 5 CommunicationConfig cases, giving acceptance, Python's message, and every field's value after validation (checked against Python's field list);
    • the fields outside the profile, and that the ledger refuses exactly those cases.
  • G4: every tick of the 360-tick script under its three configurations (the profile; small caps with previous 3; previous 0 with no overlap). It checks:

    • each advance and its axis;
    • each new stage's centre, entry, target, RBF centres, weights and version;
    • each kept stage's readings, transitions, footprints and obstacles.

    The path advances along both axes in both directions. The profile's reading and footprint caps fill, and in the small-caps variant every cap fills.

  • C++ only:

    • upstream's NaN behaviour;
    • require_profile's message;
    • the ledger's refusals;
    • an observation with no sensor centre;
    • a uid held by two kept stages: its first place, last reading, as Python's dict does.

Checks

  • Local, Windows (MSVC 19.44, Release, deps from the local cvcpkg prefix): nav_coph_test passes, 12 tests.
  • clang-format 18 (CI's version, from cvcpkg) is clean on the new files.
  • Linux and macOS are CI's to check. Their -ffp-contract=off matters on aarch64, the same as for the belief kernels.

Next

  • C2: the plant, potential, command and energy, with G2, G3 and G11. Those need GRL-SNAM's golden to grow those cases first (T5's next step).
  • pycvc bindings come in C6, as the roadmap orders.

C1 of docs/roadmap/NAV-COPH-ROADMAP.md: the C++ twin of GRL-SNAM's
grl_snam.coph (CoPH-Stagewise, vendored at c1f1ff3), up to the stage ledger.

inc/cvc/nav/coph_config.h:
- coph_config and coph_communication_config: every field of Config and
  CommunicationConfig, with Python's defaults; modes are strings, as in
  Python. validate() is __post_init__: the same refusals with the same
  messages, in the same order, and it fills replay_update_cap the same way.
  Python's min() is mirrored, so NaN scales pass where upstream's do.
- outside_profile() and require_profile(): the mode fields that differ from
  the demos' profile, which the twin refuses (D7). coph_profile() and
  coph_communication_profile() are the demos' configurations.

inc/cvc/nav/coph_ledger.h (built with -ffp-contract=off):
- coph_shape (disk or slab), coph_reading, coph_transition, coph_footprint,
  coph_observation, coph_stage (new_stage, contains) and coph_intersects.
- coph_ledger: the current stage and the previous cfg.previous, with observe,
  advance and set_geometry. The geometry store comes from the navigation
  layer.

The demos' learner is crossing_demo.CrossingLearner, a MazeLearner, and its
rule is not Learner.advance's, which the roadmap first described. It advances
along whichever axis left the inner box, in either direction (y steps are
2.8 m), pools the readings and footprints of every kept stage, and never sets
Stage.anchors, so _field_fit's overlap continuity rows are always empty in
the demos. The ledger implements that rule; the roadmap's §1, §4.1, §4.3 and
G4 now say so.

The golden is written by GRL-SNAM (grl_snam.tools.coph_golden,
CVC-Lab/GRL-SNAM#168) and committed in src/cvc/tests/data, the same blob as
GRL-SNAM's tests/fixtures copy. nav_coph_test reproduces it bit for bit:
- G1: all 74 Config and 5 CommunicationConfig cases (acceptance, Python's
  message, every value, the fields outside the profile, and that the ledger
  refuses those);
- G4: every tick of the 360-tick script under its three configurations:
  each advance and its axis, each new stage's fixed fields, and each kept
  stage's readings, transitions, footprints and obstacles.
C++-only tests cover upstream's NaN behaviour, require_profile's message, a
sensor-less observation and a repeated uid across stages.
The function-local static in coph_profile_modes() is process-wide state, which libcvc does not keep; package-linux's singleton scan refused it.
@transfix
transfix disabled auto-merge November 14, 2026 21:24
@transfix
transfix enabled auto-merge (squash) November 14, 2026 21:24
@transfix
transfix merged commit 5b5b3bf into master Nov 15, 2026
49 of 50 checks passed
@transfix
transfix deleted the nav/coph-c1 branch November 15, 2026 15:49
transfix added a commit that referenced this pull request Nov 15, 2026
Conflicts: the roadmap, coph_golden.json and both CMakeLists.txt; each takes C2's side, which already held C1's lines. The diff from master is C2's own.
transfix added a commit that referenced this pull request Nov 16, 2026
…#1253, #1255, #1256, #1264, #1268, #1271, #1273, #1277)

- ci.yml: the sanitizer list keeps this branch's tests (stream_test, net_ws_client_test,
  ariadne_host_test) and master's segmentation_intrinsics_test.
- STATE_EXEC_THREADED.md: the room-call verbs (room-run is #1273's) and #1252's segment.seeded
  provider in the provider table, both registered without a kind. room-call's async functions
  stay on the app's host: a reply settles on the relay client's reader thread through
  host.finish, so moving them to *ictx.host needs a finisher first.
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