ASELSANMicrokernel
S414 · SOURCE-BOUND GATE EVIDENCE

S414 · S243 join ACK publication

tam S414 implementation modülü → Operations --test hedefi ile bağlı tam focused test → ayrı Operations kaydı Bu sayfa yalnız S414 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.

S414Focused kod testiOperations id exactsource SHA exacttest target exact

operation: g8l-s414-s243-join-ack-publication-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–L187
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication.rs::S414 s243 join ack publication implementation
#![allow(unexpected_cfgs)]

//! S414 CPU0-to-CPU1 acknowledgement for the exclusion-gated S243 commit.
//!
//! Only an S413 `Published` receipt whose token is still the active S247
//! exclusive token may populate the single acknowledgement slot. The ACK is
//! copyable routing metadata, explicitly not authority or enduring exclusion
//! proof. CPU1 consumption and provider release remain later gates.

use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s413_exclusion_gated_s243_join::{
    S413_DIRECT_SCHEDULER_ACCESS_SITES,
    S413_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES, S413_SOURCE_AUDIT_UNITS,
    S413_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES, S413_UNROUTED_DIRECT_ACCESS_SITES,
};
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s413_exclusion_gated_s243_join::G8lS413ExclusionGatedJoinReceipt;

pub const S414_SOURCE_AUDIT_UNITS: usize = S413_SOURCE_AUDIT_UNITS;
pub const S414_DIRECT_SCHEDULER_ACCESS_SITES: usize = S413_DIRECT_SCHEDULER_ACCESS_SITES;
pub const S414_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES: usize =
    S413_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES;
pub const S414_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES: usize =
    S413_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES;
pub const S414_UNROUTED_DIRECT_ACCESS_SITES: usize = S413_UNROUTED_DIRECT_ACCESS_SITES;
pub const S414_ACK_SLOT_CAPACITY: usize = 1;
pub const S414_PRODUCTION_ACK_PUBLISH_CALLSITES: usize = 1;
pub const S414_PRODUCTION_ACK_CONSUMER_CALLSITES: usize = 0;
pub const S414_S243_JOIN_ACK_PUBLICATION_COMPLETE: bool = true;
pub const S414_PROVIDER_AUTHORITY_RELEASE_COMPLETE: bool = false;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct G8lS414S243JoinAck {
    pub attempt_id: u64,
    pub provider_request_id: u64,
    pub exclusive_token: u64,
    pub s187_handoff_published: bool,
    pub source_cpu: usize,
    pub target_cpu: usize,
    pub is_authority: bool,
    pub whole_scheduler_exclusion_proven: bool,
}

#[derive(Debug)]
pub struct G8lS414S243JoinAckState {
    pending: Option<G8lS414S243JoinAck>,
}

impl G8lS414S243JoinAckState {
    pub const fn new() -> Self {
        Self { pending: None }
    }
    pub const fn pending(&self) -> bool {
        self.pending.is_some()
    }
    pub fn pending_ack(
        &self,
        caller_cpu: usize,
    ) -> Result<Option<G8lS414S243JoinAck>, G8lS414S243JoinAckError> {
        if caller_cpu != 1 {
            return Err(G8lS414S243JoinAckError::WrongConsumerCpu);
        }
        Ok(self.pending)
    }
    pub fn take(
        &mut self,
        caller_cpu: usize,
    ) -> Result<Option<G8lS414S243JoinAck>, G8lS414S243JoinAckError> {
        if caller_cpu != 1 {
            return Err(G8lS414S243JoinAckError::WrongConsumerCpu);
        }
        Ok(self.pending.take())
    }
}

impl Default for G8lS414S243JoinAckState {
    fn default() -> Self {
        Self::new()
    }
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS414S243JoinAckError {
    WrongProducerCpu,
    WrongConsumerCpu,
    BindingDrift,
    GateTokenMismatch,
    JoinNotPublished,
    AckSlotOccupied,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS414S243JoinAckOutcome {
    AckPublished(G8lS414S243JoinAck),
    AckPending(G8lS414S243JoinAck),
}

pub fn service_s414_model_s243_join_ack_publication(
    state: &mut G8lS414S243JoinAckState,
    caller_cpu: usize,
    attempt_id: u64,
    provider_request_id: u64,
    exclusive_token: u64,
    active_exclusive_token: Option<u64>,
    s187_handoff_published: bool,
) -> Result<G8lS414S243JoinAckOutcome, G8lS414S243JoinAckError> {
    if caller_cpu != 0 {
        return Err(G8lS414S243JoinAckError::WrongProducerCpu);
    }
    if attempt_id == 0 || provider_request_id == 0 || exclusive_token == 0 {
        return Err(G8lS414S243JoinAckError::BindingDrift);
    }
    if active_exclusive_token != Some(exclusive_token) {
        return Err(G8lS414S243JoinAckError::GateTokenMismatch);
    }
    if !s187_handoff_published {
        return Err(G8lS414S243JoinAckError::JoinNotPublished);
    }
    let ack = G8lS414S243JoinAck {
        attempt_id,
        provider_request_id,
        exclusive_token,
        s187_handoff_published: true,
        source_cpu: 0,
        target_cpu: 1,
        is_authority: false,
        whole_scheduler_exclusion_proven: false,
    };
    if let Some(existing) = state.pending {
        return if existing == ack {
            Ok(G8lS414S243JoinAckOutcome::AckPending(existing))
        } else {
            Err(G8lS414S243JoinAckError::AckSlotOccupied)
        };
    }
    state.pending = Some(ack);
    Ok(G8lS414S243JoinAckOutcome::AckPublished(ack))
}

#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
static S414_PRODUCTION_ACK: spin::Mutex<G8lS414S243JoinAckState> =
    spin::Mutex::new(G8lS414S243JoinAckState::new());

#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn service_s414_s243_join_ack_publication_on_cpu0(
    receipt: G8lS413ExclusionGatedJoinReceipt,
) -> Result<G8lS414S243JoinAckOutcome, G8lS414S243JoinAckError> {
    use crate::g8l_runtime_contract::CPU0;
    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();
    service_s414_model_s243_join_ack_publication(
        &mut S414_PRODUCTION_ACK.lock(),
        crate::percpu::try_current_cpu_id().unwrap_or(usize::MAX),
        receipt.attempt_id(),
        receipt.provider_request_id(),
        receipt.exclusive_token(),
        active_token,
        receipt.s187_handoff_published(),
    )
    .and_then(|outcome| {
        if crate::percpu::try_current_cpu_id() == Some(CPU0) {
            Ok(outcome)
        } else {
            Err(G8lS414S243JoinAckError::WrongProducerCpu)
        }
    })
}

#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn inspect_s414_s243_join_ack_on_cpu1(
) -> Result<Option<G8lS414S243JoinAck>, G8lS414S243JoinAckError> {
    use crate::g8l_runtime_contract::CPU1;
    if crate::percpu::try_current_cpu_id() != Some(CPU1) {
        return Err(G8lS414S243JoinAckError::WrongConsumerCpu);
    }
    S414_PRODUCTION_ACK.lock().pending_ack(CPU1)
}

#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn take_s414_s243_join_ack_on_cpu1(
) -> Result<Option<G8lS414S243JoinAck>, G8lS414S243JoinAckError> {
    use crate::g8l_runtime_contract::CPU1;
    if crate::percpu::try_current_cpu_id() != Some(CPU1) {
        return Err(G8lS414S243JoinAckError::WrongConsumerCpu);
    }
    S414_PRODUCTION_ACK.lock().take(CPU1)
}
snippet sha256: e69a256c3657file sha256: e69a256c3657
02 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam dosyaL1–L107
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication.rs::S414 s243 join ack publication focused tests
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication::*;

#[test]
fn constants_define_one_cpu0_to_cpu1_ack_slot() {
    assert_eq!(S414_ACK_SLOT_CAPACITY, 1);
    assert_eq!(S414_PRODUCTION_ACK_PUBLISH_CALLSITES, 1);
    assert_eq!(S414_PRODUCTION_ACK_CONSUMER_CALLSITES, 0);
    assert!(S414_S243_JOIN_ACK_PUBLICATION_COMPLETE);
    assert!(!S414_PROVIDER_AUTHORITY_RELEASE_COMPLETE);
}

#[test]
fn exact_join_metadata_publishes_non_authoritative_ack() {
    let mut state = G8lS414S243JoinAckState::new();
    let outcome =
        service_s414_model_s243_join_ack_publication(&mut state, 0, 7, 8, 9, Some(9), true)
            .unwrap();
    let G8lS414S243JoinAckOutcome::AckPublished(ack) = outcome else {
        panic!("ack expected")
    };
    assert_eq!(
        (ack.attempt_id, ack.provider_request_id, ack.exclusive_token),
        (7, 8, 9)
    );
    assert!(ack.s187_handoff_published);
    assert!(!ack.is_authority && !ack.whole_scheduler_exclusion_proven);
}

#[test]
fn stale_token_and_unpublished_handoff_fail_before_slot_mutation() {
    let mut state = G8lS414S243JoinAckState::new();
    assert_eq!(
        service_s414_model_s243_join_ack_publication(&mut state, 0, 7, 8, 9, Some(10), true),
        Err(G8lS414S243JoinAckError::GateTokenMismatch)
    );
    assert_eq!(
        service_s414_model_s243_join_ack_publication(&mut state, 0, 7, 8, 9, Some(9), false),
        Err(G8lS414S243JoinAckError::JoinNotPublished)
    );
    assert!(!state.pending());
}

#[test]
fn exact_replay_is_idempotently_pending_but_drift_is_rejected() {
    let mut state = G8lS414S243JoinAckState::new();
    service_s414_model_s243_join_ack_publication(&mut state, 0, 7, 8, 9, Some(9), true).unwrap();
    let ack = state.pending_ack(1).unwrap().unwrap();
    assert_eq!(
        service_s414_model_s243_join_ack_publication(&mut state, 0, 7, 8, 9, Some(9), true),
        Ok(G8lS414S243JoinAckOutcome::AckPending(ack))
    );
    assert_eq!(
        service_s414_model_s243_join_ack_publication(&mut state, 0, 70, 8, 9, Some(9), true),
        Err(G8lS414S243JoinAckError::AckSlotOccupied)
    );
}

#[test]
fn cpu1_take_is_one_shot_and_wrong_cpu_non_destructive() {
    let mut state = G8lS414S243JoinAckState::new();
    service_s414_model_s243_join_ack_publication(&mut state, 0, 7, 8, 9, Some(9), true).unwrap();
    assert_eq!(
        state.take(0),
        Err(G8lS414S243JoinAckError::WrongConsumerCpu)
    );
    assert!(state.pending());
    assert!(state.take(1).unwrap().is_some());
    assert!(state.take(1).unwrap().is_none());
}

#[test]
fn production_publisher_revalidates_live_gate() {
    let source = include_str!("../../kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication.rs");
    let start = source
        .find("service_s414_s243_join_ack_publication_on_cpu0")
        .unwrap();
    let body = &source[start..];
    assert!(
        body.find("active_exclusive_token").unwrap()
            < body
                .find("service_s414_model_s243_join_ack_publication")
                .unwrap()
    );
}

#[test]
fn s409_irq_path_publishes_ack_only_from_s413_published_outcome() {
    let irq = include_str!("../../kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s409_live_offer_sgi_delivery.rs");
    let join = irq
        .find("service_s413_exclusion_gated_s243_join_on_cpu0")
        .unwrap();
    let published = irq
        .find("G8lS413ExclusionGatedJoinOutcome::Published")
        .unwrap();
    let ack = irq
        .find("service_s414_s243_join_ack_publication_on_cpu0")
        .unwrap();
    assert!(join < published && published < ack);
}

#[test]
fn s414_is_registered_separately() {
    let name = "g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication";
    assert!(include_str!("../../kernel/src/main.rs").contains(&format!("mod {name};")));
    assert!(include_str!("../src/lib.rs").contains(&format!("pub mod {name};")));
}
snippet sha256: cf00ff1df152file sha256: cf00ff1df152
03 · Kapı kimlik kaydı

Operations sıra, kimlik ve başlık bağı

tam Operations kaydıL321–L337
website/src/lib/operations.ts::g8l-s414-s243-join-ack-publication-partial
  {
    id: "g8l-s414-s243-join-ack-publication-partial",
    sequence: 414,
    slug: "s243_join_ack_publication",
    title: "S243 join ACK publication",
    focusedTests: 8,
    sourceBytes: 6884,
    sourceSha256:
      "e69a256c3657c4b5d8eb2e15ef877764f8e1c73c620ca32436feabfb43609174",
    testBytes: 4169,
    testSha256:
      "cf00ff1df1529127f516a5229a633ff5db381d83febbdea3529a8e26c8182efe",
    acceptance:
      "CPU0 exact S413 join receipt'inden capacity-one S243 join ACK yayımlar; request/token/handoff kimliği korunur.",
    retainedBoundary:
      "CPU1 ACK consumer ve provider-authority release bu kapıda çalıştırılmaz.",
  },
snippet sha256: 997ba4a9aa67file 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_s414_s243_join_ack_publication -- --test-threads=1
proof: docs/M8.1-RPi5-G8l-S414-S243-Join-ACK-Publication-Proof.md
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 3050638b71a684d8f8f947a8a6faa237a17fa8db5dc0db04fb207b668b462af9