Sample readiness time after provider observation
This commit is contained in:
parent
61121aea6b
commit
16407f7ea8
5 changed files with 20 additions and 13 deletions
|
|
@ -988,7 +988,6 @@ fn publish_managed_service_iteration_health(
|
|||
authenticated_release_witness_sha256,
|
||||
heartbeat_store,
|
||||
resident_store,
|
||||
Utc::now().timestamp_millis().max(0) as u64,
|
||||
args.resident_provider_stale_seconds.saturating_mul(1000),
|
||||
);
|
||||
terminal_current += pair.terminal_current;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ fn main() -> Result<()> {
|
|||
));
|
||||
}
|
||||
if matches!(args.command, CommandKind::Status) {
|
||||
let now = Utc::now().timestamp_millis().max(0) as u64;
|
||||
let projection = derive_resident_cognition_readiness(ResidentReadinessRequest {
|
||||
release_store: &args.policy.release_store,
|
||||
heartbeat_store: &args.heartbeat_store,
|
||||
|
|
@ -69,7 +68,6 @@ fn main() -> Result<()> {
|
|||
release_runtime_id: &args.policy.release_runtime_id,
|
||||
release_id: &args.policy.release_id,
|
||||
release_witness_sha256: &args.policy.release_witness_sha256,
|
||||
now_millis: now,
|
||||
freshness_millis: args.provider_freshness_seconds.saturating_mul(1000),
|
||||
});
|
||||
println!("{}", serde_json::to_string_pretty(&projection)?);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use std::os::fd::AsRawFd;
|
|||
#[cfg(windows)]
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
#[cfg(windows)]
|
||||
use windows_sys::Win32::Foundation::{
|
||||
|
|
@ -362,7 +363,6 @@ pub struct ResidentReadinessRequest<'a> {
|
|||
pub release_runtime_id: &'a str,
|
||||
pub release_id: &'a str,
|
||||
pub release_witness_sha256: &'a str,
|
||||
pub now_millis: u64,
|
||||
pub freshness_millis: u64,
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +582,6 @@ pub fn authenticate_resident_provider_pair(
|
|||
witness: &str,
|
||||
heartbeat_store: &Path,
|
||||
resident_store: &Path,
|
||||
now_millis: u64,
|
||||
freshness_millis: u64,
|
||||
) -> ResidentProviderPairHealth {
|
||||
let mut result = ResidentProviderPairHealth {
|
||||
|
|
@ -631,7 +630,7 @@ pub fn authenticate_resident_provider_pair(
|
|||
witness,
|
||||
Some(&release.source_commit_sha),
|
||||
executable.as_deref(),
|
||||
now_millis,
|
||||
current_time_millis(),
|
||||
freshness_millis,
|
||||
role_owner_present,
|
||||
) {
|
||||
|
|
@ -683,7 +682,7 @@ fn provider_is_fresh(
|
|||
request.release_witness_sha256,
|
||||
expected_source_commit,
|
||||
expected_executable,
|
||||
request.now_millis,
|
||||
current_time_millis(),
|
||||
request.freshness_millis,
|
||||
role_owner_present,
|
||||
);
|
||||
|
|
@ -782,6 +781,14 @@ fn canonical_or_absolute(path: &Path) -> PathBuf {
|
|||
fs::canonicalize(path).unwrap_or_else(|_| path.to_path_buf())
|
||||
}
|
||||
|
||||
fn current_time_millis() -> u64 {
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis()
|
||||
.min(u128::from(u64::MAX)) as u64
|
||||
}
|
||||
|
||||
fn directory_ready(path: &Path) -> bool {
|
||||
fs::metadata(path).is_ok_and(|value| value.is_dir() && !value.permissions().readonly())
|
||||
}
|
||||
|
|
@ -1147,7 +1154,6 @@ mod tests {
|
|||
release_runtime_id: &policy.release_runtime_id,
|
||||
release_id: &policy.release_id,
|
||||
release_witness_sha256: &policy.release_witness_sha256,
|
||||
now_millis: 0,
|
||||
freshness_millis: 1,
|
||||
});
|
||||
|
||||
|
|
@ -1268,7 +1274,7 @@ mod tests {
|
|||
};
|
||||
let witness = format!("sha256-{}", "a".repeat(64));
|
||||
let missing =
|
||||
authenticate_resident_provider_pair(&release, &witness, &heartbeat, &resident, 10, 10);
|
||||
authenticate_resident_provider_pair(&release, &witness, &heartbeat, &resident, 10);
|
||||
assert_eq!(missing.warming, 2);
|
||||
let process = crate::capture_process_instance(std::process::id())?;
|
||||
let mut wrong = provider();
|
||||
|
|
@ -1282,7 +1288,7 @@ mod tests {
|
|||
wrong.process_executable_path = process.executable_path.display().to_string();
|
||||
publish_resident_provider_readiness(&heartbeat, wrong)?;
|
||||
let rejected =
|
||||
authenticate_resident_provider_pair(&release, &witness, &heartbeat, &resident, 10, 10);
|
||||
authenticate_resident_provider_pair(&release, &witness, &heartbeat, &resident, 10);
|
||||
assert!(
|
||||
rejected
|
||||
.contradictions
|
||||
|
|
|
|||
|
|
@ -1159,8 +1159,10 @@ mounted store. The provider's CAS-replaced readiness row binds that live role
|
|||
to exact release, witness, source, executable, status, monotonic sequence, and
|
||||
bounded freshness. PID/creation-token observation is same-namespace diagnostic
|
||||
evidence; it is not a cross-container liveness owner because PID namespaces do
|
||||
not preserve that observation. Readiness may accept only a narrowly bounded
|
||||
future skew around its snapshot time and must still reject a genuinely
|
||||
not preserve that observation. Each predicate samples its evaluation time only
|
||||
after loading the exact provider row; release authentication time cannot make a
|
||||
concurrent refresh appear future-dated. Readiness may accept only a narrowly
|
||||
bounded future skew around that observation and must still reject a genuinely
|
||||
future-dated row. Status and supervisor aggregation share this derivation.
|
||||
Neither a fresh row without the role lock nor a role lock without the exact
|
||||
fresh row can become ready.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ incarnation. The cognitive brake was re-engaged at the clean sleeping boundary;
|
|||
both exact processes remain alive. The current source cut makes the shared-store
|
||||
role singleton own cross-container liveness and keeps the exact fresh provider
|
||||
row as release/witness/source/executable identity. PID sight is diagnostic.
|
||||
Rows more than one second beyond snapshot time still refuse. Fifteen focused
|
||||
Evaluation time is sampled only after loading each exact row, so slow witness
|
||||
authentication cannot race a provider refresh. Rows more than one second beyond
|
||||
that observation still refuse. Fifteen focused
|
||||
tests and all 666 non-ignored core library tests pass. Commit/package this cut,
|
||||
prove active/warming transitions with two copied-state containers, then publish
|
||||
under brake and resume endurance. Yggdrasil never builds.
|
||||
|
|
|
|||
Reference in a new issue