{
  "schema": "mathcast.d15.artifact-storage-versioning/v1",
  "plan_code": "D15-019",
  "status": "VERIFIED_CONTRACT",
  "runtime_started": false,
  "logical_root": "{project_id}/",
  "scopes": ["private_raw","private_working","registry_draft","publication_package","backup","public_published"],
  "layout": ["runs/{run_id}/run-manifest.json","runs/{run_id}/activity/events.jsonl","runs/{run_id}/discovery/snapshots/{snapshot_id}/","runs/{run_id}/evidence/{evidence_id}/","runs/{run_id}/drafts/{article_id}/{revision_id}/","runs/{run_id}/html/{article_id}/{revision_id}/","runs/{run_id}/assets/{article_id}/{revision_id}/{asset_id}/","runs/{run_id}/prompts/{article_id}/{revision_id}/","runs/{run_id}/qa/{article_id}/{revision_id}/{qa_id}/","runs/{run_id}/publication/{article_id}/{revision_id}/{package_id}/","articles/{article_id}/index.json","backups/{backup_id}/manifest.json"],
  "artifact_record_required": ["artifact_id","artifact_type","project_id","run_id","article_id","revision_id","storage_ref","media_type","byte_size","sha256","created_at","created_by","schema_version","state","parent_artifact_ids","source_refs","retention_class","warnings"],
  "artifact_types": ["RUN_MANIFEST","ACTIVITY_EVENT_LOG","ARTICLE_SNAPSHOT","EVIDENCE","FACT_LEDGER","EDITORIAL_BRIEF","DRAFT_DOCUMENT","HTML_REVISION","COMPONENT_MANIFEST","IMAGE_PROMPT_MANIFEST","ASSET_SOURCE","ASSET_DERIVATIVE","QA_REPORT","PUBLICATION_PACKAGE","BACKUP_MANIFEST"],
  "states": ["STAGED","COMMITTED","APPROVED","REJECTED","QUARANTINED","EXPIRED"],
  "pointer_types": ["current_revision_id","approved_revision_id","published_revision_id"],
  "rules": {"immutable_after_committed":true,"revision_parent_required":true,"registry_stores_pointers":true,"ready_does_not_publish":true,"rollback_creates_new_operation":true,"secrets_in_artifacts":false},
  "write_protocol": ["stage_payload","write_sidecar_manifest","validate_hash_size_mime_schema","atomic_commit","write_registry_pointer_after_dependency_check"],
  "idempotency": {"same_key_same_payload":"return existing artifact","same_key_different_payload":"IDEMPOTENCY_CONFLICT","key_required":true},
  "retention": {
    "AUDIT":{"auto_delete":false,"types":["RUN_MANIFEST","ACTIVITY_EVENT_LOG","EVIDENCE","FACT_LEDGER","PUBLICATION_PACKAGE"]},
    "ARTICLE_VERSION":{"keep_approved_and_published":true,"rejected_requires_grace_period":true},
    "MEDIA_SOURCE":{"raw_preserved_until_rights_audit_end":true,"derivatives_rebuildable":true},
    "TEMP":{"grace_period_required":true,"dry_run_required":true,"manual_confirmation_required":true}
  },
  "gc_guards": ["current","approved","published","evidence","backup","active_review","unfinished_run"],
  "backup": {"manifest_required":true,"include_hashes":true,"include_schema_versions":true,"external_copy_required":true,"verification":"read_and_compare_hashes","production_overwrite":false},
  "restore": ["restore_to_quarantine","validate_manifest","recompute_hashes","validate_dependency_graph","read_only_preview","owner_approval","pointer_switch"],
  "security": ["project_scoped_ids","allowlisted_types","size_limits","raw_not_public","credentials_not_logged","audit_events"],
  "audit_events": ["artifact_created","artifact_committed","pointer_changed","backup_verified","restore_previewed","retention_candidate","artifact_quarantined"],
  "fixtures": ["duplicate_idempotency","conflicting_payload","interrupted_write","hash_mismatch","wrong_mime","missing_parent","orphan_artifact","pointer_rollback","incomplete_backup","restore_preview","retention_protection","permission_denial","secret_redaction"],
  "rollback": {"failed_write":"keep_staging_or_quarantine","working_pointer":"unchanged","preserve_previous_approved":true,"preserve_raw_evidence":true,"unknown_side_effect":"BLOCKED"},
  "not_run": ["buckets","migrations","cleanup_worker","backup_job","registry_api","production_writes"]
}
