Skip to content

fix(rri): scope native_gate build-SHA contract to the canonical release personas - #723

Merged
100yenadmin merged 1 commit into
mainfrom
fix/rri-native-gate-scope
Jun 9, 2026
Merged

fix(rri): scope native_gate build-SHA contract to the canonical release personas#723
100yenadmin merged 1 commit into
mainfrom
fix/rri-native-gate-scope

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Jun 9, 2026

Copy link
Copy Markdown
Member

Why

The Tuesday 11-gate RRI failed native_gate on "mixed persona build_sha" — but the 5 canonical release personas (newbie/veteran/adversarial/narrative/optimizer) were all at 033e4ba with a 100/100 Mac handoff at the same SHA. The failure came from 3 extra diagnostic personas (opus-high / lean variants) that stamped stale SHAs (8afed3c/f89ce94/eabf2a3). The build-SHA gates iterated all personas, so a diagnostic variant artificially capped the release signal.

Fix

Factor the build-SHA contract into a pure, testable build_sha_evidence_gaps(persona_scores, build_sha, release_personas) scoped to REQUIRED_RELEASE_PERSONAS:

  • Diagnostic variants outside the release set no longer trip single build_sha / same-build.
  • An absent canonical persona is still caught (by the separate missing_release_personas gate).
  • A canonical persona at the wrong SHA still fails (real regression preserved).

Tests (qa/test_release_readiness_scope.py, 6)

The exact Tuesday situation (5 canonical + 3 stale variants → no gaps), clean set, a release persona at a wrong SHA (still fails), missing build_sha, no --build-sha, variants-only.

Makes the next full RRI re-run honestly count native_gate (the Mac handoff already proves the built .app at the candidate SHA). release_readiness.py is part of the scoring ruler, so this correctly re-versions it once #722 lands.

Summary by CodeRabbit

  • New Features

    • Refined build-SHA contract enforcement to validate only canonical release personas, improving release validation accuracy and preventing diagnostic persona variations from causing false validation failures.
  • Tests

    • Added test coverage validating build-SHA evidence scoping across various release scenarios including stale variants and missing persona configurations.

…se personas

native_gate's build-SHA gates (single build_sha / same-build / per-run) iterated ALL persona
scores, so an EXTRA diagnostic persona (opus-high / lean variants) at a different SHA falsely
failed native_gate even when the 5 canonical release personas + the Mac handoff were all same-build.
The Tuesday RRI hit exactly this: newbie/veteran/adversarial/narrative/optimizer all at 033e4ba,
but 3 narrative variants stamped stale SHAs (8afed3c/f89ce94/eabf2a3) -> 'mixed persona build_sha'
gap, despite a 100/100 Mac handoff at 033e4ba.

Fix: factor the contract into build_sha_evidence_gaps(persona_scores, build_sha, release_personas),
scoped to REQUIRED_RELEASE_PERSONAS. Diagnostic variants no longer trip it; an absent canonical
persona is still caught by missing_release_personas; a canonical persona at a wrong SHA still fails.
Pure fn, 6 unit tests incl. the exact Tuesday situation. Makes the next full RRI honest re:
native_gate (the Mac handoff already proves the .app at the candidate SHA).

NOTE: release_readiness.py is part of the scoring ruler — this correctly re-versions it (#722).
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors native_gate build-SHA validation in release readiness tooling. A new build_sha_evidence_gaps() helper scopes validation to the five canonical release personas, filtering out diagnostic variants from the gating decision. The main flow calls this helper, and a comprehensive test suite validates correct gap detection across clean releases, mismatches, and diagnostic-variant scenarios.

Changes

Build-SHA Scoping for Release Personas

Layer / File(s) Summary
Build-SHA validation helper and integration
qa/release_readiness.py
New build_sha_evidence_gaps() function filters persona_scores to canonical release_personas and validates per-run build-SHA values and single-SHA alignment, emitting native_gate evidence gaps for missing/mismatched/mixed build-SHA contracts. Main flow is updated to call this helper, replacing prior inline validation.
Build-SHA scoping test suite
qa/test_release_readiness_scope.py
New pytest module with module docstring, constants, helper functions, and six test cases covering: diagnostic stale-SHA variants do not trigger gaps when canonical personas match; clean releases produce no gaps; mismatched canonical personas trigger specific gap kinds; empty per-run build_sha flags gaps; missing candidate_sha flags gaps; and diagnostic-only variant sets produce no build-sha gaps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

  • electricsheephq/WorldOS#413: Introduces the RRI/gates framework to qa/release_readiness.py, establishing the baseline for native_gate enforcement logic that this PR refines.
  • electricsheephq/WorldOS#505: Adds handoff-json/native-gate/build-sha matching logic to the same file; this PR refines the build-SHA validation scoping downstream of that matching.

Poem

🐰 Five personas lined up in a row,
Build-SHAs checked from head to toe,
Diagnostics dance aside with glee,
While canonical ones must all agree!
✨ A scoped contract, clean and tight,
Release gates glow in golden light.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: scoping native_gate build-SHA contract validation to canonical release personas, which directly addresses the Tuesday RRI failure.
Description check ✅ Passed The PR description covers the problem (mixed persona build_sha failure despite canonical personas matching), the fix (scoped build_sha_evidence_gaps function), test coverage, and licensing/validation sections are present but validation checks not explicitly listed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@qa/release_readiness.py`:
- Around line 472-504: The variable build_shas is computed only inside
build_sha_evidence_gaps but main() expects it when assembling the signals (the
"run_build_shas" key), causing a NameError; fix by having
build_sha_evidence_gaps return both gaps and the scoped build_shas (e.g., return
(gaps, build_shas)) or by moving the build_shas computation into main() before
calling build_sha_evidence_gaps, and update the call site in main() to unpack
the new return value (or supply build_shas) and populate "run_build_shas":
build_shas accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e8a11958-a0af-47bb-a140-3f9630ee176a

📥 Commits

Reviewing files that changed from the base of the PR and between e2c0da4 and 5d73b08.

📒 Files selected for processing (2)
  • qa/release_readiness.py
  • qa/test_release_readiness_scope.py

Comment thread qa/release_readiness.py
Comment on lines +472 to +504
def build_sha_evidence_gaps(persona_scores: list[dict], build_sha: str,
release_personas: list[str]) -> list[dict]:
"""native_gate's build-SHA contract, SCOPED to the canonical release personas.

The release verdict is about the canonical five (REQUIRED_RELEASE_PERSONAS) + the Mac handoff,
all at ONE SHA. Extra DIAGNOSTIC personas (opus-high / lean variants outside the release set)
may run at other SHAs without invalidating the release — so they must NOT trip the "single
build_sha" / "same-build" gates. (RRI 2026-06-09: 3 narrative variants stamped stale SHAs while
newbie/veteran/adversarial/narrative/optimizer were all at the candidate SHA, falsely failing
native_gate even though the Mac handoff + the 5 release personas were same-build.)
"""
release = [p for p in persona_scores if str(p.get("persona") or "") in set(release_personas)]
build_shas = sorted({str(p["run_build_sha"]) for p in release if p.get("run_build_sha")})
missing = [p for p in release if not p.get("run_build_sha")]
gaps: list[dict] = []
if not build_sha:
gaps.append({"gate": "native_gate", "missing": "--build-sha",
"detail": "release verdict requires the measured build SHA"})
if missing:
gaps.append({"gate": "native_gate", "missing": "per-run build_sha",
"detail": "missing run build_sha for: "
+ ", ".join(str(p.get("persona") or p.get("run")) for p in missing)})
if build_sha:
mismatched = [p for p in release
if p.get("run_build_sha") and not build_sha_matches(str(p.get("run_build_sha")), build_sha)]
if mismatched:
gaps.append({"gate": "native_gate", "missing": "same-build persona evidence",
"detail": "run build_sha mismatch: "
+ ", ".join(f"{p['persona']}={p['run_build_sha']}" for p in mismatched)})
if len(build_shas) > 1:
gaps.append({"gate": "native_gate", "missing": "single build_sha",
"detail": "mixed release-persona build_sha values: " + ", ".join(build_shas)})
return gaps

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that build_shas in main() is defined elsewhere or if there's a scoping issue
rg -n 'build_shas' qa/release_readiness.py

Repository: electricsheephq/WorldOS

Length of output: 347


🏁 Script executed:

#!/bin/bash
# Inspect where build_shas is referenced around line 851 to determine scope/definition.
nl -ba qa/release_readiness.py | sed -n '820,880p'

Repository: electricsheephq/WorldOS

Length of output: 108


🏁 Script executed:

#!/bin/bash
# Output qa/release_readiness.py with line numbers for region around line 851.
# Use cat -n because nl is unavailable.
cat -n qa/release_readiness.py | sed -n '820,870p'

Repository: electricsheephq/WorldOS

Length of output: 2710


🏁 Script executed:

#!/bin/bash
cat -n qa/release_readiness.py | sed -n '620,720p'

Repository: electricsheephq/WorldOS

Length of output: 5857


Fix build_shas scoping before using it in the signals result

  • build_sha_evidence_gaps() correctly scopes the “single build SHA” checks to the canonical release personas and detects missing/mismatched/multiple SHAs within that set.
  • main() references build_shas at line 851 ("run_build_shas": build_shas,), but build_shas is only defined inside build_sha_evidence_gaps() (line 484). This will raise NameError at runtime—either compute build_shas in main() or change the helper to also return/pass build_shas back to main().
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@qa/release_readiness.py` around lines 472 - 504, The variable build_shas is
computed only inside build_sha_evidence_gaps but main() expects it when
assembling the signals (the "run_build_shas" key), causing a NameError; fix by
having build_sha_evidence_gaps return both gaps and the scoped build_shas (e.g.,
return (gaps, build_shas)) or by moving the build_shas computation into main()
before calling build_sha_evidence_gaps, and update the call site in main() to
unpack the new return value (or supply build_shas) and populate
"run_build_shas": build_shas accordingly.

@100yenadmin
100yenadmin merged commit 52e74e2 into main Jun 9, 2026
14 checks passed
100yenadmin added a commit that referenced this pull request Jun 9, 2026
…every RRI rollup (#728)

* fix(rri): restore main()'s build_shas — #723 regression that crashed every RRI rollup

#723 factored the inline build-SHA gate logic into build_sha_evidence_gaps(), which moved
the 'build_shas = sorted(...)' definition into the helper's scope but left main()'s output
reference ('run_build_shas': build_shas, line ~851) dangling -> NameError: name 'build_shas'
is not defined. This crashed the FINAL RRI rollup of EVERY release_readiness.py run (the VM
5-persona sweep @fa97b34 produced all persona/duo/ui_audit scores, then died on the rollup).

Restore the all-persona distinct-SHA set in main()'s scope (the diagnostic output field; the
native_gate CONTRACT stays release-persona-scoped via the helper — #723's intent intact).

WHY IT SHIPPED: qa/test_release_readiness.py ALREADY has 4 tests that exercise this path
(test_mixed_build_sha / test_missing_run_build_sha / test_handoff_json_must_prove_app_status_build_sha
/ test_short_build_sha_prefix) and they FAIL at fa97b34 — but #723's CI did not gate on them.
The code fix makes all 30 pass; a separate follow-up will close the CI gap so this class of
regression is caught pre-merge.

Tests: qa/test_release_readiness.py 30/30 + test_release_readiness_scope.py + release_gate_static 16/16.

* qa(scores): record v1.0.4-rc1 RRI = 3.6/10 (4/11) @fa97b34 — first comparable RC-grade verdict

The first 11-gate RRI produced by the FIXED rollup (this PR's build_shas fix). Mac part-A
handoff 100/100 + VM part-B 5-persona sweep (lean-ON), ruler-stamped sc_5ac7a1d9103c.

Verdict: NOT release-ready. PASS: native_gate(signal), arc, no_give_up, behavioral GREEN,
palette. FAIL: sat 4.8<7, zero_critical(4), story 3.9<4.3, mech 3.2<4.5 (one-duo sampling),
ui_audit FAIL. vs Tuesday 3.6: no_give_up RED->PASS, sat 4.4->4.8, behavioral GREEN — the
#719/#720 reliability fixes show; the genuine product long-poles remain.

---------

Co-authored-by: Eva <arncalso@gmail.com>
100yenadmin added a commit that referenced this pull request Jun 9, 2026
The 'test' job only collected servers/*/tests/ — qa/test_*.py was NEVER run in CI, so a
*tested* crash (#723 build_shas, caught by test_release_readiness.py's 4 build_sha tests)
merged green and shipped, surfacing only when the live RRI rollup crashed. Add a
qa-release-gate-tests job running the release-authority surface: test_release_readiness,
test_release_readiness_scope, test_scores_db_comparability, test_scores_db,
test_release_gate_static (67 tests, validated locally via the engine venv). A regression in
release_readiness.py / scores_db.py can no longer merge green.

Closes #729.

Co-authored-by: Eva <arncalso@gmail.com>
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