-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(render): scheme-agnostic build_manifest + schema v6 [LTV-Pn.1] #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f764f6b
refactor(render): scheme-agnostic build_manifest + schema v6 [LTV-Pn.1]
shaypal5 79ab6b8
fix(cli): surface generation_scheme in inspect; honest fixtures [LTV-…
shaypal5 d4289b0
docs(test): fix stale v5 docstring in snapshot-safe integration test …
shaypal5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| """Unit tests for the scheme-agnostic build_manifest contract (LTV-Pn.1).""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from leadforge.core.models import GenerationConfig | ||
| from leadforge.render.manifests import BUNDLE_SCHEMA_VERSION, build_manifest | ||
|
|
||
|
|
||
| def _config() -> GenerationConfig: | ||
| return GenerationConfig(seed=1, n_accounts=2, n_contacts=3, n_leads=4) | ||
|
|
||
|
|
||
| def _manifest(tmp_path, **kwargs): | ||
| # Empty row-count dicts → no parquet files to hash; isolates the | ||
| # scheme-agnostic header fields under test. | ||
| return build_manifest( | ||
| config=_config(), | ||
| table_row_counts={}, | ||
| task_row_counts={}, | ||
| bundle_root=tmp_path, | ||
| generation_timestamp="2026-01-01T00:00:00+00:00", | ||
| **kwargs, | ||
| ) | ||
|
|
||
|
|
||
| def test_records_generation_scheme(tmp_path) -> None: | ||
| m = _manifest(tmp_path, generation_scheme="lifecycle") | ||
| assert m["generation_scheme"] == "lifecycle" | ||
| assert m["bundle_schema_version"] == BUNDLE_SCHEMA_VERSION | ||
|
|
||
|
|
||
| def test_motif_family_defaults_to_none(tmp_path) -> None: | ||
| # A scheme without a single named motif (e.g. lifecycle) omits it. | ||
| m = _manifest(tmp_path, generation_scheme="lifecycle") | ||
| assert m["motif_family"] is None | ||
|
|
||
|
|
||
| def test_motif_family_passthrough(tmp_path) -> None: | ||
| m = _manifest(tmp_path, generation_scheme="lead_scoring", motif_family="fit_dominant") | ||
| assert m["motif_family"] == "fit_dominant" | ||
|
|
||
|
|
||
| def test_extra_fields_merged(tmp_path) -> None: | ||
| m = _manifest( | ||
| tmp_path, | ||
| generation_scheme="lifecycle", | ||
| extra_fields={"observation_date": "2026-06-01", "forward_windows_days": [90, 365, 730]}, | ||
| ) | ||
| assert m["observation_date"] == "2026-06-01" | ||
| assert m["forward_windows_days"] == [90, 365, 730] | ||
|
|
||
|
|
||
| def test_extra_fields_cannot_overwrite_core_keys(tmp_path) -> None: | ||
| with pytest.raises(ValueError, match="overwrite core manifest keys"): | ||
| _manifest( | ||
| tmp_path, | ||
| generation_scheme="lifecycle", | ||
| extra_fields={"seed": 999, "generation_scheme": "evil"}, | ||
| ) | ||
|
|
||
|
|
||
| def test_generation_scheme_is_required(tmp_path) -> None: | ||
| # Positional/keyword required argument — omitting it is a TypeError. | ||
| with pytest.raises(TypeError): | ||
| build_manifest( # type: ignore[call-arg] | ||
| config=_config(), | ||
| table_row_counts={}, | ||
| task_row_counts={}, | ||
| bundle_root=tmp_path, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.