S417 · SOURCE-BOUND GATE EVIDENCE
S417 · Handshake attempt reconciliation
tam S417 implementation modülü → Operations --test hedefi ile bağlı tam focused test → ayrı Operations kaydı Bu sayfa yalnız S417 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.
S417Focused kod testiOperations id exactsource SHA exacttest target exact
operation: g8l-s417-handshake-attempt-reconciliation-partial
uygulama/model · focused test · Operations · 3 exact excerpt
sequence-bound=true · implementation-bound=true
01 · Yürütme / doğrulama kodu
Kapının gerçek repository sözleşmesi
tam dosyaL1–L152
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s417_handshake_attempt_reconciliation.rs::S417 handshake attempt reconciliation implementation
#![allow(unexpected_cfgs)]
//! S417 drained-attempt reconciliation for the S416 handshake.
//!
//! A live S247 token blocks cleanup. After release, CPU1 waits until CPU0 has
//! drained the S408 send receipt, discards any late non-authoritative S414 ACK,
//! and only then rearms the dedicated SGI3 sender. CPU0 candidate/admission
//! cleanup is intentionally left to S418.
use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s408_live_offer_sgi_sender::{
G8lS408LiveOfferSgiError, G8lS408LiveOfferSgiPhase,
G8lS408LiveOfferSgiSenderState,
};
use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication::{
G8lS414S243JoinAckError, G8lS414S243JoinAckState,
};
use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s416_production_exclusion_handshake_invocation::{
S416_DIRECT_SCHEDULER_ACCESS_SITES, S416_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES,
S416_SOURCE_AUDIT_UNITS, S416_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES,
S416_UNROUTED_DIRECT_ACCESS_SITES,
};
pub const S417_SOURCE_AUDIT_UNITS: usize = S416_SOURCE_AUDIT_UNITS;
pub const S417_DIRECT_SCHEDULER_ACCESS_SITES: usize = S416_DIRECT_SCHEDULER_ACCESS_SITES;
pub const S417_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES: usize =
S416_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES;
pub const S417_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES: usize =
S416_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES;
pub const S417_UNROUTED_DIRECT_ACCESS_SITES: usize = S416_UNROUTED_DIRECT_ACCESS_SITES;
pub const S417_PRODUCTION_RECONCILIATION_CALLSITES: usize = 1;
pub const S417_DRAIN_BEFORE_REARM_COMPLETE: bool = true;
pub const S417_STALE_ACK_REJECTION_COMPLETE: bool = true;
pub const S417_CPU0_PARTIAL_STATE_RECONCILIATION_COMPLETE: bool = false;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS417HandshakeAttemptReconciliationOutcome {
Idle,
Ready,
HandshakeActive,
AwaitingSendReceiptDrain,
Rearmed { stale_ack_discarded: bool },
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS417HandshakeAttemptReconciliationError {
WrongCpu,
S408(G8lS408LiveOfferSgiError),
S414(G8lS414S243JoinAckError),
AckDisappeared,
}
pub fn service_s417_model_handshake_attempt_reconciliation(
sender: &mut G8lS408LiveOfferSgiSenderState,
acks: &mut G8lS414S243JoinAckState,
caller_cpu: usize,
active_exclusive_token: Option<u64>,
send_receipt_pending: bool,
) -> Result<G8lS417HandshakeAttemptReconciliationOutcome, G8lS417HandshakeAttemptReconciliationError>
{
if caller_cpu != 1 {
return Err(G8lS417HandshakeAttemptReconciliationError::WrongCpu);
}
if active_exclusive_token.is_some() {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::HandshakeActive);
}
if send_receipt_pending {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::AwaitingSendReceiptDrain);
}
match sender.phase() {
G8lS408LiveOfferSgiPhase::Idle => {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::Idle)
}
G8lS408LiveOfferSgiPhase::ReceiverReady => {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::Ready)
}
G8lS408LiveOfferSgiPhase::Sent | G8lS408LiveOfferSgiPhase::Failed => {}
}
let ack = acks
.pending_ack(caller_cpu)
.map_err(G8lS417HandshakeAttemptReconciliationError::S414)?;
let stale_ack_discarded = if ack.is_some() {
acks.take(caller_cpu)
.map_err(G8lS417HandshakeAttemptReconciliationError::S414)?
.ok_or(G8lS417HandshakeAttemptReconciliationError::AckDisappeared)?;
true
} else {
false
};
sender
.rearm_after_drained_attempt(false)
.map_err(G8lS417HandshakeAttemptReconciliationError::S408)?;
Ok(G8lS417HandshakeAttemptReconciliationOutcome::Rearmed {
stale_ack_discarded,
})
}
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
#[derive(Debug)]
pub enum G8lS417ProductionHandshakeAttemptReconciliationError {
WrongCpu,
S408(crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s408_live_offer_sgi_sender::G8lS408ProductionSgiError),
S414(G8lS414S243JoinAckError),
AckDisappeared,
}
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn service_s417_handshake_attempt_reconciliation_on_cpu1() -> Result<
G8lS417HandshakeAttemptReconciliationOutcome,
G8lS417ProductionHandshakeAttemptReconciliationError,
> {
use crate::g8l_runtime_contract::CPU1;
if crate::percpu::try_current_cpu_id() != Some(CPU1) {
return Err(G8lS417ProductionHandshakeAttemptReconciliationError::WrongCpu);
}
let active_token = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s246_whole_scheduler_read_access_guard::S247_PRODUCTION_WHOLE_SCHEDULER_ACCESS_GATE
.active_exclusive_token();
if active_token.is_some() {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::HandshakeActive);
}
let send_receipt_pending = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s408_live_offer_sgi_sender::s408_production_send_receipt_pending_on_cpu1()
.map_err(G8lS417ProductionHandshakeAttemptReconciliationError::S408)?;
if send_receipt_pending {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::AwaitingSendReceiptDrain);
}
let phase = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s408_live_offer_sgi_sender::s408_production_sender_phase_on_cpu1()
.map_err(G8lS417ProductionHandshakeAttemptReconciliationError::S408)?;
match phase {
G8lS408LiveOfferSgiPhase::Idle => {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::Idle)
}
G8lS408LiveOfferSgiPhase::ReceiverReady => {
return Ok(G8lS417HandshakeAttemptReconciliationOutcome::Ready)
}
G8lS408LiveOfferSgiPhase::Sent | G8lS408LiveOfferSgiPhase::Failed => {}
}
let ack = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication::inspect_s414_s243_join_ack_on_cpu1()
.map_err(G8lS417ProductionHandshakeAttemptReconciliationError::S414)?;
let stale_ack_discarded = if ack.is_some() {
crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication::take_s414_s243_join_ack_on_cpu1()
.map_err(G8lS417ProductionHandshakeAttemptReconciliationError::S414)?
.ok_or(G8lS417ProductionHandshakeAttemptReconciliationError::AckDisappeared)?;
true
} else {
false
};
crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s408_live_offer_sgi_sender::rearm_s408_live_offer_sgi_sender_on_cpu1()
.map_err(G8lS417ProductionHandshakeAttemptReconciliationError::S408)?;
Ok(G8lS417HandshakeAttemptReconciliationOutcome::Rearmed {
stale_ack_discarded,
})
}
snippet sha256: 3ec275687fd1…file sha256: 3ec275687fd1…
02 · Doğrulayan test kodu
Operations komutuna bağlı focused test
tam dosyaL1–L172
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s417_handshake_attempt_reconciliation.rs::S417 handshake attempt reconciliation focused tests
#![recursion_limit = "256"]
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s244_whole_scheduler_exclusion_admission_request::{service_s245_exclusion_admission_request, G8lS245WholeSchedulerExclusionAdmissionRequestState};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s246_whole_scheduler_read_access_guard::G8lS247WholeSchedulerAccessGate;
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s402_provider_invocation_observation_publication::{service_s402_model_provider_invocation_observation_publication, G8lS402ProviderInvocationObservationState};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s404_scoped_authority_request_publication::{service_s404_model_scoped_authority_request_publication, G8lS404ScopedAuthorityRequestState};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s407_live_exclusion_offer_publication::{try_publish_s407_model_live_exclusion_offer, G8lS407LiveExclusionOfferState};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s408_live_offer_sgi_sender::{service_s408_model_live_offer_sgi_send, G8lS408LiveOfferSgiPhase, G8lS408LiveOfferSgiSenderState, S408_EXPECTED_ENABLE};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication::{service_s414_model_s243_join_ack_publication, G8lS414S243JoinAckState};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s417_handshake_attempt_reconciliation::*;
fn sent_attempt(with_ack: bool) -> (G8lS408LiveOfferSgiSenderState, G8lS414S243JoinAckState) {
let gate = G8lS247WholeSchedulerAccessGate::new();
let mut providers = G8lS245WholeSchedulerExclusionAdmissionRequestState::new();
service_s245_exclusion_admission_request(&mut providers, 0, true, true).unwrap();
let mut observations = G8lS402ProviderInvocationObservationState::new();
service_s402_model_provider_invocation_observation_publication(
&mut observations,
&gate,
&mut providers,
1,
)
.unwrap();
let mut scoped = G8lS404ScopedAuthorityRequestState::new();
service_s404_model_scoped_authority_request_publication(&mut scoped, &mut observations, 0)
.unwrap();
service_s245_exclusion_admission_request(&mut providers, 0, true, true).unwrap();
let mut offers = G8lS407LiveExclusionOfferState::new();
let offered = try_publish_s407_model_live_exclusion_offer(
&mut offers,
&gate,
&mut providers,
&mut scoped,
1,
)
.unwrap()
.unwrap();
let offer = offered.offer();
let mut sender = G8lS408LiveOfferSgiSenderState::new();
sender
.prepare_receiver(0, 1, S408_EXPECTED_ENABLE, 1, 0)
.unwrap();
service_s408_model_live_offer_sgi_send(&mut sender, 1, &offered).unwrap();
let mut acks = G8lS414S243JoinAckState::new();
if with_ack {
service_s414_model_s243_join_ack_publication(
&mut acks,
0,
offer.attempt_id,
offer.provider_request_id,
offer.exclusive_token,
gate.active_exclusive_token(),
true,
)
.unwrap();
}
offered.release().unwrap();
(sender, acks)
}
#[test]
fn constants_define_one_pre_handshake_reconciler() {
assert_eq!(S417_PRODUCTION_RECONCILIATION_CALLSITES, 1);
assert!(S417_DRAIN_BEFORE_REARM_COMPLETE);
assert!(S417_STALE_ACK_REJECTION_COMPLETE);
assert!(!S417_CPU0_PARTIAL_STATE_RECONCILIATION_COMPLETE);
}
#[test]
fn drained_attempt_discards_late_ack_and_rearms_sender() {
let (mut sender, mut acks) = sent_attempt(true);
let outcome =
service_s417_model_handshake_attempt_reconciliation(&mut sender, &mut acks, 1, None, false)
.unwrap();
assert_eq!(
outcome,
G8lS417HandshakeAttemptReconciliationOutcome::Rearmed {
stale_ack_discarded: true
}
);
assert_eq!(sender.phase(), G8lS408LiveOfferSgiPhase::ReceiverReady);
assert!(!acks.pending());
}
#[test]
fn undrained_send_receipt_blocks_rearm_and_preserves_ack() {
let (mut sender, mut acks) = sent_attempt(true);
assert_eq!(
service_s417_model_handshake_attempt_reconciliation(&mut sender, &mut acks, 1, None, true)
.unwrap(),
G8lS417HandshakeAttemptReconciliationOutcome::AwaitingSendReceiptDrain
);
assert_eq!(sender.phase(), G8lS408LiveOfferSgiPhase::Sent);
assert!(acks.pending());
}
#[test]
fn active_handshake_blocks_cleanup() {
let (mut sender, mut acks) = sent_attempt(false);
assert_eq!(
service_s417_model_handshake_attempt_reconciliation(
&mut sender,
&mut acks,
1,
Some(9),
false
)
.unwrap(),
G8lS417HandshakeAttemptReconciliationOutcome::HandshakeActive
);
assert_eq!(sender.phase(), G8lS408LiveOfferSgiPhase::Sent);
}
#[test]
fn receiver_ready_is_idempotently_ready() {
let mut sender = G8lS408LiveOfferSgiSenderState::new();
sender
.prepare_receiver(0, 1, S408_EXPECTED_ENABLE, 1, 0)
.unwrap();
let mut acks = G8lS414S243JoinAckState::new();
assert_eq!(
service_s417_model_handshake_attempt_reconciliation(&mut sender, &mut acks, 1, None, false)
.unwrap(),
G8lS417HandshakeAttemptReconciliationOutcome::Ready
);
}
#[test]
fn wrong_cpu_preserves_attempt_state() {
let (mut sender, mut acks) = sent_attempt(true);
assert_eq!(
service_s417_model_handshake_attempt_reconciliation(&mut sender, &mut acks, 0, None, false),
Err(G8lS417HandshakeAttemptReconciliationError::WrongCpu)
);
assert_eq!(sender.phase(), G8lS408LiveOfferSgiPhase::Sent);
assert!(acks.pending());
}
#[test]
fn production_orders_active_gate_drain_ack_take_then_rearm() {
let source = include_str!("../../kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s417_handshake_attempt_reconciliation.rs");
let start = source
.find("service_s417_handshake_attempt_reconciliation_on_cpu1")
.unwrap();
let body = &source[start..];
let gate = body.find("active_exclusive_token").unwrap();
let drain = body
.find("s408_production_send_receipt_pending_on_cpu1")
.unwrap();
let inspect_ack = body.find("inspect_s414_s243_join_ack_on_cpu1").unwrap();
let take_ack = body.find("take_s414_s243_join_ack_on_cpu1").unwrap();
let rearm = body
.find("rearm_s408_live_offer_sgi_sender_on_cpu1")
.unwrap();
assert!(gate < drain && drain < inspect_ack && inspect_ack < take_ack && take_ack < rearm);
}
#[test]
fn timer_chain_runs_s417_immediately_before_s416() {
let source = include_str!("../../kernel/src/arch/aarch64/exceptions.rs");
let s417 = source
.find("service_s417_handshake_attempt_reconciliation_on_cpu1")
.unwrap();
let s416 = source
.find("service_s416_production_exclusion_handshake_on_cpu1")
.unwrap();
assert!(s417 < s416);
let name = "g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s417_handshake_attempt_reconciliation";
assert!(include_str!("../../kernel/src/main.rs").contains(&format!("mod {name};")));
assert!(include_str!("../src/lib.rs").contains(&format!("pub mod {name};")));
}
snippet sha256: a49513348327…file sha256: a49513348327…
03 · Kapı kimlik kaydı
Operations sıra, kimlik ve başlık bağı
tam Operations kaydıL372–L388
website/src/lib/operations.ts::g8l-s417-handshake-attempt-reconciliation-partial
{
id: "g8l-s417-handshake-attempt-reconciliation-partial",
sequence: 417,
slug: "handshake_attempt_reconciliation",
title: "Handshake attempt reconciliation",
focusedTests: 8,
sourceBytes: 7281,
sourceSha256:
"3ec275687fd1b56a97ab5c9f020fee78eda3572759289887264dae6b6b077583",
testBytes: 7850,
testSha256:
"a49513348327dcc79dc89d39b24ccd3ecbc382a0713e0395cf4f815ddd983da5",
acceptance:
"S416 success/timeout/error attempt'i typed sonuçla uzlaştırılır; send receipt ve ACK drain edilmeden rearm açılmaz, stale ACK reddedilir.",
retainedBoundary:
"CPU0 tarafında kısmi aday/admission/join durum uzlaştırması S418'e ayrılmıştır.",
},snippet sha256: 4c36d6778ae8…file sha256: 9726dbf00f84…
Focused test komutu
CARGO_INCREMENTAL=0 cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s417_handshake_attempt_reconciliation -- --test-threads=1proof: docs/M8.1-RPi5-G8l-S417-Handshake-Attempt-Reconciliation-Proof.md
Registry schema v5 · generator
website/scripts/generate-code-gates.mjs · Tam SHA-256: 3050638b71a684d8f8f947a8a6faa237a17fa8db5dc0db04fb207b668b462af9