utterplan 0.6.6__tar.gz → 0.6.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {utterplan-0.6.6 → utterplan-0.6.8}/PKG-INFO +1 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/bundles.md +36 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/changelog.md +16 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/python-api.md +35 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_bundle_replan.py +20 -0
- utterplan-0.6.8/tests/test_bundle_role_inventory.py +380 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_bundle_services.py +111 -2
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli_bundle_compile_book.py +35 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli_bundle_document.py +44 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_ssmd_bundle.py +52 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_ssmd_bundle_document.py +1 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/__init__.py +16 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/_book_replan.py +11 -3
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/_book_service.py +9 -2
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/_document_service.py +5 -14
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/_version.py +3 -3
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/bundle.py +84 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/bundle_replan.py +1 -0
- utterplan-0.6.8/utterplan/bundle_role_inventory.py +498 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/cli.py +21 -3
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/codecs/v4_toml.py +0 -14
- utterplan-0.6.8/utterplan/explain.py +295 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/ssmd_bundle.py +24 -20
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/PKG-INFO +1 -1
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/SOURCES.txt +2 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/scm_file_list.json +6 -0
- utterplan-0.6.8/utterplan.egg-info/scm_version.json +8 -0
- utterplan-0.6.6/utterplan/explain.py +0 -643
- utterplan-0.6.6/utterplan.egg-info/scm_version.json +0 -8
- {utterplan-0.6.6 → utterplan-0.6.8}/.codecrate.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/.github/workflows/codecov.yml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/.github/workflows/pre-commit.yml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/.github/workflows/python-publish.yml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/.github/workflows/tests.yml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/.gitignore +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/.pre-commit-config.yaml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/AGENTS.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/LICENSE +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/MANIFEST.in +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/NOTICE +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/README.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/Makefile +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/architecture.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/cli.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/conf.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/consumer-guide.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/coordinate-spaces.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/debugging.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/format.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/getting-started.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/index.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/make.bat +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/phase-a-completion.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/pykokoro-integration.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/docs/requirements.txt +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/examples/basic.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/examples/chapter.ssmd +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/examples/compile_file.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/examples/inspect_plan.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/examples/multilingual.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/examples/ssmd_example.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/pyproject.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/setup.cfg +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/spec/schemas/v1.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/spec/schemas/v2.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/spec/schemas/v3.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/spec/schemas/v4.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/spec/utterplan.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/compiler_helpers.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/fixtures/canonical_consumer_contract.expected.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/fixtures/canonical_consumer_contract.ssmd +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/fixtures/document-bundle-v1/story.ssmd-bundle/document.ssmd.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/fixtures/document-bundle-v1/story.ssmd-bundle/manifest.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/fixtures/ssmd_09_comprehensive.ssmd +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/basic_en.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/directives.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/markers.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/multilingual.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/parenthetical.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/spokenform_offsets.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/ssmd_09_comprehensive.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/golden/ssmd_breaks.utterplan.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/cases.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/basic_en.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/directives.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/markers.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/multilingual.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/parenthetical.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/spokenform_offsets.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/ssmd_09_comprehensive.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/fixtures/v4/ssmd_breaks.utterplan.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/goldens/multilingual_preparation.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/goldens/spokenform_numbers.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/goldens/ssmd_break.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/goldens/ssmd_language_detection.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/goldens/ssmd_marker.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/goldens/ssmd_pronunciation.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/test_legacy_json_import.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/migration/test_semantic_migration_regressions.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/README.md +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/basic.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/directives.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/markers.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/multilingual.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/parenthetical.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/spokenform_offsets.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v1/ssmd_breaks.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v2/directives.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v3/multilingual.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v3/ssmd_09_comprehensive.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/schema_history/v5/canonical_consumer_contract.toml +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_atomic_io.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_batch.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_boundaries.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_bundle_book_replan.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_bundle_book_services.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_bundle_document_compile.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_bundle_document_render.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli_batch.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli_bundle_render_book.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli_bundle_render_document.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_cli_bundle_replan_book.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_compiler.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_consumer_contract.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_consumer_readiness.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_coordinates.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_dependency_architecture.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_directives.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_explain.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_fake_renderer.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_flow_compilation.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_format.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_golden.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_identity_units.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_import_boundaries.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_language.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_linguistics.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_migration_framework.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_migration_v3_to_v4.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_migration_v4_to_v5.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_pauses.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_planner.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_preparation.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_preview.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_progress.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_public_identity.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderability.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderability_repair.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderplan_batch.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderplan_dependency_contract.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderplan_export.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderplan_replan.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_renderplan_v7_contract.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_replacement_provenance.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_role_coverage.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_schema_history.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_schema_registry.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_schema_strict.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_schema_v6_source.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_schema_v7.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_segment_topology.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_segmentation_adapter.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_segmentation_recovery.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_semantic_boundaries.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_sentence_topology.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_source_input.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_ssmd_09_parser.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_ssmd_bundle_book.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_ssmd_substitution_preparation.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_token_topology.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_toml_format.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_ttsready_preparation_adapter.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/tests/test_version.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/__main__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/atomic_io.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/attempt_serialization.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/attempts.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/batch.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/boundaries.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/codecs/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/codecs/v5_toml.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/codecs/v6_toml.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/codecs/v7_toml.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/compiler.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/config.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/diagnostics.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/directives.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/exceptions.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/flow_projection.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/format.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/hashing.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/language.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/linguistics.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migration.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/registry.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/v1_to_v2.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/v2_to_v3.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/v3_to_v4.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/v4_to_v5.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/v5_to_v6.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/migrations/v6_to_v7.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/model.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/parsers.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/pauses.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/planner.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/preparation.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/preview.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/progress.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/py.typed +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderability.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderplan_batch.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderplan_export.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderplan_grouping.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderplan_projection.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderplan_replan.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/renderplan_workspace.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/role_coverage.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/schema_registry.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/schemas/v1.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/schemas/v2.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/schemas/v3.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/schemas/v4.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/segmentation.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/serialization.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/source_input.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/spacy_models.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/spans.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/document/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/document/plain.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/document/ssmd.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/preparation/__init__.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/preparation/identity.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/preparation/ssmd.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/preparation/ttsready.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/stages/protocols.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/token_topology.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/toml_codec.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/trace_codec.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/units.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/utterplan.schema.json +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/versioning.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan/workspace_paths.py +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/dependency_links.txt +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/entry_points.txt +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/requires.txt +0 -0
- {utterplan-0.6.6 → utterplan-0.6.8}/utterplan.egg-info/top_level.txt +0 -0
|
@@ -26,10 +26,43 @@ utterplan bundle compile novel.ssmd-bundle --chapters 5-17
|
|
|
26
26
|
utterplan bundle compile story.ssmd-bundle --text-preparation identity
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
When already inside a bundle root, `.` is also accepted because the supplied path is resolved before the directory name is validated:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd story.ssmd-bundle
|
|
33
|
+
utterplan bundle compile --lang en .
|
|
34
|
+
```
|
|
35
|
+
|
|
29
36
|
Compilation defaults to all items. For book bundles, `--chapters` selects manifest `source_number` values: one number, an inclusive range, or comma-separated combinations such as `1,3-5,9`. Selected items retain manifest order. A document bundle accepts only `--chapters all`.
|
|
30
37
|
|
|
31
38
|
By default, one schema-v7 `.utterplan.toml` plan per selected item and `compile-report.toml` are written under `<bundle>/utterplan/`. `--output-dir` and `--report` override those destinations. Existing plans are protected unless `--force` is supplied; `--fail-fast` records later selected items as skipped after a failure. `--language` is a fallback for SSMD language metadata. Bundle sources are SSMD 0.9, so the command does not accept an input-format override. The report is operational metadata and does not affect plan identity.
|
|
32
39
|
|
|
40
|
+
### Bundle-level logical role inventory
|
|
41
|
+
|
|
42
|
+
A successful complete bundle compile writes `utterplan/role-inventory.toml` under the selected UtterPlan output directory (by default, `<bundle>/utterplan/`). For example:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ssmdconvert bundle convert story.ssmd.md
|
|
46
|
+
utterplan bundle compile story.ssmd-bundle
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The bundle contains the source and compiled document plan alongside the derived inventory:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
story.ssmd-bundle/
|
|
53
|
+
├── document.ssmd.md
|
|
54
|
+
├── manifest.json
|
|
55
|
+
└── utterplan/
|
|
56
|
+
├── document.utterplan.toml
|
|
57
|
+
└── role-inventory.toml
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The TOML contract uses `format = "utterplan.bundle-role-inventory"` and `version = 1`. It records `bundle_kind`, a SHA-256 of the exact manifest bytes, aggregate `[[roles]]` with speech-segment occurrence counts, bundle-order `[[items]]`, and each item's source and plan paths, actual source-byte SHA-256, canonical `plan_id`, explicit role order/counts, and implicit/default-role count. Paths are bundle-relative POSIX paths, not absolute machine paths. Inventory bytes are deterministic and the file is replaced atomically.
|
|
61
|
+
|
|
62
|
+
Roles and counts derive from compiled FlowPlan speech segments through UtterPlan's logical role semantics, not by scanning SSMD markup or inspecting RenderPlans. Aggregate role order is first semantic occurrence across items in manifest order; item role order is first occurrence within that plan. Empty and audio-only segments do not count. Speech without an explicit role sets `uses_default_role = true` and increments `implicit_occurrences`; it is not assigned an invented role name. A profile-aware consumer resolves the concrete default role later.
|
|
63
|
+
|
|
64
|
+
Freshness is content-based: `manifest_sha256` hashes the current `manifest.json` bytes, each `source_sha256` hashes its current source bytes, and each item stores the compiled plan's `plan_id`. Modification times are not used. A subset book compile never replaces the canonical whole-bundle inventory and returns no inventory path. A failed full compile also leaves any previous inventory untouched. The successful full-compile summary reports explicit roles, whether a default role is required, and the inventory path; partial compiles do not claim a whole-bundle inventory was produced.
|
|
65
|
+
|
|
33
66
|
## Render
|
|
34
67
|
|
|
35
68
|
Compilation and rendering are separate operations. Rendering reads saved plans and requires an explicit RenderProfile:
|
|
@@ -58,7 +91,7 @@ The full variant directory name, including its profile fingerprint, is required.
|
|
|
58
91
|
|
|
59
92
|
## Safe and read-only behavior
|
|
60
93
|
|
|
61
|
-
The
|
|
94
|
+
The supplied workspace path is resolved first. The resolved directory must be named `<name>.ssmd-bundle` and contain a regular, non-symlink `manifest.json`. Therefore `.` and equivalent aliases are valid when they resolve to the bundle root; paths to `chapters/` or an item file remain invalid. Manifest item paths must be normalized relative POSIX paths, remain inside the resolved root, and resolve to regular files. Symlink escapes and unsafe output collisions are rejected. Manifest size and document size are bounded. Source digests are not used to replace current edited content; the manifest and source files are never refreshed or rewritten.
|
|
62
95
|
|
|
63
96
|
## Python API
|
|
64
97
|
|
|
@@ -80,3 +113,5 @@ print(projected.variant)
|
|
|
80
113
|
```
|
|
81
114
|
|
|
82
115
|
`compile_bundle()`, `render_bundle()`, and `replan_bundle()` accept paths and keyword options. Their result records expose the resolved bundle, kind, selection, per-item outcomes, artifact paths, reports, and exit status. Optional progress and start callbacks receive typed records; services do not print. Invalid or unsafe requests raise `BundleServiceError` or `BundleReplanError`, while item-level failures are returned in result outcomes.
|
|
116
|
+
|
|
117
|
+
For a successful full bundle compile, `BundleCompileResult.role_inventory_path` is the canonical `role-inventory.toml` path. It is `None` for partial selections and any compile with a failed item; in those cases the prior whole-bundle inventory, if present, remains untouched. The artifact is additive and does not alter plan identity or bundle rendering.
|
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [v0.6.8] - Unreleased
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added renderer-neutral role inventories to full bundle compilation
|
|
12
|
+
|
|
13
|
+
<!-- generated by releaseledger -->
|
|
14
|
+
|
|
15
|
+
## [v0.6.7] - 2026-10-22
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed bundle path detection when a path resolves to an SSMD bundle root
|
|
20
|
+
|
|
21
|
+
<!-- generated by releaseledger -->
|
|
22
|
+
|
|
7
23
|
## [v0.6.6] - 2026-10-21
|
|
8
24
|
|
|
9
25
|
### Added
|
|
@@ -236,6 +236,41 @@ The compile and render services accept paths and keyword options. `chapters` def
|
|
|
236
236
|
|
|
237
237
|
`BundleCompileResult`, `BundleRenderResult`, and `BundleReplanResult` expose the resolved bundle, manifest-declared kind, selected item IDs, per-item outcomes, generated paths, reports, and exit status. Their start records provide resolved configuration to optional callbacks. Invalid or unsafe shared requests raise `BundleServiceError` or `BundleReplanError`; item-level failures are reported in result outcomes. The package also exports manifest loader, selector, item-path, result, start, and callback types for integrations that need to inspect dispatch results.
|
|
238
238
|
|
|
239
|
+
## Bundle role inventory
|
|
240
|
+
|
|
241
|
+
`BundleRole`, `BundleRoleInventoryItem`, and `BundleRoleInventory` are immutable public models for the version-1 `utterplan.bundle-role-inventory` TOML interoperability contract. `build_bundle_role_inventory()` consumes compiled item records in manifest order; each record provides `id`, `source_path`, and `plan_path`, with optional `source_relative_path` and `plan_relative_path` values. It loads the saved FlowPlan, reuses `logical_role_inventory()`, and hashes the exact manifest and source file bytes.
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
from pathlib import Path
|
|
245
|
+
|
|
246
|
+
from utterplan import (
|
|
247
|
+
build_bundle_role_inventory,
|
|
248
|
+
load_bundle_role_inventory,
|
|
249
|
+
save_bundle_role_inventory,
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
bundle = Path("story.ssmd-bundle")
|
|
253
|
+
inventory = build_bundle_role_inventory(
|
|
254
|
+
bundle_root=bundle,
|
|
255
|
+
bundle_kind="document",
|
|
256
|
+
manifest_path=bundle / "manifest.json",
|
|
257
|
+
compiled_items=[
|
|
258
|
+
{
|
|
259
|
+
"id": "document-0001",
|
|
260
|
+
"source_path": bundle / "document.ssmd.md",
|
|
261
|
+
"source_relative_path": "document.ssmd.md",
|
|
262
|
+
"plan_path": bundle / "utterplan/document.utterplan.toml",
|
|
263
|
+
"plan_relative_path": "utterplan/document.utterplan.toml",
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
)
|
|
267
|
+
save_bundle_role_inventory(inventory, bundle / "utterplan/role-inventory.toml")
|
|
268
|
+
restored = load_bundle_role_inventory(bundle / "utterplan/role-inventory.toml")
|
|
269
|
+
assert restored == inventory
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The loader rejects unsupported versions, malformed hashes/paths, duplicate roles or item IDs, invalid counts, inconsistent explicit-role maps, and aggregates that do not match their item records. Saving is deterministic and atomic. Persisted `uses_default_role` and `implicit_occurrences` describe unresolved profile-default speech; no concrete role is inferred. Item source and plan references are bundle-relative POSIX paths, and their hashes/`plan_id` let consumers detect stale metadata without modification-time checks. The bundle compiler emits this artifact only for successful complete selections; partial or failed compiles do not replace it. Downstream tools may read this serialized contract without importing UtterPlan or parsing SSMD.
|
|
273
|
+
|
|
239
274
|
## Planner progress callbacks
|
|
240
275
|
|
|
241
276
|
`UtterancePlanner.plan`, `UtterancePlanner.compile`, and `compile_document` accept an optional keyword-only `on_progress` callback. It receives typed `PlannerProgressEvent` objects synchronously in the planner thread. Progress is operational only: it is not added to `PlannerConfig` or the plan, and enabling a callback does not change plan identity or serialization.
|
|
@@ -10,8 +10,10 @@ from renderplan import codec as renderplan_codec
|
|
|
10
10
|
|
|
11
11
|
from tests.test_bundle_book_replan import _active_plan, _save_preflight, _setup
|
|
12
12
|
from tests.test_bundle_services import _planner_config, _profile
|
|
13
|
+
from utterplan._book_replan import BookReplanError, replan_book
|
|
13
14
|
from utterplan.bundle import compile_bundle, render_bundle
|
|
14
15
|
from utterplan.bundle_replan import BundleReplanError, replan_bundle
|
|
16
|
+
from utterplan.ssmd_bundle import load_ssmd_bundle
|
|
15
17
|
|
|
16
18
|
DOCUMENT_FIXTURE = Path(__file__).parent / "fixtures/document-bundle-v1/story.ssmd-bundle"
|
|
17
19
|
|
|
@@ -62,13 +64,24 @@ def _document_preflight(root: Path, variant: str, active_path: Path) -> Path:
|
|
|
62
64
|
|
|
63
65
|
def test_replan_bundle_keeps_book_set_selection_and_immutable_child_behavior(
|
|
64
66
|
tmp_path: Path,
|
|
67
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
65
68
|
) -> None:
|
|
66
69
|
root, variant, variant_dir, _ = _setup(tmp_path, numbers=(5, 6))
|
|
67
70
|
entry, parent, _ = _active_plan(variant_dir)
|
|
71
|
+
loaded_indexes = []
|
|
72
|
+
|
|
73
|
+
def tracked_load(path):
|
|
74
|
+
index = load_ssmd_bundle(path)
|
|
75
|
+
loaded_indexes.append(index)
|
|
76
|
+
return index
|
|
77
|
+
|
|
78
|
+
monkeypatch.setattr("utterplan.bundle_replan.load_ssmd_bundle", tracked_load)
|
|
79
|
+
monkeypatch.setattr("utterplan._book_replan.load_ssmd_bundle", tracked_load)
|
|
68
80
|
preflight_path = _save_preflight(root / "voicerender", variant, entry.id, parent)
|
|
69
81
|
starts = []
|
|
70
82
|
|
|
71
83
|
result = replan_bundle(root, variant=variant, chapters="5", on_start=starts.append)
|
|
84
|
+
assert len(loaded_indexes) == 1
|
|
72
85
|
|
|
73
86
|
assert result.kind == "book"
|
|
74
87
|
assert result.selected_item_ids == ("chapter-0005",)
|
|
@@ -133,3 +146,10 @@ def test_document_replan_rejects_non_all_selector(tmp_path: Path) -> None:
|
|
|
133
146
|
root = _document_bundle(tmp_path / "story.ssmd-bundle")
|
|
134
147
|
with pytest.raises(BundleReplanError, match="document bundles only support --chapters all"):
|
|
135
148
|
replan_bundle(root, variant="any", chapters="1")
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def test_book_replan_rejects_document_bundle_direct_call(tmp_path: Path) -> None:
|
|
152
|
+
root = _document_bundle(tmp_path / "story.ssmd-bundle")
|
|
153
|
+
|
|
154
|
+
with pytest.raises(BookReplanError, match="bundle manifest format is not a book"):
|
|
155
|
+
replan_book(root, variant="not-a-book")
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from types import SimpleNamespace
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
import utterplan
|
|
9
|
+
from utterplan import (
|
|
10
|
+
AudioDirective,
|
|
11
|
+
FlowPlan,
|
|
12
|
+
FlowSegment,
|
|
13
|
+
FlowUnit,
|
|
14
|
+
SegmentDirectives,
|
|
15
|
+
VoiceDirective,
|
|
16
|
+
)
|
|
17
|
+
from utterplan.bundle_role_inventory import (
|
|
18
|
+
BundleRole,
|
|
19
|
+
BundleRoleInventory,
|
|
20
|
+
BundleRoleInventoryError,
|
|
21
|
+
BundleRoleInventoryItem,
|
|
22
|
+
build_bundle_role_inventory,
|
|
23
|
+
load_bundle_role_inventory,
|
|
24
|
+
save_bundle_role_inventory,
|
|
25
|
+
sha256_file,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _plan(*segments: FlowSegment) -> FlowPlan:
|
|
30
|
+
return FlowPlan(language="en-US", flow=(FlowUnit(tuple(segments)),))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _simple_inventory() -> BundleRoleInventory:
|
|
34
|
+
item = BundleRoleInventoryItem(
|
|
35
|
+
id="document-0001",
|
|
36
|
+
source="document.ssmd.md",
|
|
37
|
+
source_sha256="b" * 64,
|
|
38
|
+
plan="utterplan/document.utterplan.toml",
|
|
39
|
+
plan_id="sha256:" + "c" * 64,
|
|
40
|
+
explicit_roles=("host",),
|
|
41
|
+
explicit_occurrences={"host": 1},
|
|
42
|
+
uses_default_role=False,
|
|
43
|
+
implicit_occurrences=0,
|
|
44
|
+
)
|
|
45
|
+
return BundleRoleInventory(
|
|
46
|
+
bundle_kind="document",
|
|
47
|
+
manifest_sha256="a" * 64,
|
|
48
|
+
roles=(BundleRole("host", 1),),
|
|
49
|
+
uses_default_role=False,
|
|
50
|
+
implicit_occurrences=0,
|
|
51
|
+
items=(item,),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _item(
|
|
56
|
+
bundle_root: Path,
|
|
57
|
+
item_id: str,
|
|
58
|
+
source_name: str,
|
|
59
|
+
plan_name: str,
|
|
60
|
+
plan: FlowPlan,
|
|
61
|
+
) -> SimpleNamespace:
|
|
62
|
+
source = bundle_root / source_name
|
|
63
|
+
plan_path = bundle_root / plan_name
|
|
64
|
+
source.write_bytes(f"source for {item_id}".encode())
|
|
65
|
+
plan.save(plan_path, create_parent=True)
|
|
66
|
+
return SimpleNamespace(
|
|
67
|
+
id=item_id,
|
|
68
|
+
source_path=source,
|
|
69
|
+
source_relative_path=source_name,
|
|
70
|
+
plan_path=plan_path,
|
|
71
|
+
plan_relative_path=plan_name,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_builder_aggregates_compiled_roles_in_manifest_order_and_hashes_exact_files(
|
|
76
|
+
tmp_path: Path,
|
|
77
|
+
) -> None:
|
|
78
|
+
manifest = tmp_path / "manifest.json"
|
|
79
|
+
manifest.write_bytes(b'{ "bundle_kind" : "book" }\n')
|
|
80
|
+
first = _item(
|
|
81
|
+
tmp_path,
|
|
82
|
+
"chapter-0001",
|
|
83
|
+
"chapter-1.ssmd.md",
|
|
84
|
+
"plans/chapter-1.toml",
|
|
85
|
+
_plan(
|
|
86
|
+
FlowSegment(
|
|
87
|
+
"Narration.",
|
|
88
|
+
"en-US",
|
|
89
|
+
directives=SegmentDirectives(voice=VoiceDirective("narrator")),
|
|
90
|
+
),
|
|
91
|
+
FlowSegment("Default speech.", "en-US"),
|
|
92
|
+
FlowSegment("", "en-US", directives=SegmentDirectives(voice=VoiceDirective("empty"))),
|
|
93
|
+
FlowSegment(
|
|
94
|
+
"Music",
|
|
95
|
+
"en-US",
|
|
96
|
+
directives=SegmentDirectives(audio=AudioDirective(src="music.wav")),
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
second = _item(
|
|
101
|
+
tmp_path,
|
|
102
|
+
"chapter-0002",
|
|
103
|
+
"chapter-2.ssmd.md",
|
|
104
|
+
"plans/chapter-2.toml",
|
|
105
|
+
_plan(
|
|
106
|
+
FlowSegment(
|
|
107
|
+
"Host.", "en-US", directives=SegmentDirectives(voice=VoiceDirective("host"))
|
|
108
|
+
),
|
|
109
|
+
FlowSegment(
|
|
110
|
+
"Narration again.",
|
|
111
|
+
"en-US",
|
|
112
|
+
directives=SegmentDirectives(voice=VoiceDirective("narrator")),
|
|
113
|
+
),
|
|
114
|
+
FlowSegment(
|
|
115
|
+
"Another host.", "en-US", directives=SegmentDirectives(voice=VoiceDirective("host"))
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
inventory = build_bundle_role_inventory(
|
|
121
|
+
bundle_root=tmp_path,
|
|
122
|
+
bundle_kind="book",
|
|
123
|
+
manifest_path=manifest,
|
|
124
|
+
compiled_items=(first, second),
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
assert inventory.bundle_kind == "book"
|
|
128
|
+
assert inventory.manifest_sha256 == sha256_file(manifest)
|
|
129
|
+
assert [role.name for role in inventory.roles] == ["narrator", "host"]
|
|
130
|
+
assert [role.occurrences for role in inventory.roles] == [2, 2]
|
|
131
|
+
assert inventory.uses_default_role is True
|
|
132
|
+
assert inventory.implicit_occurrences == 1
|
|
133
|
+
assert [item.id for item in inventory.items] == ["chapter-0001", "chapter-0002"]
|
|
134
|
+
assert inventory.items[0].source == "chapter-1.ssmd.md"
|
|
135
|
+
assert inventory.items[0].plan == "plans/chapter-1.toml"
|
|
136
|
+
assert inventory.items[0].source_sha256 == sha256_file(first.source_path)
|
|
137
|
+
assert inventory.items[0].plan_id == FlowPlan.load(first.plan_path).plan_id
|
|
138
|
+
assert inventory.items[0].explicit_roles == ("narrator",)
|
|
139
|
+
assert inventory.items[0].implicit_occurrences == 1
|
|
140
|
+
assert inventory.items[1].explicit_roles == ("host", "narrator")
|
|
141
|
+
with pytest.raises(TypeError):
|
|
142
|
+
inventory.items[0].explicit_occurrences["new"] = 1 # type: ignore[index]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_save_load_is_deterministic_and_round_trips(tmp_path: Path) -> None:
|
|
146
|
+
manifest = tmp_path / "manifest.json"
|
|
147
|
+
manifest.write_bytes(b"{}")
|
|
148
|
+
compiled = _item(
|
|
149
|
+
tmp_path,
|
|
150
|
+
"document-0001",
|
|
151
|
+
"document.ssmd.md",
|
|
152
|
+
"document.utterplan.toml",
|
|
153
|
+
_plan(
|
|
154
|
+
FlowSegment(
|
|
155
|
+
"Host.", "en-US", directives=SegmentDirectives(voice=VoiceDirective("host"))
|
|
156
|
+
),
|
|
157
|
+
FlowSegment(
|
|
158
|
+
"Host again.", "en-US", directives=SegmentDirectives(voice=VoiceDirective("host"))
|
|
159
|
+
),
|
|
160
|
+
),
|
|
161
|
+
)
|
|
162
|
+
inventory = build_bundle_role_inventory(
|
|
163
|
+
bundle_root=tmp_path,
|
|
164
|
+
bundle_kind="document",
|
|
165
|
+
manifest_path=manifest,
|
|
166
|
+
compiled_items=(compiled,),
|
|
167
|
+
)
|
|
168
|
+
first = tmp_path / "first.toml"
|
|
169
|
+
second = tmp_path / "second.toml"
|
|
170
|
+
|
|
171
|
+
save_bundle_role_inventory(inventory, first)
|
|
172
|
+
save_bundle_role_inventory(inventory, second)
|
|
173
|
+
|
|
174
|
+
assert first.read_bytes() == second.read_bytes()
|
|
175
|
+
assert load_bundle_role_inventory(first) == inventory
|
|
176
|
+
assert 'format = "utterplan.bundle-role-inventory"' in first.read_text(encoding="utf-8")
|
|
177
|
+
assert 'name = "host"' in first.read_text(encoding="utf-8")
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_loader_rejects_unsupported_version_and_inconsistent_aggregate(tmp_path: Path) -> None:
|
|
181
|
+
manifest = tmp_path / "manifest.json"
|
|
182
|
+
manifest.write_bytes(b"{}")
|
|
183
|
+
compiled = _item(
|
|
184
|
+
tmp_path,
|
|
185
|
+
"document-0001",
|
|
186
|
+
"document.ssmd.md",
|
|
187
|
+
"document.utterplan.toml",
|
|
188
|
+
_plan(
|
|
189
|
+
FlowSegment(
|
|
190
|
+
"Host.", "en-US", directives=SegmentDirectives(voice=VoiceDirective("host"))
|
|
191
|
+
)
|
|
192
|
+
),
|
|
193
|
+
)
|
|
194
|
+
inventory = build_bundle_role_inventory(
|
|
195
|
+
bundle_root=tmp_path,
|
|
196
|
+
bundle_kind="document",
|
|
197
|
+
manifest_path=manifest,
|
|
198
|
+
compiled_items=(compiled,),
|
|
199
|
+
)
|
|
200
|
+
path = tmp_path / "inventory.toml"
|
|
201
|
+
save_bundle_role_inventory(inventory, path)
|
|
202
|
+
original = path.read_text(encoding="utf-8")
|
|
203
|
+
|
|
204
|
+
path.write_text(original.replace("version = 1", "version = 2", 1), encoding="utf-8")
|
|
205
|
+
with pytest.raises(BundleRoleInventoryError, match="version"):
|
|
206
|
+
load_bundle_role_inventory(path)
|
|
207
|
+
|
|
208
|
+
path.write_text(original.replace("occurrences = 1", "occurrences = 2", 1), encoding="utf-8")
|
|
209
|
+
with pytest.raises(BundleRoleInventoryError, match="aggregate role"):
|
|
210
|
+
load_bundle_role_inventory(path)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def test_models_reject_duplicate_roles_and_inconsistent_implicit_metadata() -> None:
|
|
214
|
+
with pytest.raises(BundleRoleInventoryError, match="duplicate aggregate role"):
|
|
215
|
+
BundleRoleInventory(
|
|
216
|
+
bundle_kind="document",
|
|
217
|
+
manifest_sha256="a" * 64,
|
|
218
|
+
roles=(BundleRole("host", 1), BundleRole("host", 1)),
|
|
219
|
+
uses_default_role=False,
|
|
220
|
+
implicit_occurrences=0,
|
|
221
|
+
items=(),
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def test_inventory_contract_is_exported_from_package_root() -> None:
|
|
226
|
+
assert utterplan.BundleRole is BundleRole
|
|
227
|
+
assert utterplan.BundleRoleInventory is BundleRoleInventory
|
|
228
|
+
assert utterplan.BundleRoleInventoryError is BundleRoleInventoryError
|
|
229
|
+
assert utterplan.build_bundle_role_inventory is build_bundle_role_inventory
|
|
230
|
+
assert utterplan.load_bundle_role_inventory is load_bundle_role_inventory
|
|
231
|
+
assert utterplan.save_bundle_role_inventory is save_bundle_role_inventory
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@pytest.mark.parametrize(
|
|
235
|
+
("old", "new", "message"),
|
|
236
|
+
[
|
|
237
|
+
('format = "utterplan.bundle-role-inventory"', 'format = "other"', "format"),
|
|
238
|
+
('manifest_sha256 = "' + "a" * 64 + '"', 'manifest_sha256 = "bad"', "manifest_sha256"),
|
|
239
|
+
('source_sha256 = "' + "b" * 64 + '"', 'source_sha256 = "bad"', "source_sha256"),
|
|
240
|
+
("occurrences = 1", "occurrences = -1", "non-negative integer"),
|
|
241
|
+
("occurrences = 1", "occurrences = true", "non-negative integer"),
|
|
242
|
+
('explicit_roles = ["host"]', 'explicit_roles = ["host", "host"]', "duplicate"),
|
|
243
|
+
('source = "document.ssmd.md"', 'source = "/tmp/document.ssmd.md"', "relative path"),
|
|
244
|
+
("host = 1\n", "", "exactly the roles"),
|
|
245
|
+
("uses_default_role = false", "uses_default_role = true", "uses_default_role"),
|
|
246
|
+
('plan = "utterplan/document.utterplan.toml"\n', "", "missing"),
|
|
247
|
+
],
|
|
248
|
+
)
|
|
249
|
+
def test_loader_rejects_malformed_or_inconsistent_contract(
|
|
250
|
+
tmp_path: Path, old: str, new: str, message: str
|
|
251
|
+
) -> None:
|
|
252
|
+
path = tmp_path / "inventory.toml"
|
|
253
|
+
save_bundle_role_inventory(_simple_inventory(), path)
|
|
254
|
+
text = path.read_text(encoding="utf-8")
|
|
255
|
+
assert old in text
|
|
256
|
+
path.write_text(text.replace(old, new, 1), encoding="utf-8")
|
|
257
|
+
|
|
258
|
+
with pytest.raises(BundleRoleInventoryError, match=message):
|
|
259
|
+
load_bundle_role_inventory(path)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def test_loader_rejects_duplicate_item_ids() -> None:
|
|
263
|
+
inventory = _simple_inventory()
|
|
264
|
+
item = inventory.items[0]
|
|
265
|
+
with pytest.raises(BundleRoleInventoryError, match="duplicate bundle item id"):
|
|
266
|
+
BundleRoleInventory(
|
|
267
|
+
bundle_kind="document",
|
|
268
|
+
manifest_sha256=inventory.manifest_sha256,
|
|
269
|
+
roles=(BundleRole("host", 2),),
|
|
270
|
+
uses_default_role=False,
|
|
271
|
+
implicit_occurrences=0,
|
|
272
|
+
items=(item, item),
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def test_uppercase_sha256_values_are_normalized() -> None:
|
|
277
|
+
item = BundleRoleInventoryItem(
|
|
278
|
+
id="document-0001",
|
|
279
|
+
source="document.ssmd.md",
|
|
280
|
+
source_sha256="B" * 64,
|
|
281
|
+
plan="document.utterplan.toml",
|
|
282
|
+
plan_id="sha256:" + "c" * 64,
|
|
283
|
+
explicit_roles=("host",),
|
|
284
|
+
explicit_occurrences={"host": 1},
|
|
285
|
+
uses_default_role=False,
|
|
286
|
+
implicit_occurrences=0,
|
|
287
|
+
)
|
|
288
|
+
inventory = BundleRoleInventory(
|
|
289
|
+
bundle_kind="document",
|
|
290
|
+
manifest_sha256="A" * 64,
|
|
291
|
+
roles=(BundleRole("host", 1),),
|
|
292
|
+
uses_default_role=False,
|
|
293
|
+
implicit_occurrences=0,
|
|
294
|
+
items=(item,),
|
|
295
|
+
)
|
|
296
|
+
assert inventory.manifest_sha256 == "a" * 64
|
|
297
|
+
assert inventory.items[0].source_sha256 == "b" * 64
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def test_implicit_only_builder_does_not_invent_an_explicit_role(tmp_path: Path) -> None:
|
|
301
|
+
manifest = tmp_path / "manifest.json"
|
|
302
|
+
manifest.write_bytes(b"{}")
|
|
303
|
+
compiled = _item(
|
|
304
|
+
tmp_path,
|
|
305
|
+
"document-0001",
|
|
306
|
+
"document.ssmd.md",
|
|
307
|
+
"document.utterplan.toml",
|
|
308
|
+
_plan(
|
|
309
|
+
FlowSegment("Unassigned speech.", "en-US"),
|
|
310
|
+
FlowSegment("", "en-US", directives=SegmentDirectives(voice=VoiceDirective("empty"))),
|
|
311
|
+
FlowSegment(
|
|
312
|
+
"Audio only",
|
|
313
|
+
"en-US",
|
|
314
|
+
directives=SegmentDirectives(audio=AudioDirective(src="music.wav")),
|
|
315
|
+
),
|
|
316
|
+
),
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
inventory = build_bundle_role_inventory(
|
|
320
|
+
bundle_root=tmp_path,
|
|
321
|
+
bundle_kind="document",
|
|
322
|
+
manifest_path=manifest,
|
|
323
|
+
compiled_items=(compiled,),
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
assert inventory.roles == ()
|
|
327
|
+
assert inventory.uses_default_role is True
|
|
328
|
+
assert inventory.implicit_occurrences == 1
|
|
329
|
+
assert inventory.items[0].explicit_roles == ()
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def test_manifest_and_source_content_hashes_change_when_bytes_change(tmp_path: Path) -> None:
|
|
333
|
+
manifest = tmp_path / "manifest.json"
|
|
334
|
+
manifest.write_bytes(b'{"version":1}')
|
|
335
|
+
compiled = _item(
|
|
336
|
+
tmp_path,
|
|
337
|
+
"document-0001",
|
|
338
|
+
"document.ssmd.md",
|
|
339
|
+
"document.utterplan.toml",
|
|
340
|
+
_plan(
|
|
341
|
+
FlowSegment(
|
|
342
|
+
"Host.", "en-US", directives=SegmentDirectives(voice=VoiceDirective("host"))
|
|
343
|
+
)
|
|
344
|
+
),
|
|
345
|
+
)
|
|
346
|
+
first = build_bundle_role_inventory(
|
|
347
|
+
bundle_root=tmp_path,
|
|
348
|
+
bundle_kind="document",
|
|
349
|
+
manifest_path=manifest,
|
|
350
|
+
compiled_items=(compiled,),
|
|
351
|
+
)
|
|
352
|
+
manifest.write_bytes(b'{ "version": 1 }')
|
|
353
|
+
compiled.source_path.write_bytes(b"updated source bytes")
|
|
354
|
+
second = build_bundle_role_inventory(
|
|
355
|
+
bundle_root=tmp_path,
|
|
356
|
+
bundle_kind="document",
|
|
357
|
+
manifest_path=manifest,
|
|
358
|
+
compiled_items=(compiled,),
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
assert first.manifest_sha256 != second.manifest_sha256
|
|
362
|
+
assert first.items[0].source_sha256 != second.items[0].source_sha256
|
|
363
|
+
assert first.items[0].plan_id == second.items[0].plan_id
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def test_save_failure_preserves_previous_inventory_atomically(
|
|
367
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
368
|
+
) -> None:
|
|
369
|
+
path = tmp_path / "role-inventory.toml"
|
|
370
|
+
path.write_bytes(b"previous inventory")
|
|
371
|
+
|
|
372
|
+
def fail_replace(_source: object, _destination: object) -> None:
|
|
373
|
+
raise OSError("simulated replace failure")
|
|
374
|
+
|
|
375
|
+
monkeypatch.setattr("utterplan.atomic_io.os.replace", fail_replace)
|
|
376
|
+
with pytest.raises(OSError, match="simulated replace failure"):
|
|
377
|
+
save_bundle_role_inventory(_simple_inventory(), path)
|
|
378
|
+
|
|
379
|
+
assert path.read_bytes() == b"previous inventory"
|
|
380
|
+
assert list(tmp_path.iterdir()) == [path]
|