Index readiness review receipts
This commit is contained in:
parent
ccf3048103
commit
0cde0ed529
7 changed files with 159 additions and 7 deletions
|
|
@ -536,6 +536,32 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
&["swarmActionTuiRows"],
|
||||
"repo-work-readiness-review",
|
||||
)?;
|
||||
let receipt_directory = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-verse-query",
|
||||
&[
|
||||
"receipt-directory",
|
||||
"--store",
|
||||
path_str(&local_verse)?,
|
||||
"--runtime-id",
|
||||
"repo-work-readiness-smoke",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
require_receipt_directory_row(
|
||||
&receipt_directory,
|
||||
"repo-work-readiness-review",
|
||||
"repo-work-readiness-review-repo-work-readiness",
|
||||
"readiness-approved",
|
||||
"present",
|
||||
)?;
|
||||
require_tui_row_contains(
|
||||
&receipt_directory,
|
||||
&["tuiRows"],
|
||||
"repo-work-readiness-review",
|
||||
)?;
|
||||
require_tui_row_contains(&receipt_directory, &["tuiRows"], "artifact=present")?;
|
||||
require_bool(&receipt_directory, &["privateStateExposed"], false)?;
|
||||
|
||||
let summary = json!({
|
||||
"schemaVersion": "epiphany.repo_work_readiness_smoke.v0",
|
||||
|
|
@ -558,6 +584,8 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
"gjallarLatestRepoWorkReadiness": gjallar["latestRepoWorkReadiness"],
|
||||
"gjallarRepoWorkReadinessReviewCount": gjallar["repoWorkReadinessReviewCount"],
|
||||
"gjallarLatestRepoWorkReadinessReview": gjallar["latestRepoWorkReadinessReview"],
|
||||
"receiptDirectoryRowCount": receipt_directory["rowCount"],
|
||||
"receiptDirectoryReadinessReviewRow": receipt_directory_row_value(&receipt_directory, "repo-work-readiness-review")?,
|
||||
"sightOnly": readiness["authority"]["sightOnly"],
|
||||
"readinessApprovalAuthorized": readiness["authority"]["readinessApprovalAuthorized"],
|
||||
"publicationAuthorized": readiness["authority"]["publicationAuthorized"],
|
||||
|
|
@ -774,6 +802,59 @@ fn require_tui_row_contains(value: &Value, path: &[&str], needle: &str) -> Resul
|
|||
}
|
||||
}
|
||||
|
||||
fn receipt_directory_row_value<'a>(value: &'a Value, family: &str) -> Result<&'a Value> {
|
||||
value
|
||||
.get("rows")
|
||||
.and_then(Value::as_array)
|
||||
.and_then(|rows| {
|
||||
rows.iter()
|
||||
.find(|row| row.get("family").and_then(Value::as_str) == Some(family))
|
||||
})
|
||||
.ok_or_else(|| anyhow!("missing receipt-directory row {family:?}"))
|
||||
}
|
||||
|
||||
fn require_receipt_directory_row(
|
||||
value: &Value,
|
||||
family: &str,
|
||||
latest_id: &str,
|
||||
status: &str,
|
||||
artifact_status: &str,
|
||||
) -> Result<()> {
|
||||
let row = receipt_directory_row_value(value, family)?;
|
||||
let actual_latest_id = row
|
||||
.get("latestId")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("<missing>");
|
||||
let actual_status = row
|
||||
.get("status")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("<missing>");
|
||||
let actual_artifact_status = row
|
||||
.get("artifactStatus")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("<missing>");
|
||||
let actual_private = row
|
||||
.get("privateStateExposed")
|
||||
.and_then(Value::as_bool)
|
||||
.unwrap_or(true);
|
||||
let artifact_sha = row
|
||||
.get("artifactSha256")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("none");
|
||||
if actual_latest_id == latest_id
|
||||
&& actual_status == status
|
||||
&& actual_artifact_status == artifact_status
|
||||
&& artifact_sha != "none"
|
||||
&& !actual_private
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"receipt-directory row {family:?} mismatch: latestId={actual_latest_id:?}, status={actual_status:?}, artifactStatus={actual_artifact_status:?}, artifactSha256={artifact_sha:?}, privateStateExposed={actual_private}"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn take_path(
|
||||
args: &mut std::iter::Peekable<impl Iterator<Item = String>>,
|
||||
flag: &str,
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ const WRAPPER_BIFROST_PUBLICATION_COMMAND: &str =
|
|||
const WRAPPER_BIFROST_LEDGER_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode bifrost-ledger";
|
||||
const WRAPPER_RECEIPT_DIRECTORY_COMMAND: &str =
|
||||
"tools/epiphany_local_run.ps1 -Mode receipt-directory";
|
||||
const WRAPPER_REPO_WORK_READINESS_REVIEW_COMMAND: &str =
|
||||
"tools/epiphany_local_run.ps1 -Mode repo-work-readiness-review";
|
||||
const DIRECT_IDUNN_DEPLOYMENT_AFTERCARE_AUDIT_COMMAND: &str = "epiphany-work deployment-aftercare-audit --workspace <repo> --local-verse-store <store> --idunn-deployment-receipt-ref latest --aftercare-audit-receipt-ref latest";
|
||||
const WRAPPER_SERVICE_TICK_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode service-tick";
|
||||
const WRAPPER_SERVICE_POLICY_DIRECTORY_COMMAND: &str =
|
||||
|
|
@ -221,7 +223,16 @@ fn run_cli() -> Result<()> {
|
|||
&args.store,
|
||||
args.runtime_id.clone(),
|
||||
)?;
|
||||
let report = receipt_directory_report(&context, &lifecycle_receipts);
|
||||
let latest_repo_work_readiness_review =
|
||||
load_latest_epiphany_cultmesh_repo_work_readiness_review(
|
||||
&args.store,
|
||||
args.runtime_id.clone(),
|
||||
)?;
|
||||
let report = receipt_directory_report(
|
||||
&context,
|
||||
&lifecycle_receipts,
|
||||
latest_repo_work_readiness_review.as_ref(),
|
||||
);
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json!({
|
||||
|
|
@ -2495,6 +2506,7 @@ fn run_cli() -> Result<()> {
|
|||
&args.store,
|
||||
args.runtime_id.clone(),
|
||||
)?,
|
||||
None,
|
||||
);
|
||||
if !degraded_receipt_directory.rows.iter().any(|row| {
|
||||
row.family == "daemon-poke"
|
||||
|
|
@ -2575,6 +2587,7 @@ fn run_cli() -> Result<()> {
|
|||
&args.store,
|
||||
args.runtime_id.clone(),
|
||||
)?,
|
||||
None,
|
||||
);
|
||||
if !restored_receipt_directory.rows.iter().any(|row| {
|
||||
row.family == "daemon-poke"
|
||||
|
|
@ -2934,7 +2947,7 @@ fn run_cli() -> Result<()> {
|
|||
&args.store,
|
||||
args.runtime_id.clone(),
|
||||
)?;
|
||||
let receipt_directory = receipt_directory_report(&context, &lifecycle_receipts);
|
||||
let receipt_directory = receipt_directory_report(&context, &lifecycle_receipts, None);
|
||||
if receipt_directory.status != "ok"
|
||||
|| receipt_directory.private_state_exposed
|
||||
|| !receipt_directory.attention_route_rows.is_empty()
|
||||
|
|
@ -3156,7 +3169,7 @@ fn run_cli() -> Result<()> {
|
|||
&args.store,
|
||||
args.runtime_id.clone(),
|
||||
)?;
|
||||
receipt_directory_report(&context, &lifecycle_receipts)
|
||||
receipt_directory_report(&context, &lifecycle_receipts, None)
|
||||
};
|
||||
if service_overview.service_lifecycle_recommended_wrapper_mode
|
||||
!= "cluster-service-execution-audit"
|
||||
|
|
@ -7421,6 +7434,7 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
|
|||
fn receipt_directory_report(
|
||||
context: &EpiphanyLocalVerseContext,
|
||||
lifecycle_receipts: &[EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry],
|
||||
latest_repo_work_readiness_review: Option<&EpiphanyCultMeshRepoWorkReadinessReviewEntry>,
|
||||
) -> ReceiptDirectoryReport {
|
||||
let mut rows = Vec::new();
|
||||
let mut tui_rows = Vec::new();
|
||||
|
|
@ -7948,6 +7962,42 @@ fn receipt_directory_report(
|
|||
.unwrap_or(false),
|
||||
},
|
||||
);
|
||||
let readiness_review_artifact_ref = latest_repo_work_readiness_review
|
||||
.map(|review| review.readiness_review_receipt_ref.clone())
|
||||
.unwrap_or_else(|| "none".to_string());
|
||||
let readiness_review_artifact_status =
|
||||
operator_artifact_status(&readiness_review_artifact_ref).to_string();
|
||||
push_receipt_directory_row(
|
||||
&mut rows,
|
||||
&mut tui_rows,
|
||||
ReceiptDirectoryRow {
|
||||
family: "repo-work-readiness-review".to_string(),
|
||||
owner: "Maintainer/Soul/Mind/Bifrost".to_string(),
|
||||
document_kind: "epiphany.cultmesh.repo_work_readiness_review.v0".to_string(),
|
||||
latest_id: latest_repo_work_readiness_review
|
||||
.map(|review| review.review_id.clone())
|
||||
.unwrap_or_else(|| "missing".to_string()),
|
||||
status: latest_repo_work_readiness_review
|
||||
.map(|review| review.status.clone())
|
||||
.unwrap_or_else(|| "missing".to_string()),
|
||||
route: latest_repo_work_readiness_review
|
||||
.map(|review| review.readiness_receipt_ref.clone())
|
||||
.unwrap_or_else(|| "none".to_string()),
|
||||
service_id: "none".to_string(),
|
||||
service_route: "none".to_string(),
|
||||
follow_up_command: WRAPPER_REPO_WORK_READINESS_REVIEW_COMMAND.to_string(),
|
||||
artifact_ref: readiness_review_artifact_ref.clone(),
|
||||
artifact_status: readiness_review_artifact_status.clone(),
|
||||
artifact_sha256: operator_artifact_sha256(
|
||||
&readiness_review_artifact_ref,
|
||||
&readiness_review_artifact_status,
|
||||
),
|
||||
present: latest_repo_work_readiness_review.is_some(),
|
||||
private_state_exposed: latest_repo_work_readiness_review
|
||||
.map(|review| review.private_state_exposed)
|
||||
.unwrap_or(false),
|
||||
},
|
||||
);
|
||||
for row in service_lifecycle_receipt_directory_rows(
|
||||
lifecycle_receipts,
|
||||
context.latest_daemon_service_lifecycle_receipt.as_ref(),
|
||||
|
|
|
|||
Reference in a new issue