Separate provider readiness from live transport
This commit is contained in:
parent
b2edd1f276
commit
8e3e48d027
8 changed files with 55 additions and 53 deletions
|
|
@ -60,7 +60,7 @@ fn run_smoke(args: &Args) -> Result<Value> {
|
|||
"statusExe": status_exe,
|
||||
"bifrostBridge": bridge,
|
||||
"privateStateExposed": bridge["privateStateExposed"],
|
||||
"readySurfaceCount": bridge["readySurfaceCount"],
|
||||
"providerReadySurfaceCount": bridge["providerReadySurfaceCount"],
|
||||
"preparedSurfaceCount": bridge["preparedSurfaceCount"],
|
||||
"surfaceCount": bridge["surfaceCount"],
|
||||
"surfaces": bridge["surfaces"],
|
||||
|
|
@ -72,7 +72,6 @@ fn run_smoke(args: &Args) -> Result<Value> {
|
|||
fn run_native_status(root: &Path, status_exe: &Path) -> Result<Value> {
|
||||
let output = Command::new(status_exe)
|
||||
.current_dir(root)
|
||||
.arg("--native")
|
||||
.arg("--json")
|
||||
.arg("--cwd")
|
||||
.arg(root)
|
||||
|
|
@ -104,27 +103,19 @@ fn validate_bridge(bridge: &Value) -> Result<()> {
|
|||
.is_some_and(|count| count >= 5),
|
||||
"Bifrost bridge sight should expose at least five governed surfaces",
|
||||
)?;
|
||||
require(
|
||||
surface_is(bridge, "github", &["live"])
|
||||
&& surface_is(bridge, "other", &["live"])
|
||||
&& surface_is(bridge, "patron", &["live"])
|
||||
&& surface_is(bridge, "discord", &["live", "prepared"])
|
||||
&& surface_is(bridge, "reddit", &["live", "prepared"]),
|
||||
"Bifrost bridge sight should report GitHub/Other/Patron live and Discord/Reddit live or prepared",
|
||||
)
|
||||
}
|
||||
|
||||
fn surface_is(bridge: &Value, id: &str, allowed: &[&str]) -> bool {
|
||||
bridge
|
||||
let surfaces = bridge
|
||||
.get("surfaces")
|
||||
.and_then(Value::as_array)
|
||||
.and_then(|surfaces| {
|
||||
surfaces
|
||||
.iter()
|
||||
.find(|surface| surface.get("id").and_then(Value::as_str) == Some(id))
|
||||
})
|
||||
.and_then(|surface| surface.get("status").and_then(Value::as_str))
|
||||
.is_some_and(|surface_status| allowed.contains(&surface_status))
|
||||
.ok_or_else(|| anyhow!("Bifrost bridge sight has no surface rows"))?;
|
||||
require(
|
||||
surfaces.iter().all(|surface| {
|
||||
matches!(
|
||||
surface.get("status").and_then(Value::as_str),
|
||||
Some("provider-ready" | "prepared" | "missing")
|
||||
)
|
||||
}),
|
||||
"Bifrost bridge rows must report evidence state without claiming live transport",
|
||||
)
|
||||
}
|
||||
|
||||
fn ensure_status_built(root: &Path, status_exe: &Path) -> Result<()> {
|
||||
|
|
|
|||
|
|
@ -629,13 +629,13 @@ fn bifrost_bridge_readiness(root: &Path) -> Value {
|
|||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.map(|surface| {
|
||||
let ready = surface["ready"].as_bool().unwrap_or(false);
|
||||
let provider_ready = surface["ready"].as_bool().unwrap_or(false);
|
||||
let prepared = surface["prepared"].as_bool().unwrap_or(false);
|
||||
json!({
|
||||
"id": surface["id"].clone(),
|
||||
"label": surface["label"].clone(),
|
||||
"status": if ready { "live" } else if prepared { "prepared" } else { "missing" },
|
||||
"ready": ready,
|
||||
"status": if provider_ready { "provider-ready" } else if prepared { "prepared" } else { "missing" },
|
||||
"providerReady": provider_ready,
|
||||
"prepared": prepared,
|
||||
"authority": surface["authority"].clone(),
|
||||
"credentialSource": surface["credentialSource"].clone(),
|
||||
|
|
@ -645,25 +645,25 @@ fn bifrost_bridge_readiness(root: &Path) -> Value {
|
|||
.collect::<Vec<_>>();
|
||||
let ready_count = surfaces
|
||||
.iter()
|
||||
.filter(|surface| surface["ready"].as_bool().unwrap_or(false))
|
||||
.filter(|surface| surface["providerReady"].as_bool().unwrap_or(false))
|
||||
.count();
|
||||
let prepared_count = surfaces
|
||||
.iter()
|
||||
.filter(|surface| {
|
||||
surface["prepared"].as_bool().unwrap_or(false)
|
||||
&& !surface["ready"].as_bool().unwrap_or(false)
|
||||
&& !surface["providerReady"].as_bool().unwrap_or(false)
|
||||
})
|
||||
.count();
|
||||
json!({
|
||||
"status": if bridge["ready"].as_bool().unwrap_or(false) { "live" } else if bridge["prepared"].as_bool().unwrap_or(false) { "prepared" } else { "unavailable" },
|
||||
"status": if bridge["ready"].as_bool().unwrap_or(false) { "provider-ready" } else if bridge["prepared"].as_bool().unwrap_or(false) { "prepared" } else { "unavailable" },
|
||||
"owner": "Bifrost",
|
||||
"authority": "Bifrost owns outside-world crossing gates, bridge receipts, and readiness projection; Heimdall owns provider OAuth, account links, and capability truth; Epiphany consumes this as read-only bridge sight.",
|
||||
"source": "Bifrost provider advertisement print-surface",
|
||||
"tool": advertisement_tool,
|
||||
"generatedAt": parsed["stats"]["generatedAt"].clone(),
|
||||
"ready": bridge["ready"].clone(),
|
||||
"providerReady": bridge["ready"].clone(),
|
||||
"prepared": bridge["prepared"].clone(),
|
||||
"readySurfaceCount": ready_count,
|
||||
"providerReadySurfaceCount": ready_count,
|
||||
"preparedSurfaceCount": prepared_count,
|
||||
"surfaceCount": surfaces.len(),
|
||||
"surfaces": surfaces,
|
||||
|
|
@ -1160,7 +1160,7 @@ pub fn render_status(status: &Value) -> String {
|
|||
format!(
|
||||
"- Bifrost bridge: {} ({}/{})",
|
||||
maybe(&bifrost_bridge["status"], "unavailable"),
|
||||
maybe(&bifrost_bridge["readySurfaceCount"], "0"),
|
||||
maybe(&bifrost_bridge["providerReadySurfaceCount"], "0"),
|
||||
maybe(&bifrost_bridge["surfaceCount"], "0")
|
||||
),
|
||||
format!(
|
||||
|
|
|
|||
|
|
@ -128,13 +128,18 @@ fn validate_readiness(value: &Value) -> Result<()> {
|
|||
== Some(false),
|
||||
"Bifrost readiness smoke should seal private state",
|
||||
)?;
|
||||
let surfaces = value
|
||||
.pointer("/bifrostBridge/surfaces")
|
||||
.and_then(Value::as_array)
|
||||
.ok_or_else(|| anyhow!("Bifrost readiness smoke has no surface rows"))?;
|
||||
require(
|
||||
surface_is(value, "github", &["live"])
|
||||
&& surface_is(value, "other", &["live"])
|
||||
&& surface_is(value, "patron", &["live"])
|
||||
&& surface_is(value, "discord", &["live", "prepared"])
|
||||
&& surface_is(value, "reddit", &["live", "prepared"]),
|
||||
"Bifrost readiness smoke should expose governed bridge surfaces",
|
||||
surfaces.iter().all(|surface| {
|
||||
matches!(
|
||||
surface.get("status").and_then(Value::as_str),
|
||||
Some("provider-ready" | "prepared" | "missing")
|
||||
)
|
||||
}),
|
||||
"Bifrost readiness smoke should expose evidence states, not live transport claims",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +207,7 @@ fn validate_persona_surface(
|
|||
fn bridge_summary(value: &Value) -> Value {
|
||||
json!({
|
||||
"status": value.pointer("/bifrostBridge/status"),
|
||||
"readySurfaceCount": value.pointer("/bifrostBridge/readySurfaceCount"),
|
||||
"providerReadySurfaceCount": value.pointer("/bifrostBridge/providerReadySurfaceCount"),
|
||||
"preparedSurfaceCount": value.pointer("/bifrostBridge/preparedSurfaceCount"),
|
||||
"surfaceCount": value.pointer("/bifrostBridge/surfaceCount"),
|
||||
"surfaces": value.pointer("/bifrostBridge/surfaces"),
|
||||
|
|
@ -227,19 +232,6 @@ fn persona_summary(name: &str, value: &Value) -> Value {
|
|||
})
|
||||
}
|
||||
|
||||
fn surface_is(value: &Value, id: &str, allowed: &[&str]) -> bool {
|
||||
value
|
||||
.pointer("/bifrostBridge/surfaces")
|
||||
.and_then(Value::as_array)
|
||||
.and_then(|surfaces| {
|
||||
surfaces
|
||||
.iter()
|
||||
.find(|surface| surface.get("id").and_then(Value::as_str) == Some(id))
|
||||
})
|
||||
.and_then(|surface| surface.get("status").and_then(Value::as_str))
|
||||
.is_some_and(|status| allowed.contains(&status))
|
||||
}
|
||||
|
||||
fn ensure_bins_built(root: &Path) -> Result<()> {
|
||||
let mut missing = Vec::new();
|
||||
for bin in REQUIRED_BINS {
|
||||
|
|
|
|||
Reference in a new issue