feat(clean-release): complete and verify backend test suite (33 passing tests)

- Relocated and standardized tests for clean_release subsystem into __tests__ sub-packages.
- Implemented missing unit tests for preparation_service, audit_service, and stages.
- Enhanced API contract tests for candidate preparation and compliance reporting.
- Updated 023-clean-repo-enterprise coverage matrix with final verification results.
- Fixed relative import issues and model validation mismatches during test migration.
This commit is contained in:
2026-03-04 13:53:43 +03:00
parent de1f04406f
commit c5a0823b00
20 changed files with 2729 additions and 1209 deletions

View File

@@ -5,6 +5,28 @@
# @LAYER: Domain
# @RELATION: BINDS_TO -> specs/023-clean-repo-enterprise/data-model.md
# @INVARIANT: Enterprise-clean policy always forbids external sources.
#
# @TEST_CONTRACT CleanReleaseModels ->
# {
# required_fields: {
# ReleaseCandidate: [candidate_id, version, profile, source_snapshot_ref],
# CleanProfilePolicy: [policy_id, policy_version, internal_source_registry_ref]
# },
# invariants: [
# "enterprise-clean profile enforces external_source_forbidden=True",
# "manifest summary counts are consistent with items",
# "compliant run requires all mandatory stages to pass"
# ]
# }
# @TEST_FIXTURE valid_enterprise_candidate -> {"candidate_id": "RC-001", "version": "1.0.0", "profile": "enterprise-clean", "source_snapshot_ref": "v1.0.0-snapshot"}
# @TEST_FIXTURE valid_enterprise_policy -> {"policy_id": "POL-001", "policy_version": "1", "internal_source_registry_ref": "REG-1", "prohibited_artifact_categories": ["test-data"]}
# @TEST_EDGE enterprise_policy_missing_prohibited -> profile=enterprise-clean with empty prohibited_artifact_categories raises ValueError
# @TEST_EDGE enterprise_policy_external_allowed -> profile=enterprise-clean with external_source_forbidden=False raises ValueError
# @TEST_EDGE manifest_count_mismatch -> included + excluded != len(items) raises ValueError
# @TEST_EDGE compliant_run_stage_fail -> COMPLIANT run with failed stage raises ValueError
# @TEST_INVARIANT policy_purity -> verifies: [valid_enterprise_policy, enterprise_policy_external_allowed]
# @TEST_INVARIANT manifest_consistency -> verifies: [manifest_count_mismatch]
# @TEST_INVARIANT run_integrity -> verifies: [compliant_run_stage_fail]
# @TEST_CONTRACT: CleanReleaseModelPayload -> ValidatedCleanReleaseModel | ValidationError
# @TEST_SCENARIO: valid_enterprise_models -> CRITICAL entities validate and preserve lifecycle/compliance invariants.
# @TEST_FIXTURE: clean_release_models_baseline -> backend/tests/fixtures/clean_release/fixtures_clean_release.json