ASELSANMicrokernel
S639 · SOURCE-BOUND GATE EVIDENCE

S639 · Üretim anahtarı ve capability güvenliği · R2 kabul sözleşmesi kaydı

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

S639Focused kod testiOperations id exactsource SHA exacttest target exact

operation: g8l-s639-r2-production-key-capability-contract-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–L60
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s639_r2_production_key_capability_contract.rs::S639 r2 production key capability contract implementation
#![allow(unexpected_cfgs)]
#![allow(dead_code)]

//! S639 Production key and capability security · R2 acceptance contract registration.
//!
//! Separate typed R2 gate after S638, workstream 9
//! (Production key and capability security), step 1/9.
//! It advances only the fail-closed acceptance-readiness ledger.  Supported-profile
//! runtime observations, physical observations, operator authority, external
//! acceptance and R2 field acceptance all remain explicitly absent, and the
//! module is deliberately not linked into the board-rpi5 kernel.

use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s638_r2_verified_boot_rollback_boundary::S638_SEQUENCE;
use crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s576_r2_scheduler_exclusion_runtime_contract::{
    advance_s576_to_s707_model_acceptance_gate, G8lR2AcceptanceError,
    G8lR2AcceptanceGateDescriptor, G8lR2AcceptanceLedger, G8lR2AcceptanceOutcome,
    G8lR2AcceptanceStep, S576_TO_S707_LINKED_INTO_BOARD_RPI5,
};

pub const S639_SEQUENCE: usize = 639;
pub const S639_EXPECTED_PREDECESSOR: usize = S638_SEQUENCE;
pub const S639_WORKSTREAM: usize = 9;
pub const S639_BLOCK_ORDINAL: usize = 8;
pub const S639_BLOCK_STEP_COUNT: usize = 9;
pub const S639_STEP_ORDINAL: usize = 1;
pub const S639_ACCEPTANCE_DOMAIN: &str = "production_key_capability";
pub const S639_LINKED_INTO_BOARD_RPI5: bool = S576_TO_S707_LINKED_INTO_BOARD_RPI5;
pub const S639_SUPPORTED_PROFILE_RUNTIME_OBSERVATIONS: usize = 0;
pub const S639_PHYSICAL_OBSERVATIONS: usize = 0;
pub const S639_OPERATOR_AUTHORIZATIONS: usize = 0;
pub const S639_EXTERNAL_ACCEPTANCES: usize = 0;
pub const S639_PHYSICAL_OR_DEVICE_OPERATIONS: usize = 0;
pub const S639_ACCEPTANCE_COMPLETE: bool = false;
pub const S639_R2_FIELD_ACCEPTANCE_COMPLETE: bool = false;
pub const RUNBOOK_EXECUTED_IN_S639: bool = false;

pub const S639_DESCRIPTOR: G8lR2AcceptanceGateDescriptor = G8lR2AcceptanceGateDescriptor {
    sequence: S639_SEQUENCE,
    predecessor_sequence: S639_EXPECTED_PREDECESSOR,
    workstream: S639_WORKSTREAM,
    block_ordinal: S639_BLOCK_ORDINAL,
    block_step_count: S639_BLOCK_STEP_COUNT,
    step_ordinal: S639_STEP_ORDINAL,
    acceptance_domain: S639_ACCEPTANCE_DOMAIN,
    step: G8lR2AcceptanceStep::ContractRegistration,
    runtime_evidence_required: true,
    physical_evidence_required: true,
    external_authority_required: true,
};

pub type G8lS639AcceptanceGateOutcome = G8lR2AcceptanceOutcome;
pub type G8lS639AcceptanceGateError = G8lR2AcceptanceError;

pub fn service_s639_model_r2_production_key_capability_contract(
    ledger: &mut G8lR2AcceptanceLedger,
    caller_cpu: usize,
) -> Result<G8lS639AcceptanceGateOutcome, G8lS639AcceptanceGateError> {
    advance_s576_to_s707_model_acceptance_gate(ledger, caller_cpu, S639_DESCRIPTOR)
}
snippet sha256: 1dcac81d2c84file sha256: 1dcac81d2c84
02 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam dosyaL1–L232
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s639_r2_production_key_capability_contract.rs::S639 r2 production key capability contract focused tests
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s576_r2_scheduler_exclusion_runtime_contract::{
    advance_s576_to_s707_model_acceptance_gate,
    canonical_s576_to_s707_acceptance_descriptor, G8lR2AcceptanceAnchor,
    G8lR2AcceptanceError, G8lR2AcceptanceLedger, G8lR2AcceptanceOutcome,
    S575_PHYSICAL_REPEAT_SEQUENCE, S576_CANONICAL_ANCHOR, S576_FIRST_SEQUENCE,
    S707_LAST_SEQUENCE,
};
use aselsan_microkernel_simulation::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s639_r2_production_key_capability_contract as gate;

fn r2_anchor() -> G8lR2AcceptanceAnchor {
    S576_CANONICAL_ANCHOR
}

fn acceptance_ledger() -> G8lR2AcceptanceLedger {
    G8lR2AcceptanceLedger::from_s575(1, r2_anchor()).unwrap()
}

fn advance_before(ledger: &mut G8lR2AcceptanceLedger, sequence: usize) {
    for predecessor in S576_FIRST_SEQUENCE..sequence {
        let descriptor = canonical_s576_to_s707_acceptance_descriptor(predecessor).unwrap();
        assert!(matches!(
            advance_s576_to_s707_model_acceptance_gate(ledger, 1, descriptor),
            Ok(G8lR2AcceptanceOutcome::Advanced(_))
        ));
    }
}

#[test]
fn s639_descriptor_is_exact_and_canonical() {
    assert_eq!(gate::S639_SEQUENCE, 639);
    assert_eq!(gate::S639_EXPECTED_PREDECESSOR, 638);
    assert_eq!(gate::S639_WORKSTREAM, 9);
    assert_eq!(gate::S639_BLOCK_ORDINAL, 8);
    assert_eq!(gate::S639_BLOCK_STEP_COUNT, 9);
    assert_eq!(gate::S639_STEP_ORDINAL, 1);
    assert_eq!(gate::S639_ACCEPTANCE_DOMAIN, "production_key_capability");
    assert_eq!(gate::S639_DESCRIPTOR.external_authority_required, true);
    assert!(gate::S639_DESCRIPTOR.physical_evidence_required);
    assert_eq!(
        canonical_s576_to_s707_acceptance_descriptor(639),
        Some(gate::S639_DESCRIPTOR)
    );
}

#[test]
fn s639_is_cpu1_scoped_and_waits_for_exact_predecessor() {
    let mut ledger = acceptance_ledger();
    assert_eq!(
        gate::service_s639_model_r2_production_key_capability_contract(&mut ledger, 0),
        Err(G8lR2AcceptanceError::WrongCpu)
    );
    assert_eq!(
        ledger.last_completed_sequence(),
        S575_PHYSICAL_REPEAT_SEQUENCE
    );
    if 639 == S576_FIRST_SEQUENCE {
        let future = canonical_s576_to_s707_acceptance_descriptor(577).unwrap();
        assert!(matches!(
            advance_s576_to_s707_model_acceptance_gate(&mut ledger, 1, future),
            Ok(G8lR2AcceptanceOutcome::AwaitingPredecessor {
                expected_predecessor: 576,
                observed_predecessor: 575,
                ..
            })
        ));
    } else {
        assert!(matches!(
            gate::service_s639_model_r2_production_key_capability_contract(&mut ledger, 1),
            Ok(G8lR2AcceptanceOutcome::AwaitingPredecessor {
                sequence: 639,
                expected_predecessor: 638,
                observed_predecessor: 575,
            })
        ));
    }
}

#[test]
fn s639_advances_once_with_non_acceptance_receipt() {
    let mut ledger = acceptance_ledger();
    advance_before(&mut ledger, 639);
    let G8lR2AcceptanceOutcome::Advanced(receipt) =
        gate::service_s639_model_r2_production_key_capability_contract(&mut ledger, 1).unwrap()
    else {
        panic!("S639 must advance")
    };
    assert_eq!((receipt.sequence, receipt.predecessor_sequence), (639, 638));
    assert_eq!(
        (
            receipt.workstream,
            receipt.block_ordinal,
            receipt.step_ordinal
        ),
        (9, 8, 1)
    );
    assert_eq!(receipt.acceptance_domain, "production_key_capability");
    assert_eq!(receipt.completed_block_count, 7);
    assert_eq!(receipt.anchor_sequence, 575);
    assert_eq!(receipt.physical_repeat_sequence, 575);
    assert!(receipt.source_gate_complete);
    assert!(receipt.runtime_evidence_required);
    assert!(receipt.physical_evidence_required);
    assert_eq!(receipt.new_supported_profile_runtime_observations, 0);
    assert_eq!(receipt.new_physical_observations, 0);
    assert_eq!(receipt.retained_physical_observations, 2);
    assert!(!receipt.visible_scanout_observed);
    assert!(!receipt.physical_input_observed);
    assert!(!receipt.cross_profile_coverage_complete);
    assert!(!receipt.operator_authority_received);
    assert!(!receipt.external_authority_received);
    assert!(!receipt.linked_into_board_rpi5);
    assert!(!receipt.acceptance_complete);
    assert!(!receipt.r2_field_acceptance_complete);
    assert!(!receipt.runbook_executed);
}

#[test]
fn s639_replay_is_idempotent_and_historical_reentry_does_not_mutate() {
    let mut ledger = acceptance_ledger();
    advance_before(&mut ledger, 639);
    let G8lR2AcceptanceOutcome::Advanced(receipt) =
        gate::service_s639_model_r2_production_key_capability_contract(&mut ledger, 1).unwrap()
    else {
        panic!("advance")
    };
    assert_eq!(
        gate::service_s639_model_r2_production_key_capability_contract(&mut ledger, 1),
        Ok(G8lR2AcceptanceOutcome::Retained(receipt))
    );
    if 639 < S707_LAST_SEQUENCE {
        let next = canonical_s576_to_s707_acceptance_descriptor(639 + 1).unwrap();
        assert!(matches!(
            advance_s576_to_s707_model_acceptance_gate(&mut ledger, 1, next),
            Ok(G8lR2AcceptanceOutcome::Advanced(_))
        ));
        assert_eq!(
            gate::service_s639_model_r2_production_key_capability_contract(&mut ledger, 1),
            Ok(G8lR2AcceptanceOutcome::AlreadyCompleted {
                requested_sequence: 639,
                last_completed_sequence: 639 + 1,
            })
        );
    }
}

#[test]
fn s639_open_claim_boundary_is_preserved() {
    assert_eq!(gate::S639_SUPPORTED_PROFILE_RUNTIME_OBSERVATIONS, 0);
    assert_eq!(gate::S639_PHYSICAL_OBSERVATIONS, 0);
    assert_eq!(gate::S639_OPERATOR_AUTHORIZATIONS, 0);
    assert_eq!(gate::S639_EXTERNAL_ACCEPTANCES, 0);
    assert_eq!(gate::S639_PHYSICAL_OR_DEVICE_OPERATIONS, 0);
    assert!(!gate::S639_ACCEPTANCE_COMPLETE);
    assert!(!gate::S639_R2_FIELD_ACCEPTANCE_COMPLETE);
    assert!(!gate::S639_LINKED_INTO_BOARD_RPI5);
    assert!(!gate::RUNBOOK_EXECUTED_IN_S639);
}

#[test]
fn s639_is_simulation_only_and_adds_no_production_callsite() {
    const TARGET: &str = "g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s639_r2_production_key_capability_contract";
    let source = include_str!("../../kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s639_r2_production_key_capability_contract.rs");
    let kernel_registry = include_str!("../../kernel/src/main.rs");
    let simulation_registry = include_str!("../src/lib.rs");
    let exceptions = include_str!("../../kernel/src/arch/aarch64/exceptions.rs");
    assert!(source.contains("pub const S639_DESCRIPTOR"));
    assert_eq!(
        simulation_registry
            .matches(&format!("pub mod {TARGET};"))
            .count(),
        1
    );
    assert_eq!(
        kernel_registry.matches(&format!("mod {TARGET};")).count(),
        0
    );
    assert_eq!(exceptions.matches(TARGET).count(), 0);
    assert_eq!(exceptions.matches("service_s639_").count(), 0);
}

#[test]
fn s639_descriptor_mutation_fails_before_ledger_advance() {
    let mut ledger = acceptance_ledger();
    advance_before(&mut ledger, 639);
    let before = ledger.last_completed_sequence();
    let mut drift = gate::S639_DESCRIPTOR;
    drift.block_ordinal += 1;
    assert_eq!(
        advance_s576_to_s707_model_acceptance_gate(&mut ledger, 1, drift),
        Err(G8lR2AcceptanceError::DescriptorDrift)
    );
    assert_eq!(ledger.last_completed_sequence(), before);
}

#[test]
fn s639_rejects_missing_s575_pass_premature_acceptance_and_anchor_drift() {
    let mut without_repeat: G8lR2AcceptanceAnchor = S576_CANONICAL_ANCHOR;
    without_repeat.physical_repeat_observed = false;
    assert_eq!(
        G8lR2AcceptanceLedger::from_s575(1, without_repeat).err(),
        Some(G8lR2AcceptanceError::MissingS575PhysicalPass)
    );
    let mut unauthorized: G8lR2AcceptanceAnchor = S576_CANONICAL_ANCHOR;
    unauthorized.authorization_received = false;
    assert_eq!(
        G8lR2AcceptanceLedger::from_s575(1, unauthorized).err(),
        Some(G8lR2AcceptanceError::MissingS575PhysicalPass)
    );
    let mut overclaimed: G8lR2AcceptanceAnchor = S576_CANONICAL_ANCHOR;
    overclaimed.r2_field_acceptance_complete = true;
    assert_eq!(
        G8lR2AcceptanceLedger::from_s575(1, overclaimed).err(),
        Some(G8lR2AcceptanceError::PrematureAcceptanceClaim)
    );
    let mut scanout: G8lR2AcceptanceAnchor = S576_CANONICAL_ANCHOR;
    scanout.visible_scanout_observed = true;
    assert_eq!(
        G8lR2AcceptanceLedger::from_s575(1, scanout).err(),
        Some(G8lR2AcceptanceError::PrematureAcceptanceClaim)
    );
    let mut drifted: G8lR2AcceptanceAnchor = S576_CANONICAL_ANCHOR;
    drifted.repeat_status = "RED";
    assert_eq!(
        G8lR2AcceptanceLedger::from_s575(1, drifted).err(),
        Some(G8lR2AcceptanceError::S575AnchorDrift)
    );
    assert_eq!(
        G8lR2AcceptanceLedger::from_s575(0, S576_CANONICAL_ANCHOR).err(),
        Some(G8lR2AcceptanceError::WrongCpu)
    );
}
snippet sha256: 3162c35ef774file sha256: 3162c35ef774
03 · Kapı kimlik kaydı

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

tam Operations kaydıL1541–L1564
website/src/lib/s576-s707-gate-specs.generated.ts::g8l-s639-r2-production-key-capability-contract-partial
  {
    id: "g8l-s639-r2-production-key-capability-contract-partial",
    sequence: 639,
    slug: "r2_production_key_capability_contract",
    title: "Production key and capability security · R2 acceptance contract registration",
    titleTr: "Üretim anahtarı ve capability güvenliği · R2 kabul sözleşmesi kaydı",
    workstream: 9,
    focusedTests: 8,
    sourceBytes: 2873,
    sourceSha256: "1dcac81d2c846d2f8276a4f962db9227a523feff830d27f1fd6d638b3316defa",
    testBytes: 9292,
    testSha256: "3162c35ef7740169203d76aa1d46c6a762e3b617b522004afe3eb9634942cf9d",
    blockOrdinal: 8,
    blockCount: 14,
    blockTitle: "Production key and capability security",
    blockTitleTr: "Üretim anahtarı ve capability güvenliği",
    blockStepCount: 9,
    stepOrdinal: 1,
    stepTitle: "R2 acceptance contract registration",
    stepTitleTr: "R2 kabul sözleşmesi kaydı",
    externalAuthorityRequired: true,
    acceptance: "S639, R1→R2 geçişinin 9. iş kolundaki Üretim anahtarı ve capability güvenliği bloğunun 1/9 R2 kabul sözleşmesi kaydı adımını exact S638 predecessor sonrasında ayrı typed descriptor ile fail-closed olarak kaydeder.",
    retainedBoundary: "Bu yalnız fail-closed software readiness kaydıdır; supported-profile runtime observation=0, physical observation=0, operatör yetkisi=0, dış kabul=0, acceptance_complete=false, r2_field_acceptance_complete=false, board-rpi5 kernel'e link=false ve RUNBOOK_EXECUTED_IN_S639=NO kalır. Operatör/şebeke, RF-EMC-SAR, bağımsız güvenlik veya yasal kabul bu iş kolu için zorunludur ve henüz alınmamıştır.",
  },
snippet sha256: 7f42feaeaa6afile sha256: f81b6f20f2a1
Focused test komutu
CARGO_INCREMENTAL=0 cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s639_r2_production_key_capability_contract -- --test-threads=1
proof: docs/M8.1-RPi5-G8l-S639-Production-key-and-capability-security-·-R2-acceptance-contract-registration-Proof.md
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 3050638b71a684d8f8f947a8a6faa237a17fa8db5dc0db04fb207b668b462af9