Skip to content

Fill missing config keys from packaged defaults on offline replay - #34

Merged
williamshen-nz merged 2 commits into
mainfrom
config-fill-missing
Jul 30, 2026
Merged

williamshen-nz merged 2 commits into
mainfrom
config-fill-missing

Conversation

@williamshen-nz

Copy link
Copy Markdown
Collaborator

Summary

Splits the config fill_missing work out of #30 into its own PR (no experimental / near-placement changes).

recording.py snapshots tiptop.yml into each run directory, and tiptop-offline reloads that snapshot to reproduce a run. set_tiptop_cfg_from_file did a bare OmegaConf.load, so any snapshot predating a later config key crashed on attribute access — e.g. perception.m2t2.apply_bounds (added in #27) is read at perception_wrapper.py but absent from older recordings.

Changes

  • config/__init__.py — merge packaged defaults under the loaded config so omitted keys resolve. Missing keys raise by default (a live, editable config should be fixed, not silently patched); callers opt into filling via fill_missing=True.
  • tiptop_offline.py — replay opts in with fill_missing=True, since recorded configs can't be updated after the fact (and warns when it fills).
  • tests/test_config.py + test-unit pixi task — unit coverage for the raise/fill/keep-user-values behavior. Added a task because test-integration filters on -m integration and wouldn't collect these.

Notes

  • Uses perception.m2t2.apply_bounds / perception.depth_trunc_m / the cameras section as the missing-key fixtures, so the tests stand alone on main without the experimental config block.
  • pixi run test-unit → 8 passed.

recording.py snapshots tiptop.yml into each run directory, and
tiptop-offline reloads that snapshot to reproduce the run. Because
set_tiptop_cfg_from_file did a bare OmegaConf.load, any snapshot
predating a later config key crashed on attribute access, e.g. when
perception.m2t2.apply_bounds (added in #27) is missing from an older
recording but read at perception_wrapper.py.

Merge the packaged defaults under the loaded config so omitted keys
resolve instead of raising. Recorded configs cannot be updated after the
fact, so tiptop-offline opts in via fill_missing; every other caller
raises, since a live config the user can edit should be fixed rather
than silently patched.

Adds tests/test_config.py and a test-unit pixi task, as test-integration
filters on -m integration and would not collect them.

Split out from #30.
- Assert the whole restored section matches defaults, not just one leaf.
- Cover the case where a recording carries a key since dropped from the
  defaults: extra keys are kept and don't raise, since only missing keys
  are an error.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves offline replay robustness by allowing recorded tiptop.yml snapshots that predate newer config keys to be replayed without crashing, while still preserving strictness for normal (editable) configs.

Changes:

  • Add fill_missing support to set_tiptop_cfg_from_file() by merging the loaded config over packaged defaults and raising by default if keys are missing.
  • Update offline replay (tiptop-offline) to opt into fill_missing=True when restoring tiptop.yml from a run directory.
  • Add unit tests covering raise/fill/override behaviors and add a pixi run test-unit task to run them.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tiptop/tiptop_offline.py Offline rerun now loads recorded configs with fill_missing=True to tolerate older snapshots.
tiptop/config/init.py Implements default-merge behavior with strict-by-default missing-key detection and an opt-in fill path with warning.
tests/test_config.py Adds unit coverage for missing-key raise behavior, fill behavior, preserving user values, and cached-path semantics.
pixi.toml Adds a test-unit task to run non-integration tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@williamshen-nz
williamshen-nz merged commit b9c234a into main Jul 30, 2026
1 check passed
@williamshen-nz
williamshen-nz deleted the config-fill-missing branch July 30, 2026 22:48
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.

3 participants