jcode icon indicating copy to clipboard operation
jcode copied to clipboard

master CI is red (ratchet baselines) + Windows-only Python tooling/test bugs

Open Pahuut420 opened this issue 4 months ago • 3 comments

Summary

Two classes of problem, both verified on a Windows host with no Rust toolchain (so this covers only the Python/CI surface; no .rs touched):

1. master CI is currently RED (highest priority)

On a clean checkout of origin/master (ccf6153e), three ratchet checkers fail because merged growth outran their baselines:

  • check_code_size_budget.py
  • check_test_size_budget.py
  • check_swallowed_error_budget.py

.github/workflows/ci.yml runs all three as hard gates, so the Quality-Guardrails job fails on every push/PR. The fix is a baseline --update, the same remedy as prior commits e376f74a / 92498403.

2. Windows-only Python tooling/test bugs (invisible in Linux CI)

  • analyze_runtime_memory_log.py reads logs with path.read_text() (no encoding), so on Windows (cp1252) it crashes with UnicodeDecodeError on any UTF-8 log containing multi-byte chars (emoji/curly quotes in session titles).
  • reload_recovery_audit.py reads durable recovery *.json and session transcripts with no encoding, inside except Exception: continue, so on Windows non-ASCII recovery records are silently dropped from the audit rather than crashing.
  • test_openrelay_discovery_test.py launches its fixture server by executing a .py path directly (shebang), which raises WinError 193 on Windows, making all 3 tests unrunnable.
  • check_powershell_syntax.ps1 only scanned scripts/, leaving .github/scripts/*.ps1 (run by Windows CI) unguarded.

Fix

A branch with 6 low-risk commits (all under scripts/, 0 .rs) fixes each of the above, each with a regression test where applicable. Every non-compile CI gate verified green via a one-command reproducer. PR incoming.

Environment

Windows, cp1252 locale, no cargo/rustc (so Rust-gated jobs were not run; unaffected since no Rust source changed).

Pahuut420 avatar Jul 22 '26 07:07 Pahuut420

The ratchet baseline failures (code size, test size, swallowed-error budgets) are addressed in #550, which re-baselines all three with --update and verifies they pass on top of master.

The Windows-only Python issues are intentionally left out of that PR. We look forward to your Windows tooling PR for those.


— Jcode agent (automated triage), on behalf of @1jehuang

1jehuang avatar Jul 22 '26 10:07 1jehuang

Master's Quality Guardrails job went red again after #550 merged: the code-size and test-size baselines drifted, so every open PR failed on inherited debt.

Re-baselined in #587 (code-size: anthropic-runtime lib.rs 2439→2444, inline_interactive.rs 4047→4063; test-size: remote_startup_input_02/part_01.rs 1834→1972). All ratchets plus the full CI matrix are green on that PR.

The Windows-only Python tooling items in this issue are still open.

--- — Jcode agent (automated triage), on behalf of @1jehuang

1jehuang avatar Jul 25 '26 00:07 1jehuang

Measured today against pristine master 04c7d2b0, all four ratchets this issue names are still red, and there is now a fifth gate ahead of them. Exact counts (script exit codes included):

gate result on 04c7d2b0
check_warning_budget.sh rc=1 current=2 baseline=0
check_code_size_budget.py rc=1 45 violations (tracked=119, threshold=1200 LOC)
check_test_size_budget.py rc=1 10 violations
check_panic_budget.py rc=1 2 violations (total 166 -> 167)
check_swallowed_error_budget.py rc=1 32 violations (total 3667 -> 3730)
check_dependency_boundaries.py rc=0
check_wildcard_reexport_budget.py rc=0 (total=17)

Order inside scripts/check_guardrails.sh (Quality job) is: cargo check -> clippy -> Cargo.lock -> warning budget -> oversized-file -> oversized-test -> panic-prone -> swallowed-error -> dependency boundaries -> wildcard re-export -> onboarding invariants.

Three consequences worth recording here:

  1. A three-ratchet refresh is not enough. #1701 refreshed code-size, test-size and panic baselines, and its Quality run (job 111391674358, base 77f4f9d5) passed the warning budget (current=0), code-size, and panic, then failed on the fourth ratchet:

    Swallowed-error budget exceeded:
      - new swallowed-error-like usage: crates/jcode-tui/src/tui/app/commands_dispatch.rs (1)
      - swallowed-error-like usage grew: crates/jcode-tui/src/tui/app/helpers.rs (19 -> 30)
      ...
    Run scripts/check_swallowed_error_budget.py --update only after intentional cleanup.
    

    So check_swallowed_error_budget.py needs to be in the same change for Quality to go green.

  2. The ratchets are currently masked by the fmt gate. On master's ubuntu Quality job (run 37901522973, job 113724955675) cargo fmt --all -- --check fails first (crates/jcode-provider-openai-runtime/src/lib.rs:966, crates/jcode-tui/src/tui/app/onboarding_flow_control.rs:633,874) and the job exits before check_guardrails.sh runs at all. Fixing fmt alone (as in #1740) will surface the warning budget and the four ratchets on the next run.

  3. The warning budget now fails before any ratchet: baseline is 0 (scripts/warning_budget.txt) and master emits 2 warnings (unused std::path::PathBuf import, never-constructed Suggestions variant), platform-independent, so it is not a baseline refresh but a code fix. Platform scoping of that gate is tracked in #1177.

Recipe that reproduces a green chain from a current master base, each step verified locally against 04c7d2b0:

# 1. clear the two warnings (or --update if intentional; they are not)
bash scripts/check_warning_budget.sh
# 2. refresh every ratchet that is red, not just three
python3 scripts/check_code_size_budget.py --update
python3 scripts/check_test_size_budget.py --update
python3 scripts/check_panic_budget.py --update
python3 scripts/check_swallowed_error_budget.py --update
# 3. unblock the gate that hides all of the above
cargo fmt --all

#692 is the single-file case of the code-size ratchet (desktop2/transcript.rs). Happy to open a PR carrying exactly the recipe above if a baseline-refresh PR is wanted, but #1701 already exists, so I am not opening a competing one.

ianalitis avatar Oct 09 '26 13:10 ianalitis