Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

Fix fork master CI rot: formatting, clippy, and stale TUI tests - #19

Merged
yjuyjuy merged 4 commits into
masterfrom
fm/fix-fork-ci
Aug 13, 2026
Merged

yjuyjuy merged 4 commits into
masterfrom
fm/fix-fork-ci

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Fork master CI had been red since the fork was created. Three independent causes, all artifacts of the messy upstream sync (#2) that took new code but left old tests and dropped upstream lint gates.

Format + Quality Guardrails (cargo fmt --all --check)

  • client_lifecycle_tests.rs landed unformatted (via the submission-nonce dedup PR). Reformatted.

Quality Guardrails (cargo clippy --all-targets --all-features -- -D warnings)

This step was previously masked behind the earlier fmt failure, so fixing fmt alone would have surfaced 16 clippy -D warnings errors. Fixed:

  • turn_notify.rs: the macOS/test-only notification helpers (notification_text, osc_safe, kitty_notification_id, kitty_notification_sequence, iterm_notification_sequence) and the base64::Engine import were ungated, so non-macOS non-test builds saw them as dead code. Gated with #[cfg(any(target_os = "macos", test))], matching upstream.
  • onboarding_graph.rs: restored the upstream #![cfg_attr(not(test), allow(dead_code))] module attribute the sync dropped; the descriptive graph's invariant helpers are exercised only by tests.
  • ui_onboarding.rs: int_plus_one (>= x + 1 -> > x).
  • remote/input_dispatch.rs: collapsed a collapsible_if into a let-chain, preserving the unconditional take() of the one-shot stash.
  • tests/e2e/test_support/mod.rs: a Request::Message constructor was missing the submission_nonce field added by the dedup change. Set None.

Build & Test (jcode-tui lib tests, all three OS)

Three stale tests:

  • test_context_command_reports_session_context_snapshot: the todo confidence renders as a categorical label now, so assert confidence plausible (score 77 -> Plausible) instead of the old confidence 77%.
  • unbiased_visual_prompt_retry_renders_complete_feedback_change: the live card (associated ToolCall) compacts verbose feedback while the restored card renders every section; assert section presence rather than the full untruncated strings the older renderer no longer emits at width 72.
  • test_prepare_messages_shows_live_batch_progress_in_chat_history: the empty-ish initial chat renders the "Updates" changelog banner, whose real entries carry PR references like (#16) that contain #1 and tripped the batch-row numbering assertion. Pin the changelog to empty for the test and restore it afterwards.

Validation

  • cargo fmt --all --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • the three previously-failing tests plus the full turn_notify suite pass (cargo test -p jcode-tui --lib -- --test-threads=1 <filters>)

Fork master CI had been red since the fork was created. Three independent
causes, all artifacts of the messy upstream sync that took new code but
left old tests and dropped upstream lint gates:

Format + Quality Guardrails (cargo fmt --all --check):
- client_lifecycle_tests.rs landed unformatted. Reformatted.

Quality Guardrails (cargo clippy --all-targets --all-features -D warnings,
previously masked behind the earlier fmt failure):
- turn_notify.rs: the macOS/test-only notification helpers
  (notification_text, osc_safe, kitty_notification_id,
  kitty_notification_sequence, iterm_notification_sequence) and the
  base64::Engine import were ungated, so non-macOS non-test builds saw
  them as dead code. Gated with #[cfg(any(target_os = "macos", test))],
  matching upstream.
- onboarding_graph.rs: restored the upstream
  #![cfg_attr(not(test), allow(dead_code))] module attribute the sync
  dropped; the descriptive graph's invariant helpers are exercised only
  by tests.
- ui_onboarding.rs: int_plus_one (`>= x + 1` -> `> x`).
- remote/input_dispatch.rs: collapsed a collapsible_if into a let-chain,
  preserving the unconditional take() of the one-shot stash.
- tests/e2e/test_support/mod.rs: a Request::Message constructor was
  missing the submission_nonce field added by the dedup change. Set None.

Build & Test (jcode-tui lib tests, all three OS):
- test_context_command_reports_session_context_snapshot: the todo
  confidence renders as a categorical label now, so assert
  "confidence plausible" (score 77 -> Plausible) instead of the old
  "confidence 77%".
- unbiased_visual_prompt_retry_renders_complete_feedback_change: the live
  card (associated ToolCall) compacts verbose feedback while the restored
  card renders every section; assert section presence rather than the
  full untruncated strings the older renderer no longer emits at width 72.
- test_prepare_messages_shows_live_batch_progress_in_chat_history: the
  empty-ish initial chat renders the "Updates" changelog banner, whose
  real entries carry PR references like (#16) that contain "#1" and
  tripped the batch-row numbering assertion. Pin the changelog to empty
  for the test and restore it afterwards.

Validated: cargo fmt --all --check clean, cargo clippy --all-targets
--all-features -D warnings clean, the three previously-failing tests plus
the turn_notify suite pass.
The oversized-file ratchet (scripts/check_code_size_budget.py) compares
production Rust file sizes against scripts/code_size_budget.json, which
was last set before the large upstream sync pulled in hundreds of commits
of file growth. The ratchet had never actually run on fork master because
the earlier formatting failure short-circuited the Quality Guardrails job
before it was reached; fixing formatting exposed ~28 stale entries.

Refresh the baseline to the current tree with `--update`, the script's
documented mechanism after an intentional large change, so the ratchet
enforces "do not grow from here" against reality instead of a
long-superseded snapshot. No production code changes; only the baseline
JSON is updated.
…fork

With formatting fixed, the Quality Guardrails job runs every ratchet step
that was previously skipped after the oversized-file step failed. The
remaining ratchet baselines were also set before the large upstream sync
and are stale against the current tree, so they too must be refreshed to
"do not regress from here":

- scripts/test_size_budget.json: oversized test-file set (37 -> 41).
- scripts/panic_budget.json: panic-prone usage (63 -> 74, inherited from
  synced upstream code, not this change).
- scripts/swallowed_error_budget.json: swallowed-error-like patterns
  (3091 -> 3209, likewise inherited from the sync).
- scripts/wildcard_reexport_budget.json: cross-crate wildcard re-exports
  (16 -> 17).

These record the sizes/counts already present in the synced tree; this
change adds no new production panic-prone or swallowed-error patterns of
its own. Only baseline JSON is updated.

Verified locally: cargo fmt --all --check, cargo clippy --all-targets
--all-features -D warnings, every ratchet script, cargo test -p jcode-sdk
parity, cargo test -p jcode-desktop2 profile::, and cargo machete all pass.
The Security preflight secret scan (scripts/security_preflight.sh) matches
`gh[pousr]_[A-Za-z0-9]{36,}` across all tracked files, and a discover.rs
test fixture used a 40-char `ghp_...` string to prove
normalize_selection_name rejects GitHub-token-shaped input. That fixture
tripped the scan, failing the Linux Build & Test job.

Shorten the fake token to `ghp_exampletoken1234`. The app's own detector
(contains_prefixed_secret) still flags it - it only needs the `ghp_`
prefix plus at least 8 characters - so the test still verifies rejection,
while the preflight regex (which requires 36+ trailing characters) no
longer matches it. No production behavior change.

Verified: the test still passes and scripts/security_preflight.sh --strict
now passes (secret scan clean, script permissions clean, cargo-audit only
reports the documented allowed advisories).
@yjuyjuy
yjuyjuy merged commit 92caaaf into master Aug 13, 2026
10 of 11 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants