test(dataset): assert the provenance sidecar payload whole - #402
Conversation
kstonekuan
left a comment
There was a problem hiding this comment.
LGTM, merging. Your table reproduces, all eight, and two more I added for good measure (dropping name and row_count) fail too, so the whole-dict assertion covers the three keys that were already checked as well as the five that were not.
Minting the workspace identity is the part that took judgment, and your reasoning in the comment is exactly right: asserting workspace_id is None would have been indistinguishable from asserting the key was dropped. A test that passes for both the correct and the broken behavior is worse than no test, and you spotted that the fixture handed you one.
Passing created_at explicitly rather than letting it default does the same job for a different reason, and the mutation proves it: stamping a fresh now() inside _sidecar_payload fails now, so the field is pinned as the caller's value rather than merely as a plausible timestamp.
Popping pipeline and comparing it above is the right call. A whole-dict assertion that swallowed the entire pipeline manifest would fail on every unrelated check change, and a test that cries wolf gets edited into uselessness.
Gate on the merged result: ruff check, ruff format --check, ty check clean, 1526 passed / 6 skipped. Your 31 local failures are hflow-server not being installed; uv sync --locked --all-extras picks it up if you want them quiet.
Closes #391.
Closes #391.
The dataset provenance sidecar had five keys no test read back:
dataset_manifest_version,created_at,total_episodes, thecoverageblock, andworkspace_id.test_the_manifest_and_its_provenance_land_togetheralready loaded the file, so this widens that test rather than adding a second one.Following #388, the top level is asserted as a whole dict. That pins absence as well as presence.
pipelineis popped and compared separately, since it isjson.loads(manifest.to_json())and pinning it whole would mean restating every check on every pipeline change.Two things the fixture needed:
created_atis now passed explicitly, so the assertion pins that the sidecar records the caller's stamp rather than a secondnow()taken inside_sidecar_payload.workspace_idwasNonein this fixture, which is also what dropping the key would look like.coveragegets real numbers: one entry forduration, 1 of 1. Not merely a non-empty list.Mutations run against the assertions, each one alone:
dataset_manifest_versiontotal_episodescoveragewith[]coveragekeyepisodes_ranas 0workspace_idto Nonecreated_atinside the payloadtests/test_dataset.pyis 13 passed, 1 skipped. The full suite matches main exactly here, 31 failed and 1194 passed either way, fromhflow_servernot being installed locally.