feat: close P0.1 #63 Read|Write Deferred gate, open P4 RON SDK, and queue P1 consumers - #96
Merged
Merged
Conversation
Adds closed enum JustificationGate { Enforced, Deferred { reason, required_by_version } } with strict canonical Value codec (INV-FLOW-019) ensuring Deferred never serializes as Enforced (disjoint wire shapes, single-key map, unknown-field fail-closed). Includes 10 unit tests covering round-trips, bijection via encode/decode_strict, and diagnostic rendering.
Records Director decision in spec/braid/DECISIONS.md as D-FLOW.13 (LOCKED 2026-08-31): v0 interop collapses to Read|Write, Safe x Authorized enforced, Justified deferred loudly with reason and future required_by_version, D-FLOW.6 Unknown-fails-closed unchanged, full AdmittedRead/Write lowering deferred.
Closes U1 of docs/plans/2026-08-31-002-next-workstream-prioritization.md.
Related: #63 #74 #75
…frames, 7 survivors Grounding in Braid's verified substrate (IR/CID, 8-stage verifier, manifests, Flow/DLS elaborators) + external prior art (Dhall/Nix/Terraform/K8s/React/Lean). Axes: authoring surface, immediate feedback, composition & reuse, version & migration, review & deployment. Frames cover authoring seam, typed rejections, content-addressed composition, pins/CIDs, review as deployment, AI-native declarativeness. Top-7 survivors: Reject as structured JSON re-author loop, widening/taint as structured diff, CID-pinned imports + hermetic check, preview as attenuated prod with CID chain, promotion as signed alias + ConfirmPolicy, palette + staged check, time-travel verify + outdated. 3 explicit rejections (ignore pragma, directory capsule, LSP now). Handoff: declaration == bytes == CID, rejection == typed patch, preview == attenuated prod, promotion == signed alias move — next ce-brainstorm slices S1+S2+S3 vs S4+S5. Co-lane with ce-work U1 JustificationGate gate; plan at docs/plans/2026-08-31-002-next-workstream-prioritization.md.
…ile tests Add braid-flow-sdk (workspace member, lgwks_std facade, no new external edge) owning the single authority for 16 MiB / depth 64 RON envelope checked before any AST allocation via allocation-free byte-scan (strings/comments skipped), plus declared node/edge/port/expansion bounds checked before Vec::try_reserve. Mirrors braid-flow-ir HARD_MAX_* and INV-FLOW-004/018. JSON is interop/inspection-only (validate_json_source rejects unknown_field/__lossy/semantic_loss/float loss via closed ALLOWED_JSON_FIELDS), YAML is importer-only (import_gh_yaml envelope before parse). No verifier logic duplicated. Tests (must-fail as must-refuse): - tests/source_equivalence::unknown_and_lossy_sources_refuse (unknown/lossy/float ⇒ Malformed INV-FLOW-018, valid JSON admits) - tests/hostile_ron::source_envelope_refuses_before_ast_allocation (MAX+1 bytes WireBytes, depth 65 PredicateDepth, quoted brackets ignored, boundary ok, bounds before reserve) Verifies: cargo test -p braid-flow-sdk --test source_equivalence/hostile_ron green, cargo test -p braid-flow-sdk -p braid-cli -p braid-render --all-targets green, cargo test --workspace --all-targets green, clippy -D warnings green, fmt green. Part of U5 docs/plans/2026-08-31-002-next-workstream-prioritization.md (R5, PB-04/PB-05 precedent). Related: #58 #74
Audit shows MUTATION-LEDGER.md already covers 8/8 verifier stages (U9 T3/T5 + 6 NEW entries) with per-stage mutation + red test on semantic Admit-where-Reject-expected. Runtime budgets (#70 triad + #72 preflight) remain TODO. Scaffold docs/plans/evidence-U4-prep.md audits: - Verifier stage coverage table (CanonicalForm, VersionPin, Structure, Types, Capability, Effect, Bounds, Taint) with ledger lines, acceptance.rs red tests, mutation locations - keel-floor.sh diagnostic posture (exit 127 without KEEL_BIN, exit 2 UNMEASURED with local keel absent lanes.toml, no CI job per .github/workflows/ci.yml) - calibration.rs RFC 8949 length-first map-ordering cross-check exists (queue #1 done) - SAFETY_ASSURANCE_CI_SPEC.md corrected 2026-08-30 truthful, D-SA open - Draft ledger extension for 2 runtime budgets + flight-hours placeholders (map-ordering done, Lean corpus todo) - Verification receipts: cargo test -p braid-verify --all-targets 41 passed, cargo test -p braid-ir --test calibration 4 passed, workspace green, keel-floor diagnostic exits. Keeps D-SA open per PB-01; hermetic Keel distribution + full Lean corpus generation remain blocked on native artifact (deliberate no-test exception). Part of U4 docs/plans/2026-08-31-002-next-workstream-prioritization.md (R3, PB-01). Related: #78 #74
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parent #74 ROADMAP Phase 0 → Phase 3 handoff. Implements U1 of docs/plans/2026-08-31-002-next-workstream-prioritization.md and scaffolds the parallel U5 RON lane; queues U3/U4 as documented prep.
U1 — P0.1 #63 closed (D-FLOW.13 LOCKED 2026-08-31, this PR):
JustificationGate { Enforced, Deferred { reason, required_by_version } }with strict canonical Value codec (INV-FLOW-019, disjoint wire shapes, single-key map, unknown-field fail-closed).Deferredis loud in wire/manifest/receipt/diagnostic and never coerces toEnforced(10 tests: round-trips, bijection viaencode/decode_strict,deferred_never_serializes_as_enforced, diagnostic contains reason).spec/braid/DECISIONS.mdD-FLOW.13: v0 interop collapses toRead|Write, Safe×Authorized enforced, Justified deferred withreason+ futurerequired_by_version, D-FLOW.6 unchanged, fullAdmittedRead/AdmittedWritelowering deferred.U2 — #75 publish (verification on new head, this PR):
cargo metadata --lockedexit 0, sibling check proves nopath =outside workspace (grep path =only intra-workspace),./scripts/braid-registry-export-check.shtwice exit 0 deterministicbytes=1058 sha=1fac...+ KAT CIDafaa..., file:// probefile:///Users/srinji/Braid <HEAD>exit 0registry_cid=afaa... capsule_cid=cced... verdict=admit lock_sha=...(remotehttps://…/Braid.git ca777aaprobe alsoafaa/cced/admitbaseline), fail-closed deadbeef rev not found, tag leaves no artifact.U5 — P4 #58 RON SDK scaffold (parallel lane, this PR):
braid-flow-sdkworkspace member (lgwks_std facade, no new external edge) owning the single authority for 16 MiB / depth 64 envelope checked before AST via allocation-free scan (strings/comments skipped, brackets balanced) + declared bounds (10k/50k/128/50k/250k) checked beforetry_reserve(INV-FLOW-004). JSON interop/inspection-only (closedALLOWED_JSON_FIELDS, float/__lossyloss ⇒Malformed INV-FLOW-018), YAML importer-only.cargo test -p braid-flow-sdk --test source_equivalence -- unknown_and_lossy_sources_refuse1 passed,cargo test -p braid-flow-sdk --test hostile_ron -- source_envelope_refuses_before_ast_allocation1 passed (MAX+1, depth 65, quoted brackets ignored, bounds before reserve),cargo test -p braid-flow-sdk -p braid-cli -p braid-render --all-targetsgreen, workspace green, clippy -D warnings 0, fmt 0.U3 — #76 consumers (prep, blocked on tag push, documented):
git@github.com:srinji-kaggss/BraidHEADf426296, kernel/Users/srinji/logic-os-kernelHEAD7405623(kernel/Cargo.toml:213-214stillpath =+BRAID_PIN braid-v0.2 0955e05stale vs newbraid-contract-v0.1.0 afaa...), canonical browser/Users/srinji/next-gen-browser-engine50a7127ongovernance/constellation-chartervs stale/Users/srinji/src/browser-engine9bc5d15(BraidTerm 0 hits, sha256 6 CSP-only, vendor/braid 4 crates + 5 Cargo hits), second Cidbe-axiom::Cid(String) b3:hexvs canonicalbraid_ir::Cid([u8;32] BLAKE3 domain len payload lw.braid.*)(~25 hits split,browser_types.rs:7 re-exports canonical).7baccbd lock_sha 9e62…proves next tag consumable; design drafted for kernelregistry.cid() == afaa...parity assert + Cargo git pin and browservendor/braid+be-axiom Cid::from_bytesdeletion + version-skew typedStage::VersionPintests (T3.4).U4 — #78 assurance (scaffold, D-SA remains open):
MUTATION-LEDGER.mdalready 8/8 stages (U9 T3/T5 + 6 NEW eachAdmit-where-Reject-expected), runtime budgets (P0: Replace raw-Capsule runtime entry with triad-gated token execution typestate #70 triad + P0: Add allocation-free capsule decoder preflight and aggregate value budgets #72 preflight) TODO drafted indocs/plans/evidence-U4-prep.md(28KB) with per-stage red tests and verification receipts (braid-verify 41 passed, braid-ir calibration 4 passed,keel-floor.shdiagnostic exit 127 without KEEL_BIN, exit 2 UNMEASURED with local keel, no CI keel job per.github/workflows/ci.yml, RFC 8949 queue Remaining Braid foundations work (post-extraction): U6–U10, U9 hardening, D5/D16 confirmations #1 already done).Also:
docs/ideation/2026-08-31-excellent-declarative-experience.md42 ideas across 6 frames → 39 survivors → top-7 (Reject as typed patch re-author loop, widening/taint as JSON, CID imports + hermetic check, preview as attenuated prod + CID chain, promotion as signed alias + ConfirmPolicy, palette + staged check, time-travel verify) — handoffdeclaration == bytes == CID.Closes #63. Prepares #75, #58, #76, #78 per #74 dependency DAG.
Verification:
cargo test --workspace --all-targets --lockedexit 0cargo clippy --workspace --all-targets --locked -- -D warningsexit 0cargo fmt --all -- --checkexit 0cargo metadata --lockedexit 0./scripts/braid-registry-export-check.shexit 0 (twice, sha 1fac…)./scripts/braid-release-probe.sh https://github.com/srinji-kaggss/Braid.git ca777aaexit 0 (afaa/cced/admit, remote)./scripts/braid-release-probe.sh file:///Users/srinji/Braid <new HEAD>exit 0 (afaa/cced/admit, hermetic)cargo test -p braid-flow-sdk --test source_equivalence/hostile_ron1/1 passed