Repository navigation
Conversation
`cargo fmt --all -- --check` rejected three files that landed unformatted (`tui/app/observe.rs`, `tui/mod.rs`, `tui/ui.rs`), which failed both the Format job and step 1 of the Quality Guardrails job and masked every gate behind it. `header_provider_auth_tag_prefers_app_resolved_credential_over_env` built a `ProviderAuth` claiming `has_oauth + has_api_key` while leaving `state` at `NotConfigured`. That combination cannot come out of a real probe, since `state` is the best of the available methods, and `build_auth_status_lines` filters on `state`, so the assertion saw the nothing-configured fallback inventory instead of `anthropic(oauth+key*)`. fixes #654 refs #662
`cargo clippy --all-targets --all-features -- -D warnings` failed on Linux, so every PR inherited a red Quality Guardrails job. Each finding is fixed at its cause rather than silenced: - `pinned_todos_payload` / `_rendered_hash` / `_checked_at` were orphaned by 96a4a91, which removed the trait override while the fields and their two initializers stayed behind. Nothing read them; removed. - `current_full_frame_redraw_reason` was written so `draw-stats` could explain an ongoing repaint (the existing `last_full_frame_reason` is sticky and keeps naming an expired notice), but was never wired to a call site. Now reported as `redraw_schedule.full_frame_reason`, which is what its doc comment describes. - The four copy-badge tests held a `CapturedClipboard` guard and never asserted through it, so `clipboard` was unused and `CapturedClipboard::text` was dead. They asserted only the badge and the status notice, both of which render fine when the clipboard write silently fails. They now assert the copied text, and `text()` has a real consumer. - `subscribe_nudge`'s test module sat before `impl App`, and asserted `0 + week`. Module moved to the end of the file; the duplicated fresh-state assertion replaced with the clock-skew case (`now < last_shown`) that the `saturating_sub` actually exists to handle. - Two `StatusSpinnerRenderer` fixtures assigned fields after `Default::default()`; now struct literals. Verified: `cargo clippy --all-targets --all-features -- -D warnings` clean across the workspace, `cargo fmt --all --check` clean, and the touched cohorts (`copy_badge_shortcut` 6, `subscribe_nudge::` 6, `run_shell::` 12) all pass. refs #662
…mt gate The code-size, test-size, panic-prone, and swallowed-error ratchets all failed on master. None of the growth is from this branch: CI stopped at the rustfmt step, so nothing enforced these budgets while desktop2, agent_tests, and the mermaid runtime grew past their baselines. Rebaselined last and separately so it can be dropped in favour of refactoring the specific offenders without disturbing the fmt/clippy/test fixes. Verified: `scripts/check_guardrails.sh --skip-slow` passes every gate. refs #662
…ey exists Two things made `jcode login --provider gemini-api` look like an indefinite hang when the reporter had already written `gemini.env` by hand (#660): 1. `read_secret_line` enables raw mode, which suppresses the terminal's own echo, and then echoed nothing itself. Typing or pasting a key produced no screen change at all, which is indistinguishable from a hung process. It now echoes one `*` per character and erases one on backspace, so the secret still never appears on screen but the prompt is visibly alive. 2. The prompt was identical whether or not jcode had already resolved a key, so someone who had saved one could not tell it was picked up. Login now names the existing credential and its source (the environment variable when it wins, otherwise the resolved config-file path), and says how to keep it. Both helpers live in small new modules rather than in `login.rs`, which is already over the code-size budget: `login.rs` shrinks by 12 lines here, and the extracted `next_step` hint gained tests it never had. Verified: 5 new tests (3 for the notice, 2 for the hint) pass, and the notice tests fail as expected when the lookup is stubbed back to its pre-fix "always None" behaviour. `cli::login::` cohort 18 passed. fmt, clippy, code-size and swallowed-error ratchets all clean. Note for the reporter: the underlying request still needs a live key to confirm end-to-end, which I could not do here. refs #660
CI skipped `copy_badge_shortcut` because those tests hit the real OS clipboard and fail with "Failed to copy" on a hosted runner. Four of the six already held a `CapturedClipboard` guard that routes writes into an in-process sink; they simply never asserted through it, which is what left `clipboard` unused and is fixed in the previous commit. The remaining two (`accepts_alt_uppercase_encoding`, `test_remote_...`) had no guard at all, so they really did reach for the OS clipboard. They now install the sink and assert the copied code block too. With all six isolated from the OS, the skip is no longer needed and the cohort becomes a real gate rather than a permanently-excluded one. These are the tests most worth running here, since they are the only coverage of copy-badge -> clipboard end to end. Verified with `DISPLAY`, `WAYLAND_DISPLAY` and `XDG_SESSION_TYPE` unset: 6 passed, 0 failed. The two color-dependent render tests remain skipped. refs #592, refs #662
…ly runs `remote_reasoning_delta_burst_is_paced_not_dumped` fails on unmodified master, which #662's inventory did not list, so the Linux --lib gate would still have been red after the fmt and fixture fixes. The reasoning-display default became `Off` in 166e444. With it off the `ReasoningDelta` is dropped rather than buffered, so `stream_buffer` is empty and "remainder must stay buffered for paced reveal" fails. 742a3dc wrapped the sibling reasoning-region tests in `with_reasoning_current_home` for exactly this reason but missed this one; it is now pinned the same way. Worth noting this test was not merely failing, it was untestable: under `Off` no pacing code runs at all. I confirmed it now enforces real behaviour by replacing the per-frame reveal clamp with "reveal the whole backlog", which makes it fail as intended. It passes with the clamp restored. refs #662
…ing gate passing vacuously Two more failures that only became visible once the gates ahead of them went green. **desktop2 frame budget could not build.** The `Quality Guardrails` runner has no fontconfig, and `jcode-desktop2` pulls `yeslogic-fontconfig-sys`, whose build script panics outright when `fontconfig.pc` is missing. The step failed in the build script, never reaching a single test, which is why it passes locally. Installing `libfontconfig1-dev` fixes it; `cargo check --all-targets --all-features` in the same job depends on it too. **The warning budget has been passing vacuously.** The CI log shows `scripts/check_warning_budget.sh: line 29: rg: command not found`, immediately followed by `Warning budget OK: current=0 baseline=0`. ripgrep is not installed on the runner, and the `|| printf '0'` fallback turned the missing binary into "zero warnings", so the gate has reported success regardless of the actual count for as long as it has existed. Now uses grep, which is guaranteed present. Verified the gate detects warnings again by introducing one deliberately: `Warning budget exceeded: current=1 baseline=0`, back to `current=0` once reverted. refs #662
…w sessions `/poke off` only applied to the running session, and the session default was a hardcoded `true` that ignored config entirely. Auto-poke therefore came back on after every start and reload, so anyone who finds the automatic follow-ups disruptive had to disable them again each time (#664). `features.auto_poke` (default `true`, `JCODE_AUTO_POKE` env override) now supplies that starting value, exactly as the reporter proposed. `/poke on` and `/poke off` still override it for the running session, so this only changes where the initial value comes from, and nothing changes for users who leave it alone. `FeatureConfig` moved to its own module. `config-types/src/lib.rs` is over the code-size budget, so adding a field there is exactly the growth the ratchet exists to prevent; extracting the section is the fix the ratchet is asking for, and no baseline needed refreshing. Two problems surfaced while testing, both fixed here: - `with_temp_jcode_home` restored `JCODE_HOME` but never invalidated the config cache, which is keyed by content rather than by home, so a config written inside a temp home stayed cached for later tests in the same process. That is why writing a config in one test made two unrelated auto-poke tests fail under the suite while passing in isolation (refs #596). - `config_env_fingerprint_tracks_every_apply_env_override_var` caught that `JCODE_AUTO_POKE` was missing from `CONFIG_ENV_KEYS`. Without that entry a change to the variable would not invalidate the config cache. Good gate. Verified: 5 new tests (default/parse, env override, shipped-template round-trip, session default, `/poke on` still overriding). The session-default test is mutation-checked: restoring the hardcoded `true` makes it fail. Full `scripts/check_guardrails.sh` passes every gate with no baseline changes; `jcode-tui --lib` 2058 passed / 0 failed; `jcode-base --lib config::` 70 passed. fixes #664
| #[test] | ||
| fn auto_poke_environment_override_uses_standard_boolean_values() { | ||
| let _guard = crate::storage::lock_test_env(); | ||
| let previous = std::env::var_os("JCODE_AUTO_POKE"); | ||
| crate::env::set_var("JCODE_AUTO_POKE", "off"); | ||
|
|
||
| let mut cfg = Config::default(); | ||
| cfg.apply_env_overrides(); | ||
| assert!(!cfg.features.auto_poke); | ||
|
|
||
| match previous { | ||
| Some(previous) => crate::env::set_var("JCODE_AUTO_POKE", previous), | ||
| None => crate::env::remove_var("JCODE_AUTO_POKE"), | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Env var not restored under panic in override test
JCODE_AUTO_POKE is saved and restored explicitly, but there is no RAII guard for it. If assert!(!cfg.features.auto_poke) panics, the mutex guard (_guard) releases the env lock but JCODE_AUTO_POKE=off is left in the process environment. Any subsequent test that calls Config::default() + apply_env_overrides() would then inherit auto_poke = false instead of the expected default, turning a deterministic test failure into a confusing cascade.
The same applies to default_config_file_documents_auto_poke_and_round_trips where JCODE_HOME is removed manually at the end — a panic on either assertion leaves JCODE_HOME set to the now-deleted tempdir.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/config_auto_poke_tests.rs
Line: 20-35
Comment:
**Env var not restored under panic in override test**
`JCODE_AUTO_POKE` is saved and restored explicitly, but there is no RAII guard for it. If `assert!(!cfg.features.auto_poke)` panics, the mutex guard (`_guard`) releases the env lock but `JCODE_AUTO_POKE=off` is left in the process environment. Any subsequent test that calls `Config::default()` + `apply_env_overrides()` would then inherit `auto_poke = false` instead of the expected default, turning a deterministic test failure into a confusing cascade.
The same applies to `default_config_file_documents_auto_poke_and_round_trips` where `JCODE_HOME` is removed manually at the end — a panic on either assertion leaves `JCODE_HOME` set to the now-deleted tempdir.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Greptile SummaryThis PR implements the
Confidence Score: 4/5Safe to merge; the core feature is correctly wired and all four integration points (TOML, env, cache key, session initializer) are covered. The only rough edge is in test cleanup. The feature fix is sound and the mutation-checked test confirms the bug path. with_temp_jcode_home cache invalidation fix is correct. The only concern is in config_auto_poke_tests.rs: auto_poke_environment_override_uses_standard_boolean_values restores JCODE_AUTO_POKE manually rather than with a RAII guard, so a test panic would leave the env var set for subsequent tests in the same process. Under normal green-CI operation this never triggers, but it can produce confusing cascading failures when iterating on these tests. Files Needing Attention: crates/jcode-base/src/config_auto_poke_tests.rs — env var teardown is manual and not panic-safe.
|
| Filename | Overview |
|---|---|
| crates/jcode-config-types/src/features.rs | New module extracting FeatureConfig from lib.rs, adds auto_poke field with correct default (true) and serde(default) derivation. |
| crates/jcode-base/src/config_auto_poke_tests.rs | New test file covering default, env-override, and template round-trip cases; env vars are restored manually without RAII guards so a mid-test panic leaves the process env dirty. |
| crates/jcode-tui/src/tui/app/tui_lifecycle.rs | Core bug fix: both App initializer sites changed from hardcoded true to crate::config::config().features.auto_poke. |
| crates/jcode-base/src/config.rs | JCODE_AUTO_POKE added to CONFIG_ENV_KEYS so env changes correctly invalidate the config cache. |
| crates/jcode-tui/src/tui/redraw_schedule.rs | Fixes a wasted-full-frame loop: redraw cadence now distinguishes 'donut wanted by layout' from 'donut actually published on screen' via animation_on_screen_now(); well-documented with measurement data. |
| crates/jcode-tui/src/tui/app/tests/support_failover/part_01.rs | with_temp_jcode_home now invalidates the config cache on both entry and exit; mutation-checked integration test for the session-default behavior added. |
| crates/jcode-base/src/secret_input.rs | Adds masked echo (*) per keystroke and backspace-erase sequence during raw-mode credential entry, fixing #660. |
| src/cli/login/existing_key_notice.rs | New module: surfaces a notice when an API key is already configured before prompting for a replacement, with a testable notice builder and three tests. |
| crates/jcode-tui/src/tui/app/subscribe_nudge.rs | rate_limit_notice_with_nudge moved before #[cfg(test)]; test suite gains clock-skew edge-case assertion (last_shown > now saturates to 0, no false allow). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[TOML config file\nfeatures.auto_poke] -->|toml::from_str| B[FeatureConfig\n.auto_poke]
C[JCODE_AUTO_POKE env var] -->|apply_env_overrides| B
B -->|crate::config::config| D[App::new / App::restart\nauto_poke_incomplete_todos]
D --> E{session runtime}
E -->|/poke on| F[auto_poke_incomplete_todos = true]
E -->|/poke off| G[auto_poke_incomplete_todos = false]
F --> H[auto-follow-up enabled]
G --> I[auto-follow-up disabled]
B -->|CONFIG_ENV_KEYS fingerprint| J[config cache\ninvalidation]
Prompt To Fix All With AI
### Issue 1
crates/jcode-base/src/config_auto_poke_tests.rs:20-35
**Env var not restored under panic in override test**
`JCODE_AUTO_POKE` is saved and restored explicitly, but there is no RAII guard for it. If `assert!(!cfg.features.auto_poke)` panics, the mutex guard (`_guard`) releases the env lock but `JCODE_AUTO_POKE=off` is left in the process environment. Any subsequent test that calls `Config::default()` + `apply_env_overrides()` would then inherit `auto_poke = false` instead of the expected default, turning a deterministic test failure into a confusing cascade.
The same applies to `default_config_file_documents_auto_poke_and_round_trips` where `JCODE_HOME` is removed manually at the end — a panic on either assertion leaves `JCODE_HOME` set to the now-deleted tempdir.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(config): let features.auto_poke set..." | Re-trigger Greptile
|
Closing as superseded: @1jehuang landed the same feature directly on master in f59d040 while this was in review. Same design, same I have moved the two pieces of this branch that master does not have onto #663 rather than dropping them:
Also worth flagging, and now fixed on #663: f59d040 did not add No objection to master's implementation winning; it is the better one for covering --- — Jcode agent (automated triage), on behalf of @1jehuang |
Implements the persistent auto-poke setting requested in #664, using the exact shape the reporter proposed.
Stacked on #663. This branch is based on the CI-restoration branch, because master's CI is fully red and nothing can be verified against it otherwise. Merge #663 first.
The change
features.auto_poke(defaulttrue) sets whether auto-poke starts enabled in a new session:The behavior matches the request exactly:
/poke onand/poke offstill override it for the current session.true.JCODE_AUTO_POKEworks as an env override, consistent with every other[features]flag, and the setting is documented in the shipped config template and shown in/config.The actual defect was small:
auto_poke_incomplete_todoswas initialized to a hardcodedtruein two places, so no config value could have reached it.Why
FeatureConfigmovedcrates/jcode-config-types/src/lib.rsis already over the code-size budget, so adding a field there is precisely the growth the ratchet exists to catch. Rather than refresh the baseline, I extractedFeatureConfiginto its ownfeaturesmodule. No baseline in this PR needed updating.Two problems found while testing
with_temp_jcode_homerestoredJCODE_HOMEon exit but never invalidated the config cache, which is keyed by content rather than by home. A config written inside a temp home therefore stayed cached for subsequent tests in the same process. This is why writing a config in one test madetest_auto_poke_starts_enabled_by_defaultandtest_ctrl_p_toggles_auto_poke_locallyfail under the suite while passing in isolation. Now invalidated on both entry and exit (refs TUI lib tests share process-global state, so they only pass serially #596).config_env_fingerprint_tracks_every_apply_env_override_varfailed withmissing: ["JCODE_AUTO_POKE"], catching that the new variable was absent fromCONFIG_ENV_KEYS. Without that entry, changing the env var would not have invalidated the config cache. Fixed.Verification
/poke onstill overriding.truemakes it fail, so it detects the actual bug rather than only restating the config value.scripts/check_guardrails.sh(full): all gates pass, no baseline changes.cargo test -p jcode-tui --libwith CI's skip flags: 2058 passed, 0 failed.cargo test -p jcode-base --lib config::: 70 passed.Note
The default stays
true, so this is purely opt-in. If you would rather auto-poke default to off given the reporter's description of it acting on unplanned work, that is a product call and a one-line change.--- — Jcode agent (automated triage), on behalf of @1jehuang