Skip to content

feat(ci): add pre-ci discipline gate simulation#33

Closed
kenanay wants to merge 20 commits intomainfrom
fix/phase10-kernel-determinism
Closed

feat(ci): add pre-ci discipline gate simulation#33
kenanay wants to merge 20 commits intomainfrom
fix/phase10-kernel-determinism

Conversation

@kenanay
Copy link
Owner

@kenanay kenanay commented Mar 5, 2026

Summary

Add local pre-CI discipline gate simulation for fail-closed development workflow.

Changes

  • pre-ci-discipline.sh: Local advisory gate runner (4 core gates)

Purpose

Local Fail-Closed Discipline Layer

Provides fast feedback loop (~30-60s) before pushing to CI:

  • ABI stability check
  • Boundary enforcement (Ring0/Ring3 separation)
  • Hygiene validation (clean git state)
  • Constitutional compliance

Policy

  • Advisory Only: Does NOT replace CI (CI remains mandatory for merge)
  • Fail-Closed: Stops on first failure, no auto-fix
  • Manual Intervention: Developer resolves violations
  • No Bypass: No interpretation of intent

Usage

./pre-ci-discipline.sh

Expected Runtime: ~30-60s
Exit Code: 0 (pass), 2 (fail)

Development Awareness

During active development, hygiene failures may occur if changes are intentionally uncommitted. This script does NOT modify code or attempt fixes.

Constitutional Compliance

  • ✅ Rule 1 (Ring0 Policy Prohibition): Boundary gate enforces
  • ✅ Rule 2 (ABI Stability): ABI gate enforces
  • ✅ Rule 4 (Evidence Integrity): Hygiene gate enforces
  • ✅ Rule 6 (Constitutional Compliance): Constitutional gate enforces

Integration

This tool complements existing CI infrastructure:

  • Local: ./pre-ci-discipline.sh (advisory, fast feedback)
  • CI: make ci-freeze (mandatory, full validation)

CI remains the single source of truth for merge decisions.

Local fail-closed discipline layer (4 core gates).
Advisory only - CI remains mandatory for merge.

Gates:
- ABI stability
- Boundary enforcement
- Hygiene check
- Constitutional compliance

Execution: ./pre-ci-discipline.sh
Runtime: ~30-60s
Policy: Fail-closed, no auto-fix, manual intervention required
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

kenanay added 9 commits March 6, 2026 21:52
Formal contract definition between three substrate layers:
- ABDF: data substrate (typed container)
- BCIB: execution substrate (intent)
- Phase-11: verification substrate (kernel reality)

Critical matrices:
- Layer responsibilities
- Data flow boundaries
- Hash production rules
- Replay dependencies
- Type system compatibility
- Evidence export format
- Multicore coordination
- Proof composition
- CI gate validation
- Evolution policy

Status: NORMATIVE
Authority: Architecture Board

This document is binding for Phase-11 implementation.
Critical improvements:

1. Data Flow Matrix
   - Add BCIB → Phase-11 indirect flow (via kernel events)
   - Clarify ABDF → Phase-11 indirect flow (via Replay Engine)
   - Add Replay Engine as explicit intermediary

2. Hash Production Matrix
   - Add execution_trace_hash for replay verification

3. Replay Flow
   - Add explicit replay flow diagram
   - Add execution trace replay invariant

4. Type System Compatibility
   - Mark as NON-NORMATIVE EXAMPLES
   - Add normative rule: kernel MUST NOT know ABDF types
   - Add normative rule: kernel MUST NOT know BCIB semantics

5. Multicore Coordination
   - Separate DLT (ordering) from GCP (finalization)
   - Add explicit multicore architecture diagram
   - Clarify DLT assigns ltick, GCP ensures commit

Rationale:
- Kernel must remain agnostic to high-level semantics
- Replay engine is critical intermediary, not direct ABDF→Phase-11
- DLT and GCP serve distinct roles in multicore determinism

Authority: Architecture Board review
Status: NORMATIVE (except Type System examples)
Formal state machine for execution flow:
BCIB Instruction → Syscall → Kernel Event → Phase-11 Entry

Key sections:
1. State machine overview (Ring3 → Ring0 → Phase-11)
2. BCIB → Syscall mapping (DataCreate, DataQuery, UiRender, AiAsk)
3. Syscall → Kernel event mapping (all 11 syscalls)
4. Kernel event → Phase-11 entry mapping (ledger + transcript)
5. State transition rules (normal, context switch, interrupt)
6. Error handling (capability violation, ordering violation)
7. Multicore coordination (DLT + GCP)
8. Replay state machine (init, execution, verification)
9. Implementation checklist (kernel, userspace, CI)
10. Critical invariants (monotonicity, hash chain, completeness)

Purpose:
- Canonical reference for Phase-11 implementation
- Defines exact mapping between layers
- Specifies state transitions and error handling
- Provides implementation checklist

Status: NORMATIVE
Authority: Architecture Board
Prerequisite: ABDF_BCIB_PHASE11_CONTRACT_MATRIX.md
1. Contract Matrix Refinements:
   - Add ledger_root_hash to hash production matrix
   - Add Replay Engine → BCIB Runtime data flow
   - Add ledger append-only invariant
   - Add ledger_root_hash invariant

2. Phase-11 Event Taxonomy (NEW):
   - Complete event type enumeration (30+ events)
   - Event recording rules (MUST/SHOULD/MAY/MUST NOT)
   - Event specification by category (9 core events)
   - Event payload specifications
   - Event ordering rules (global, logical time, per-CPU)
   - Event filtering rules (high-frequency, syscall)
   - Event validation rules (ledger, transcript)
   - Event serialization format (binary, JSON lines)
   - CI gate validation (completeness, integrity)
   - Implementation checklist
   - Critical invariants

Purpose:
- Canonical event specification for Phase-11
- Defines which kernel events produce ledger/transcript
- Specifies exact event payload formats
- Provides validation and serialization rules

Status: NORMATIVE
Authority: Architecture Board

This completes the Phase-11 architectural foundation:
- Contract Matrix: layer boundaries
- State Machine: execution flow
- Event Taxonomy: event specification
Comprehensive requirements for Phase-11 verification substrate.

Core Components:
- Decision Ledger (P11-02): kernel decision record
- Execution Transcript (P11-13): kernel reality record
- Event Ordering (P11-10): deterministic sequencing
- Replay Engine (P11-04): verification system
- DLT (P11-14): multicore logical time
- GCP (P11-15): multicore commit protocol
- Proof Manifest (P11-11): cryptographic sealing

12 Requirements with 115 acceptance criteria covering:
- Ledger/transcript recording
- Hash chain integrity
- Deterministic ordering
- Replay verification
- Multicore coordination
- Proof generation
- Evidence export
- CI gate integration
- Constitutional compliance
- Backward compatibility

Prerequisites:
- ABDF_BCIB_PHASE11_CONTRACT_MATRIX.md
- RUNTIME_STATE_MACHINE.md
- Phase 10-A2 (Ring3 execution proof)

Status: Draft (awaiting design document)
- Normalize event naming to AY_EVT_* across taxonomy/contract/spec docs
- Add AY_EVT_MAX bound to taxonomy enum
- Resolve taxonomy contradiction: record requirements are per event class
- Canonicalize ledger hashing:
  payload_hash = H(normalized_payload)
  entry_hash = H(prev_hash || payload_hash)
- Align evidence policy with repo behavior:
  CI artifact export required, git commit optional
- Clarify requirements scope:
  BCIB plan identity is in-scope; BCIB runtime redesign out-of-scope
- Update requirements issue range to P11-01..P11-18
- Add design.md with normative event pipeline, data model, replay identity binding,
  CI gate mapping, implementation order, and closure criteria
- Add tasks.md with issue-aligned workstreams, branch names, gate mapping,
  evidence outputs, dependency order, and per-PR validation checklist
- Enforce 1 PR = 1 invariant execution policy
- Add Created/Maintained/Edited metadata with Kenan AY to spec docs
- Add mandatory documentation synchronization policy and PR Documentation Delta rule
- Add language selection policy (C/Rust/Bash/Python) by subsystem suitability
- Add explicit security and performance verification controls
- Add owner assignment (Kenan AY) to Phase-11 task entries
- Extend requirements with Security/Performance and Documentation Sync requirements
…ive gate

- add normative MAILBOX_PROTOCOL_V2_CAPABILITIES contract
- add fail-closed capability envelope checks in Ring0 mailbox validation
- standardize reject aliases: REJ_BAD_SIG/REJ_CAP_MISSING/REJ_BUDGET_EXCEEDED/REJ_INVALID_PID
- add ci-gate-mailbox-capability-negative with negative_matrix evidence
- wire freeze/local-freeze gate chain and evidence/report exports
- sync phase11 requirements/design/tasks + taxonomy/contract-matrix updates

Validation:
- python3 -m unittest tools/ci/test_validate_mailbox_capability_negative.py (PASS)
- make ci-gate-mailbox-capability-negative RUN_ID=local-p11-34-clean (PASS)
- make ci-gate-scheduler-mailbox-phase10c RUN_ID=local-p11-34-regression (PASS)

Notes:
- v1 mailbox ABI layout freeze preserved (size/offset/alignment unchanged)
- local performance gate remains host-baseline mismatch (Darwin arm64 vs CI baseline)
@kenanay
Copy link
Owner Author

kenanay commented Mar 6, 2026

Phase-11 update: P11-01 (#34) implementation added in commit 2db4fc8 on this branch.

What was added:

  • Normative mailbox capability contract doc
  • Ring0 fail-closed capability envelope validation
  • New negative gate: ci-gate-mailbox-capability-negative
  • Evidence contract: negative_matrix.json/report.json/violations.txt
  • Synced specs and architecture docs (requirements/design/tasks/taxonomy/contract matrix)

Validation:

  • unittest PASS (tools/ci/test_validate_mailbox_capability_negative.py)
  • ci-gate-mailbox-capability-negative PASS
  • scheduler-mailbox-phase10c regression PASS

Note: local performance gate mismatch is environment baseline related (Darwin arm64 vs CI baseline), not a mailbox capability regression.

kenanay added 10 commits March 6, 2026 23:59
…es (#43)

Bootstrap ETI layer for Phase-11 verification substrate.

Introduces CI-side ETI materialization and validation gates:
- ci-gate-eti-sequence
- ci-gate-ledger-eti-binding
- ci-gate-transcript-integrity

Artifacts:
- eti_transcript.jsonl/.bin
- binding_report.json
- violations.txt
- eti_diff.txt (bootstrap placeholder)

Scope:
ETI is materialized deterministically from Phase10-A2 evidence.
Kernel hot-path ETI emission is intentionally deferred.

Documentation:
tasks.md, design.md, requirements.md updated to reflect bootstrap semantics.
…gates

Add explicit missing_or_empty checks before validator execution:
- gate_ledger_eti_binding.sh: decision_ledger.jsonl, eti_transcript.jsonl
- gate_transcript_integrity.sh: eti_transcript.jsonl, eti_transcript.bin

This prevents validator-level crashes and keeps gate semantics fail-closed (exit 3 on usage/input errors).
@kenanay
Copy link
Owner Author

kenanay commented Mar 14, 2026

Closing as stale/superseded. The substantive work on this branch is already covered by newer active branches, primarily PR #54.

@kenanay kenanay closed this Mar 14, 2026
@kenanay kenanay deleted the fix/phase10-kernel-determinism branch March 14, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant