|
|
@@ -1251,7 +1251,7 @@ def collect_analysis_inputs(
|
|
|
td_report_paths: list[Path] | None = None,
|
|
|
binding_commit: str | None = None,
|
|
|
require_bitstream_binding: bool = False,
|
|
|
- package_stage: str = "final-review",
|
|
|
+ package_stage: str = "intermediate-review",
|
|
|
) -> AnalysisCollection:
|
|
|
root = repo_root.resolve(strict=True)
|
|
|
temp_root.mkdir(parents=True, exist_ok=True)
|
|
|
@@ -1439,12 +1439,24 @@ def collect_analysis_inputs(
|
|
|
elif unified:
|
|
|
# review-* must collect live Git provenance (linked worktrees OK via git CLI).
|
|
|
# Fail closed: never ship a "success" package with only sanitized-snapshot-status.
|
|
|
+ stage_for_clean = str(package_stage or "intermediate-review").strip().casefold().replace(
|
|
|
+ "_", "-"
|
|
|
+ )
|
|
|
+ if stage_for_clean in {"intermediate", "non-final"}:
|
|
|
+ stage_for_clean = "intermediate-review"
|
|
|
+ elif stage_for_clean in {"final", "final-review"}:
|
|
|
+ stage_for_clean = "final-review"
|
|
|
provenance, provenance_artifacts = handoff.collect_review_git_provenance(
|
|
|
root,
|
|
|
include_sanitized_git_snapshot=include_sanitized_git_snapshot,
|
|
|
meta_prefix="meta/git",
|
|
|
temp_root=temp_root / "review-git",
|
|
|
+ # Final-review: porcelain must be empty including untracked (clean worktree).
|
|
|
+ # Intermediate unit/fixture packs keep tracked-only dirty gate.
|
|
|
require_clean=(profile == "review-compact"),
|
|
|
+ require_clean_untracked=(
|
|
|
+ profile == "review-compact" and stage_for_clean == "final-review"
|
|
|
+ ),
|
|
|
commit=binding_commit,
|
|
|
)
|
|
|
if profile in {"review-compact", "review-debug"}:
|
|
|
@@ -3657,10 +3669,12 @@ def create_analysis_package(
|
|
|
full_inventory_by_path = {str(item["path"]): item for item in full_inventory}
|
|
|
_assert_items_unchanged(collection.items, full_inventory_by_path)
|
|
|
_assert_source_trees_unchanged(collection, profile=profile)
|
|
|
- # Fail-closed: review-compact must pass stage-aware ZIP selftest in staging
|
|
|
- # before any final-looking artifact is published atomically.
|
|
|
+ # Fail-closed for final-review: stage-aware ZIP selftest must pass in
|
|
|
+ # staging before any final-looking artifact is published atomically.
|
|
|
+ # Intermediate-review keeps structure checks but is not a final gate.
|
|
|
if profile == "review-compact":
|
|
|
from compact_package_selftest import ( # noqa: WPS433
|
|
|
+ PACKAGE_STAGE_FINAL,
|
|
|
run_compact_package_selftest,
|
|
|
)
|
|
|
|
|
|
@@ -3670,9 +3684,12 @@ def create_analysis_package(
|
|
|
write_evidence=False,
|
|
|
package_stage=None,
|
|
|
)
|
|
|
- if staged_report.get("status") != "pass":
|
|
|
+ if (
|
|
|
+ staged_report.get("package_stage") == PACKAGE_STAGE_FINAL
|
|
|
+ and staged_report.get("status") != "pass"
|
|
|
+ ):
|
|
|
raise PackagingError(
|
|
|
- "review-compact staging selftest failed before publish: "
|
|
|
+ "review-compact final-review staging selftest failed before publish: "
|
|
|
+ ", ".join(staged_report.get("failures") or ["unknown"])
|
|
|
)
|
|
|
if chunk_root is not None:
|