ASELSANMicrokernel
S415 · SOURCE-BOUND GATE EVIDENCE

S415 · Join-ACK authority release

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

S415Focused kod testiOperations id exactsource SHA exacttest target exact

operation: g8l-s415-join-ack-authority-release-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–L190
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s415_join_ack_authority_release.rs::S415 join ack authority release implementation
#![allow(unexpected_cfgs)]

//! S415 ACK-bound live-offer and provider-authority release.
//!
//! CPU1 may clear S407's offer and release its S247-backed provider authority
//! only after inspecting an exact S414 acknowledgement while that same token
//! is still active. Missing or mismatched ACKs leave both linear ownership and
//! the ACK slot untouched. S415 exposes the production consumer but does not
//! invoke it from the timer chain yet.

use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s407_live_exclusion_offer_publication::{
    G8lS407LiveExclusionOffer, G8lS407LiveExclusionOfferError,
    G8lS407OfferedScopedProviderAuthority,
};
use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s414_s243_join_ack_publication::{
    G8lS414S243JoinAck, G8lS414S243JoinAckError, G8lS414S243JoinAckState,
    S414_DIRECT_SCHEDULER_ACCESS_SITES, S414_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES,
    S414_SOURCE_AUDIT_UNITS, S414_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES,
    S414_UNROUTED_DIRECT_ACCESS_SITES,
};

pub const S415_SOURCE_AUDIT_UNITS: usize = S414_SOURCE_AUDIT_UNITS;
pub const S415_DIRECT_SCHEDULER_ACCESS_SITES: usize = S414_DIRECT_SCHEDULER_ACCESS_SITES;
pub const S415_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES: usize =
    S414_SOURCE_MODEL_COVERED_DIRECT_ACCESS_SITES;
pub const S415_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES: usize =
    S414_PRODUCTION_GUARDED_DIRECT_ACCESS_SITES;
pub const S415_UNROUTED_DIRECT_ACCESS_SITES: usize = S414_UNROUTED_DIRECT_ACCESS_SITES;
pub const S415_PRODUCTION_ACK_CONSUMER_SITES: usize = 1;
pub const S415_PRODUCTION_INVOCATION_CALLSITES: usize = 0;
pub const S415_ACK_BOUND_AUTHORITY_RELEASE_CONSTRUCTOR_COMPLETE: bool = true;
pub const S415_PRODUCTION_HANDSHAKE_INVOCATION_COMPLETE: bool = false;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct G8lS415JoinAckAuthorityReleaseReceipt {
    attempt_id: u64,
    provider_request_id: u64,
    exclusive_token: u64,
}

impl G8lS415JoinAckAuthorityReleaseReceipt {
    pub const fn attempt_id(&self) -> u64 {
        self.attempt_id
    }
    pub const fn provider_request_id(&self) -> u64 {
        self.provider_request_id
    }
    pub const fn exclusive_token(&self) -> u64 {
        self.exclusive_token
    }
    pub const fn ack_consumed(&self) -> bool {
        true
    }
    pub const fn offer_cleared(&self) -> bool {
        true
    }
    pub const fn lease_released(&self) -> bool {
        true
    }
    pub const fn is_authority(&self) -> bool {
        false
    }
    pub const fn whole_scheduler_exclusion_proven(&self) -> bool {
        false
    }
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS415JoinAckAuthorityReleaseOutcome {
    AwaitingAck,
    Released(G8lS415JoinAckAuthorityReleaseReceipt),
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum G8lS415JoinAckAuthorityReleaseError {
    WrongCpu,
    S414(G8lS414S243JoinAckError),
    AuthorityMissing,
    BindingDrift,
    GateTokenMismatch,
    AckDisappeared,
    AckDrift,
    Release(G8lS407LiveExclusionOfferError),
}

fn ack_matches_offer(
    ack: G8lS414S243JoinAck,
    offer: G8lS407LiveExclusionOffer,
    active_exclusive_token: Option<u64>,
) -> Result<(), G8lS415JoinAckAuthorityReleaseError> {
    if ack.attempt_id != offer.attempt_id
        || ack.provider_request_id != offer.provider_request_id
        || ack.exclusive_token != offer.exclusive_token
        || !ack.s187_handoff_published
        || ack.source_cpu != 0
        || ack.target_cpu != 1
        || ack.is_authority
        || ack.whole_scheduler_exclusion_proven
        || !offer.requires_live_gate_match
        || offer.is_authority
        || offer.whole_scheduler_exclusion_proven
    {
        return Err(G8lS415JoinAckAuthorityReleaseError::BindingDrift);
    }
    if active_exclusive_token != Some(offer.exclusive_token) {
        return Err(G8lS415JoinAckAuthorityReleaseError::GateTokenMismatch);
    }
    Ok(())
}

pub fn service_s415_model_join_ack_authority_release<'state, 'gate>(
    acks: &mut G8lS414S243JoinAckState,
    authority: &mut Option<G8lS407OfferedScopedProviderAuthority<'state, 'gate>>,
    caller_cpu: usize,
    active_exclusive_token: Option<u64>,
) -> Result<G8lS415JoinAckAuthorityReleaseOutcome, G8lS415JoinAckAuthorityReleaseError> {
    if caller_cpu != 1 {
        return Err(G8lS415JoinAckAuthorityReleaseError::WrongCpu);
    }
    let Some(ack) = acks
        .pending_ack(caller_cpu)
        .map_err(G8lS415JoinAckAuthorityReleaseError::S414)?
    else {
        return Ok(G8lS415JoinAckAuthorityReleaseOutcome::AwaitingAck);
    };
    let offered = authority
        .as_ref()
        .ok_or(G8lS415JoinAckAuthorityReleaseError::AuthorityMissing)?;
    ack_matches_offer(ack, offered.offer(), active_exclusive_token)?;
    let taken_ack = acks
        .take(caller_cpu)
        .map_err(G8lS415JoinAckAuthorityReleaseError::S414)?
        .ok_or(G8lS415JoinAckAuthorityReleaseError::AckDisappeared)?;
    if taken_ack != ack {
        return Err(G8lS415JoinAckAuthorityReleaseError::AckDrift);
    }
    let offered = authority
        .take()
        .ok_or(G8lS415JoinAckAuthorityReleaseError::AuthorityMissing)?;
    let released = offered
        .release()
        .map_err(G8lS415JoinAckAuthorityReleaseError::Release)?;
    Ok(G8lS415JoinAckAuthorityReleaseOutcome::Released(
        G8lS415JoinAckAuthorityReleaseReceipt {
            attempt_id: released.attempt_id(),
            provider_request_id: released.provider_request_id(),
            exclusive_token: released.exclusive_token(),
        },
    ))
}

#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn service_s415_production_join_ack_authority_release_on_cpu1(
    authority: &mut Option<crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s407_live_exclusion_offer_publication::G8lS407ProductionOfferedScopedProviderAuthority>,
) -> Result<G8lS415JoinAckAuthorityReleaseOutcome, G8lS415JoinAckAuthorityReleaseError> {
    use crate::g8l_runtime_contract::CPU1;
    if crate::percpu::try_current_cpu_id() != Some(CPU1) {
        return Err(G8lS415JoinAckAuthorityReleaseError::WrongCpu);
    }
    let Some(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(G8lS415JoinAckAuthorityReleaseError::S414)? else {
        return Ok(G8lS415JoinAckAuthorityReleaseOutcome::AwaitingAck);
    };
    let offered = authority
        .as_ref()
        .ok_or(G8lS415JoinAckAuthorityReleaseError::AuthorityMissing)?;
    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();
    ack_matches_offer(ack, offered.offer(), active_token)?;
    let taken_ack = 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(G8lS415JoinAckAuthorityReleaseError::S414)?
        .ok_or(G8lS415JoinAckAuthorityReleaseError::AckDisappeared)?;
    if taken_ack != ack {
        return Err(G8lS415JoinAckAuthorityReleaseError::AckDrift);
    }
    let offered = authority
        .take()
        .ok_or(G8lS415JoinAckAuthorityReleaseError::AuthorityMissing)?;
    let released = offered
        .release()
        .map_err(G8lS415JoinAckAuthorityReleaseError::Release)?;
    Ok(G8lS415JoinAckAuthorityReleaseOutcome::Released(
        G8lS415JoinAckAuthorityReleaseReceipt {
            attempt_id: released.attempt_id(),
            provider_request_id: released.provider_request_id(),
            exclusive_token: released.exclusive_token(),
        },
    ))
}
snippet sha256: 067e9b222394file sha256: 067e9b222394
02 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam dosyaL1–L199
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s415_join_ack_authority_release.rs::S415 join ack authority release 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, G8lS407OfferedScopedProviderAuthority};
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_s415_join_ack_authority_release::*;

fn offered<'s, 'g>(
    offers: &'s mut G8lS407LiveExclusionOfferState,
    gate: &'g G8lS247WholeSchedulerAccessGate,
    providers: &mut G8lS245WholeSchedulerExclusionAdmissionRequestState,
    scoped: &mut G8lS404ScopedAuthorityRequestState,
) -> G8lS407OfferedScopedProviderAuthority<'s, 'g> {
    try_publish_s407_model_live_exclusion_offer(offers, gate, providers, scoped, 1)
        .unwrap()
        .unwrap()
}

fn inputs() -> (
    G8lS247WholeSchedulerAccessGate,
    G8lS245WholeSchedulerExclusionAdmissionRequestState,
    G8lS404ScopedAuthorityRequestState,
) {
    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();
    (gate, providers, scoped)
}

#[test]
fn constants_keep_release_outside_s415_production_chain() {
    assert_eq!(S415_PRODUCTION_ACK_CONSUMER_SITES, 1);
    assert_eq!(S415_PRODUCTION_INVOCATION_CALLSITES, 0);
    assert!(S415_ACK_BOUND_AUTHORITY_RELEASE_CONSTRUCTOR_COMPLETE);
    assert!(!S415_PRODUCTION_HANDSHAKE_INVOCATION_COMPLETE);
}

#[test]
fn exact_ack_clears_offer_then_releases_exclusive_lease() {
    let (gate, mut providers, mut scoped) = inputs();
    let mut offers = G8lS407LiveExclusionOfferState::new();
    let offered = offered(&mut offers, &gate, &mut providers, &mut scoped);
    let offer = offered.offer();
    let mut authority = Some(offered);
    let mut acks = G8lS414S243JoinAckState::new();
    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();
    let outcome = service_s415_model_join_ack_authority_release(
        &mut acks,
        &mut authority,
        1,
        gate.active_exclusive_token(),
    )
    .unwrap();
    let G8lS415JoinAckAuthorityReleaseOutcome::Released(receipt) = outcome else {
        panic!("release expected")
    };
    assert_eq!(
        (
            receipt.attempt_id(),
            receipt.provider_request_id(),
            receipt.exclusive_token()
        ),
        (1, 2, 2)
    );
    assert!(receipt.ack_consumed() && receipt.offer_cleared() && receipt.lease_released());
    assert!(authority.is_none());
    assert!(!acks.pending());
    assert_eq!(gate.active_exclusive_token(), None);
}

#[test]
fn absent_ack_preserves_live_authority() {
    let (gate, mut providers, mut scoped) = inputs();
    let mut offers = G8lS407LiveExclusionOfferState::new();
    let mut authority = Some(offered(&mut offers, &gate, &mut providers, &mut scoped));
    let mut acks = G8lS414S243JoinAckState::new();
    assert_eq!(
        service_s415_model_join_ack_authority_release(
            &mut acks,
            &mut authority,
            1,
            gate.active_exclusive_token()
        )
        .unwrap(),
        G8lS415JoinAckAuthorityReleaseOutcome::AwaitingAck
    );
    assert!(authority
        .as_ref()
        .unwrap()
        .whole_scheduler_exclusion_proven());
    assert!(gate.active_exclusive_token().is_some());
}

#[test]
fn mismatched_ack_preserves_ack_and_authority() {
    let (gate, mut providers, mut scoped) = inputs();
    let mut offers = G8lS407LiveExclusionOfferState::new();
    let mut authority = Some(offered(&mut offers, &gate, &mut providers, &mut scoped));
    let offer = authority.as_ref().unwrap().offer();
    let mut acks = G8lS414S243JoinAckState::new();
    service_s414_model_s243_join_ack_publication(
        &mut acks,
        0,
        offer.attempt_id + 1,
        offer.provider_request_id,
        offer.exclusive_token,
        gate.active_exclusive_token(),
        true,
    )
    .unwrap();
    assert_eq!(
        service_s415_model_join_ack_authority_release(
            &mut acks,
            &mut authority,
            1,
            gate.active_exclusive_token()
        ),
        Err(G8lS415JoinAckAuthorityReleaseError::BindingDrift)
    );
    assert!(acks.pending() && authority.is_some());
}

#[test]
fn stale_active_token_preserves_both_values() {
    let (gate, mut providers, mut scoped) = inputs();
    let mut offers = G8lS407LiveExclusionOfferState::new();
    let mut authority = Some(offered(&mut offers, &gate, &mut providers, &mut scoped));
    let offer = authority.as_ref().unwrap().offer();
    let mut acks = G8lS414S243JoinAckState::new();
    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();
    assert_eq!(
        service_s415_model_join_ack_authority_release(&mut acks, &mut authority, 1, Some(999)),
        Err(G8lS415JoinAckAuthorityReleaseError::GateTokenMismatch)
    );
    assert!(acks.pending() && authority.is_some());
}

#[test]
fn source_orders_inspect_validate_take_then_release() {
    let source = include_str!("../../kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s415_join_ack_authority_release.rs");
    let start = source
        .find("service_s415_model_join_ack_authority_release")
        .unwrap();
    let body: String = source[start..].split_whitespace().collect();
    let inspect = body.find("acks.pending_ack(caller_cpu)").unwrap();
    let validate = body.find("ack_matches_offer").unwrap();
    let take_ack = body.find("acks.take(caller_cpu)").unwrap();
    let take_authority = body.find("authority.take()").unwrap();
    let release = body.find("offered.release()").unwrap();
    assert!(
        inspect < validate
            && validate < take_ack
            && take_ack < take_authority
            && take_authority < release
    );
}

#[test]
fn s415_is_registered_but_not_yet_invoked() {
    let name = "g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s415_join_ack_authority_release";
    assert!(include_str!("../../kernel/src/main.rs").contains(&format!("mod {name};")));
    assert!(include_str!("../src/lib.rs").contains(&format!("pub mod {name};")));
    assert!(!include_str!("../../kernel/src/arch/aarch64/exceptions.rs")
        .contains("service_s415_production_join_ack_authority_release_on_cpu1"));
}
snippet sha256: 6a4190c76598file sha256: 6a4190c76598
03 · Kapı kimlik kaydı

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

tam Operations kaydıL338–L354
website/src/lib/operations.ts::g8l-s415-join-ack-authority-release-partial
  {
    id: "g8l-s415-join-ack-authority-release-partial",
    sequence: 415,
    slug: "join_ack_authority_release",
    title: "Join-ACK authority release",
    focusedTests: 7,
    sourceBytes: 7950,
    sourceSha256:
      "067e9b2223945ff539e13b765d1e0cc92ef12a301c3a3d0180c575f2959388f2",
    testBytes: 8601,
    testSha256:
      "6a4190c765981ad051c37b713191b425d570f0a1c8038dd09ae276a76e1ddd61",
    acceptance:
      "CPU1 S414 ACK'i exact offered-authority ile eşler; ACK-bound release receipt üretip live S247 authority/offer sahipliğini exact-once bırakır.",
    retainedBoundary:
      "Bütün handshake'i başlatan production çağrı noktası henüz bu kapının parçası değildir.",
  },
snippet sha256: 6461b1e51cd4file 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_s415_join_ack_authority_release -- --test-threads=1
proof: docs/M8.1-RPi5-G8l-S415-Join-ACK-Authority-Release-Proof.md
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 91d38c7b6222f0b4c117be786454853543da55a160e543d9b951057cc20dcc06