Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: make the new doctor tests run, and tidy the docs rows
All three new tests called Writer.add_metadata(name=, metadata=), but the
stock signature is (name, data), so every one raised TypeError and the
feature shipped unverified: 3 failed and 6 ty diagnostics on the branch.

Also restores the backticks the two new finding-code rows dropped, reflows
the paragraph above the table, and replaces k/v with descriptive names in the
group-map loop.
  • Loading branch information
kstonekuan committed Aug 29, 2026
commit 277b7a85b061f3e4f2214e2fda8a2ef3a044efd4
9 changes: 5 additions & 4 deletions docs/FORMAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ A file claiming this convention must satisfy, in increasing strictness:
`hflow doctor <file.mcap> [more.mcap ...]` checks every file given and prints
one report each in argument order; its aggregate result follows the
[exit code rules](#exit-codes). It validates the container, summary, indexes,
stamps, chunk purity (using the file's group map or a video-versus-state approximation), per-topic time order, and the H.264 access-unit properties listed
below. It does not currently classify H.264 picture coding types to detect
stamps, chunk purity (against the file's own group map, or a video-versus-state
approximation when it has none), per-topic time order, and the H.264
access-unit properties listed below. It does not currently classify H.264 picture coding types to detect
B-frames, so a clean report is not proof of the unchecked no-B-frame
constraint. The doctor also does not reject non-VCL NAL units before the first
AUD, so a clean report does not prove the canonical AUD-first constraint. An
Expand All @@ -177,8 +178,8 @@ automation. An `error` breaks the canonical convention (or the MCAP spec); a
| `no-statistics` | error | The summary has no `Statistics` record. |
| `no-chunk-indexes` | error | The summary has no `ChunkIndex` records. |
| `chunk-missing-message-indexes` | error | A chunk index has no per-channel `MessageIndex` offsets. |
| chunk-mixes-groups | warning | One chunk contains channels assigned to different groups; custom grouping can make this intentional. |
| chunk-mixes-video-and-state | warning | One chunk contains both video and state channels (reported when the file lacks a group map); custom grouping can make this intentional. |
| `chunk-mixes-groups` | warning | One chunk contains channels assigned to different groups; custom grouping can make this intentional. |
| `chunk-mixes-video-and-state` | warning | One chunk contains both video and state channels, reported only when the file has no group map; custom grouping can make this intentional. |
| `missing-provenance` | error | The `provenance/v1` metadata record is absent. |
| `provenance-missing-key` | error | `provenance/v1` lacks `schema_version` or `pipeline_version`. |
| `missing-episode-record` | warning | The optional `episode/v1` semantics record is absent. |
Expand Down
8 changes: 4 additions & 4 deletions src/hflow/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ def diagnose(path: Path | str) -> DoctorReport:

group_by_topic = {}
if provenance:
for k, v in provenance.items():
if k.startswith("group/"):
topic_name = k[len("group/") :]
group_by_topic[topic_name] = v
for provenance_key, provenance_value in provenance.items():
if provenance_key.startswith("group/"):
topic_name = provenance_key[len("group/") :]
group_by_topic[topic_name] = provenance_value

if summary.statistics is None:
collector.add(
Expand Down
7 changes: 4 additions & 3 deletions tests/test_doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,15 @@ def test_cli_curate_bad_catalog_prints_one_line(
assert "curate:" in captured.err
assert "Traceback" not in captured.err


def test_chunk_mixes_groups_with_map(tmp_path: Path) -> None:
path = tmp_path / "mixed.mcap"
with path.open("wb") as stream:
writer = StockWriter(stream)
writer.start(profile="", library="test")
writer.add_metadata(
name="provenance/v1",
metadata={
data={
"group//joint_states": "state",
"group//lidar_points": "bulk",
"schema_version": "1",
Expand Down Expand Up @@ -257,7 +258,7 @@ def test_chunk_no_mix_with_map(tmp_path: Path) -> None:
writer.start(profile="", library="test")
writer.add_metadata(
name="provenance/v1",
metadata={
data={
"group//joint_states": "state",
"schema_version": "1",
"pipeline_version": "1",
Expand All @@ -281,7 +282,7 @@ def test_chunk_mix_without_map(tmp_path: Path) -> None:
writer = StockWriter(stream)
writer.start(profile="", library="test")
writer.add_metadata(
name="provenance/v1", metadata={"schema_version": "1", "pipeline_version": "1"}
name="provenance/v1", data={"schema_version": "1", "pipeline_version": "1"}
)
video_schema = writer.register_schema(
name="foxglove.CompressedVideo",
Expand Down