diff --git a/.trinity/seals/crons_t27os-night-loop.json b/.trinity/seals/crons_t27os-night-loop.json index 3b51b31189..c5416c9c04 100644 --- a/.trinity/seals/crons_t27os-night-loop.json +++ b/.trinity/seals/crons_t27os-night-loop.json @@ -1,5 +1,5 @@ { - "built_by": "t27c-bootstrap@0.5.2+ef47c143a", + "built_by": "t27c-bootstrap@0.5.2+86928cb1c", "closure": [ { "spec": "specs/claw/recipes.t27", @@ -15,23 +15,23 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:ab4c6790448d2c77b91ad1ed54104f92ca692b0caf0c75eeaaceb61aa0830bac", - "gen_hash_rust": "sha256:ee428f110dd1779725d4978f0206f7a1e027c63f5508c156cb014444814d4de2", - "gen_hash_verilog": "sha256:caa0d9fcf7b02b52170aae637f11fbce21db06cba13661b7f6d244a0b687d6f3", - "gen_hash_zig": "sha256:98ec872d26398ae81d3513aa106f7d875ed01d6a2c861146e4d6e6a08f6eac82", + "gen_hash_c": "sha256:1dff33abeef280ddf96705eab6bd1aba3b3975b71b9f60bed449840ccc3dc53d", + "gen_hash_rust": "sha256:bf6df17477b840c8ce4c15acfa519d16202367d75312a6371bdc9895f29f8feb", + "gen_hash_verilog": "sha256:e97a5ffbd58ffc668bd55d3737a24d17c6244f0e5f5800d09da4821302c98e44", + "gen_hash_zig": "sha256:0321bc8e7ad432c3725a8549231ff209eb2378627b7ad5fc9fc86b1d317cb3d7", "module": "t27os-night-loop", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-24T20:57:41Z", + "sealed_at": "2026-10-24T21:34:34Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:e6220787243b0d44d898946e6e803c4c6cbef43eef75139b0caa3bc919aa8e40", + "spec_hash": "sha256:01b78d9c83659ab3aa056a7cbf9a077b9313b6ee398b5fb69b68b9cd2ec74b52", "spec_path": "specs/crons/t27os-night-loop.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 36, - "total": 36, + "passed": 42, + "total": 42, "vacuous": 0 }, "toolchain": { diff --git a/specs/crons/t27os-night-loop.t27 b/specs/crons/t27os-night-loop.t27 index 33df6cf0ed..08cb0f5031 100644 --- a/specs/crons/t27os-night-loop.t27 +++ b/specs/crons/t27os-night-loop.t27 @@ -15,7 +15,8 @@ // word "partial" -- the board auto-closed 2026-10-23 23:13Z, reopened by hand the same night), // AUDIT-STEP (the wasm32 mine grep -> gHashTag/t27#11840), // PR-GATE-STEP (dispatch the T27 OS lab per open PR specs/t27os head, one run in flight, the rest -// queued; read receipts back from runs/), UI-HEALTH-STEP (the app process alive and the hive feed +// queued; read receipts back from runs/), MERGE-STEP (after PR-GATE, one merge per tick, lowest first: +// an armed MERGEABLE PR or the loop's own CLEAN night/ PR with a lab receipt; merge_step_verdict), UI-HEALTH-STEP (the app process alive and the hive feed // fresh, else rebuild and relaunch; the verdict is ui_health below), SWEEP-STEP (every 6th tick, own merged lanes only, t27os#8), // TASK-PICK-STEP (after the PR gate, before the claim; the law is night_take.t27 may_retake), // RECEIPT-COMMENT-STEP (a receipt comment carries the disclosure footer; the law is disclosure.t27), @@ -238,6 +239,74 @@ test at_most_one_rebuild_per_tick { assert SD_MAX_PER_TICK == 1 and SD_BRANCH_PREFIX == "night/"; } +// ---- MERGE-STEP: armed PRs and the loop's own green night PRs, one per tick (t27#12111) ---- +// The tick-128 retrospective: the prompt's MERGE-STEP read only armed PRs, so #12106 -- a night/ PR, +// lab-green on both legs -- sat about 25 minutes CLEAN and unarmed, and tick 127 found nothing armed +// and stopped. The loop's own night/ PR with a lab receipt for its head is as ready as an armed one. +// Still one merge per tick, lowest number first (the CI queue starves when master moves in big +// steps); DIRTY is its owner's to rebase; BLOCKED/queued armed PRs stay with GitHub auto-merge; +// another actor's unarmed lane and any draft are never merged by the loop. + +pub const MS_WAIT : u32 = 0; +pub const MS_MERGE : u32 = 1; +pub const MS_SKIP_DIRTY : u32 = 2; +pub const MS_LEAVE_GITHUB : u32 = 3; +pub const MS_NOT_OURS : u32 = 4; +/// At most this many merges per tick. +pub const MS_MAX_PER_TICK : u32 = 1; + +/// armed: auto-merge is on. night_branch: the head starts SD_BRANCH_PREFIX. draft: the PR is a draft. +/// clean: mergeStateStatus is CLEAN or MERGEABLE. dirty: it is DIRTY. receipt: a lab receipt exists +/// for the head sha. lower_ready: a lower-numbered PR already got MS_MERGE this tick. merged: merges +/// done this tick. +pub fn merge_step_verdict(armed: bool, night_branch: bool, draft: bool, clean: bool, dirty: bool, receipt: bool, lower_ready: bool, merged: u32) -> u32 { + if (draft) { return MS_NOT_OURS; } + if (armed == false and night_branch == false) { return MS_NOT_OURS; } + if (dirty) { return MS_SKIP_DIRTY; } + if (clean == false) { + if (armed) { return MS_LEAVE_GITHUB; } + return MS_WAIT; + } + if (armed == false and receipt == false) { return MS_WAIT; } + if (lower_ready or merged >= MS_MAX_PER_TICK) { return MS_WAIT; } + return MS_MERGE; +} + +test the_12106_case_is_merged_by_the_tick { + // night/126 PR, unarmed, CLEAN, lab 36/36 both legs on its head + assert merge_step_verdict(false, true, false, true, false, true, false, 0) == MS_MERGE; +} + +test an_armed_mergeable_pr_is_still_merged { + assert merge_step_verdict(true, false, false, true, false, false, false, 0) == MS_MERGE; +} + +test negative_control_another_actors_clean_unarmed_lane_is_not_ours { + // lane/analog-adc-mutants-12096 (#12108): CLEAN, unarmed, not night/ + assert merge_step_verdict(false, false, false, true, false, true, false, 0) == MS_NOT_OURS; + // a night draft is STALE-DRAFT-STEP's, never merged here + assert merge_step_verdict(false, true, true, true, false, true, false, 0) == MS_NOT_OURS; +} + +test a_night_pr_without_a_receipt_or_still_running_waits { + assert merge_step_verdict(false, true, false, true, false, false, false, 0) == MS_WAIT; + // #12107 at tick 129: UNSTABLE, one check pending + assert merge_step_verdict(false, true, false, false, false, true, false, 0) == MS_WAIT; +} + +test dirty_is_skipped_and_blocked_armed_is_left_to_github { + assert merge_step_verdict(true, false, false, false, true, false, false, 0) == MS_SKIP_DIRTY; + assert merge_step_verdict(false, true, false, false, true, true, false, 0) == MS_SKIP_DIRTY; + assert merge_step_verdict(true, false, false, false, false, false, false, 0) == MS_LEAVE_GITHUB; +} + +test one_merge_per_tick_lowest_number_first { + // a higher-numbered candidate waits when a lower one is already chosen, or one merge is done + assert merge_step_verdict(false, true, false, true, false, true, true, 0) == MS_WAIT; + assert merge_step_verdict(true, false, false, true, false, false, false, 1) == MS_WAIT; + assert MS_MAX_PER_TICK == 1; +} + // ---- LAND-STEP reference: a local Refs #N (t27#11873) ---- // The L1 gates (check-linked-issue, Check L1 TRACEABILITY) match // (Closes|Fixes|Resolves|Refs|Updates)\s*#[0-9]+ in every non-merge commit message. A cross-repo