Skip to content

feat: sync compact session columns with the cortex registry - #34

Merged
monazhu merged 3 commits into
mainfrom
feat/compact-columns-registry-guard
Aug 12, 2026
Merged

monazhu merged 3 commits into
mainfrom
feat/compact-columns-registry-guard

Conversation

@monazhu

@monazhu monazhu commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Closes DS-1045 — https://linear.app/cognitive3d/issue/DS-1045

Problem

SESSIONS_COMPACT_COLUMNS is a hand-curated list feeding the compact=True default of c3d_sessions(). It is not generated by scripts/sync_schema.py (that covers Polars type mappings only), so it drifts from the cortex registry. Two keys in it were retired upstream — three, once every entry was checked.

Approach

The ticket offered two options: move curation into slicer_fields.yaml and generate the list, or keep the list local and validate it. This PR takes the second.

The registry already publishes what we need — deprecated (consumers should stop reading the key) and sunsetted (no shipping SDK emits it). Adding a compact attribute would instead push one package's presentation choice into a registry shared by dash2, cvr-analyst, melder, and the MCP server, and would need a second attribute to preserve the list's grouping. Validation keeps curation local and still fails loudly on drift.

Changes

  • scripts/sync_schema.py collects the two lifecycle flags across session/event fields and properties, emitting DEPRECATED_KEYS and SUNSETTED_KEYS (23 each) into _schema_generated.py. _schema.py exposes them normalized as DEPRECATED_REGISTRY_COLUMNS / SUNSETTED_REGISTRY_COLUMNS.
  • Dropped from compact output, following the deprecation convention in CLAUDE.md — out of the compact list, DeprecationWarning on use, still present in non-compact output and empty frames:
    • c3d_metrics_standing_percentage — retired compute; c3d_metric_components_posture_standing_percentage replaces it in the list.
    • c3d_metrics_battery_efficiencynot flagged in the ticket; superseded by a drain rate with no single successor key, so it is removed without a replacement column. Callers can compute it from battery_drain_sum and battery_drain_time_millis with compact=False.
  • c3d_metrics_average_fps is unchanged. Melder intends to delete the emission, but the org dashboard tile still reads it and the registry status is deliberately active (decision recorded 2026-07-29). Noted inline so it is not "cleaned up" later.
  • tests/test_compact_columns.py fails when a column resolves to nothing, or resolves to a deprecated/sunsetted key. Nine derived columns — API flags and package-computed fields — are allowlisted with reasons; deliberate retentions go in _LIFECYCLE_EXCEPTIONS, empty today and kept honest by a stale-exception test.

This closes the loop with schema-sync.yml: a cortex registry change regenerates the lifecycle sets onto the PR branch, and the guard test turns red if the curated list no longer agrees.

Verification

  • uv run pytest tests/ -q → 240 passed
  • uv run ruff check src/ tests/ → clean, matching CI scope
  • Guard confirmed non-vacuous: re-adding a deprecated column fails the suite with the intended message

Note for reviewers

Default compact output loses two columns. The data is unchanged and still reachable with compact=False, which is why this is typed feat: rather than a breaking change — the same treatment previous compact-list deprecations got in this repo.

Sibling PR for the R package: CognitiveVR/cognitive3dr#9 (DS-1046).

🤖 Generated with Claude Code

sync_schema.py now collects the `deprecated` and `sunsetted` flags the
registry already publishes (session + event, fields + properties) and
emits them as DEPRECATED_KEYS / SUNSETTED_KEYS frozensets. _schema.py
exposes them normalized as DEPRECATED_REGISTRY_COLUMNS and
SUNSETTED_REGISTRY_COLUMNS.

This gives the package a generated view of registry lifecycle state that
tracks cortex on every schema sync, without moving per-consumer curation
into the shared registry.

Refs DS-1045
SESSIONS_COMPACT_COLUMNS carried two keys the registry marks deprecated:

- c3d.metrics.standing_percentage — retired compute, replaced by
  c3d.metric_components.posture_standing_percentage. New sessions carry
  only the posture_* trio; the same-named StarRocks column is a melder
  compatibility alias, and the ES path has no alias at all. The
  replacement column takes its place in compact output.
- c3d.metrics.battery_efficiency — superseded by a drain rate, which has
  no single successor key. Removed without a replacement column; callers
  who need it can compute it from battery_drain_sum and
  battery_drain_time_millis with compact=False.

Both keep their DEPRECATED_PROPERTIES entries, so they still emit a
DeprecationWarning and remain in non-compact output and empty frames.

c3d.metrics.average_fps stays: melder wants to delete the emission but
the org dashboard tile still reads it, so the registry status is
deliberately active. Noted inline so it is not "cleaned up" by mistake.

Refs DS-1045
Fails CI when a compact column resolves to no known field/property, or
to a key the registry has marked deprecated or sunsetted. Derived
columns (API flags, package-computed fields) are allowlisted with
reasons, and deliberate retentions go in _LIFECYCLE_EXCEPTIONS — empty
today. A stale-exception test keeps that list honest.

Closes the loop with the schema-sync workflow: a cortex registry change
regenerates the lifecycle sets on the PR branch, and this test turns red
if the curated list no longer agrees with it.

Refs DS-1045
@monazhu
monazhu merged commit 055a01d into main Aug 12, 2026
2 checks passed
@monazhu
monazhu deleted the feat/compact-columns-registry-guard branch August 26, 2026 19:20
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