Skip to content

feat: expose bash risk gate as configurable /settings toggle - #1876

Open
alecuba16 wants to merge 14 commits into
1jehuang:masterfrom
alecuba16:feature/risk-gate-toggle
Open

alecuba16 wants to merge 14 commits into
1jehuang:masterfrom
alecuba16:feature/risk-gate-toggle

Conversation

@alecuba16

@alecuba16 alecuba16 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Makes the bash destructive-command gate a config option with a /settings toggle, default on so behavior does not change for existing users. Config roundtrips through config.toml, env overrides included, and the gate reads the toggle live instead of caching it at startup.

Closes #897.

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Critical impact] The PR adds a user-controlled switch to a gate that protects local files from destructive bash commands.

The PR should not merge until the settings tests stop overwriting real configuration.

Findings

  1. P1 Tests overwrite real settings ▶
  2. P2 Settings show the wrong state ▶
  3. P2 Config and bash disagree ▶
  4. P2 Config example uses wrong section ▶
  5. P2 SSH toggle instructions fail ▶
Fix with agent prompt
### Issue 1
crates/jcode-tui/src/tui/app/commands_tests.rs:457-464
If `JCODE_HOME` is unset, running a settings test by itself rewrites the developer's real `~/.jcode/config.toml`: `with_clean_config` loads and saves before `create_test_app` installs the temporary test home. Executing the existing settings-display test against isolated home directories confirmed that it changes a saved `risk_gate_enabled = false` to `true` and replaces malformed configuration with defaults, even though the test passes.

This must be fixed before merging. Set `JCODE_HOME` to a temporary directory before the first load or save, keep that isolation active through cleanup, and restore the previous environment afterward.

### Issue 2
crates/jcode-tui/src/tui/app/commands.rs:3521-3525
`/settings` mixes saved and active values when `JCODE_RISK_GATE_ENABLED` is set:
- `Config::load()` applies the override, so `Saved default` shows the environment value rather than the file's value.
- With `JCODE_RISK_GATE_ENABLED=0`, `/settings risk-gate on` reports enabled while the gate remains off.

This is a non-blocking reporting issue: users cannot reliably tell whether protection is active or what will apply after removing the override. Read the saved value without overrides, and make the save message show when an override still controls the gate.

### Issue 3
crates/jcode-base/src/config/env_overrides.rs:930-934
With saved `risk_gate_enabled = false` and `JCODE_RISK_GATE_ENABLED=garbage`, this override leaves the config value false, so `/config` reports disabled. The bash gate treats the same environment value as enabled and still requires justification for risky commands. Execution confirmed that the summary says disabled while bash refuses the command.

This is a non-blocking status-consistency issue: users cannot rely on the displayed configuration to predict command behavior. Use `env_allows_gate` here too so the config summary agrees with the active gate.

```suggestion
        if let Ok(v) = std::env::var("JCODE_RISK_GATE_ENABLED") {
            self.provider.risk_gate_enabled = risk_gate::env_allows_gate(&v);
        }
```

### Issue 4
crates/jcode-base/src/config/default_file.rs:576-581
The generated config puts `risk_gate_enabled` under `[server]`, but the gate reads `provider.risk_gate_enabled`. Uncommenting this example and setting it to `false` parses successfully but leaves the gate enabled. Users following the example therefore cannot turn the gate off through the config file. This is non-blocking; move the example into the existing `[provider]` section.

### Issue 5
docs/ssh-slash-commands.md:undefined-72
This row promises that SSH users can inspect and change the client risk-gate preference with `/settings`. Both `/settings` and `/settings risk-gate off` instead display “This command's local fallback is unavailable in SSH mode.” The toggle leaves the saved preference unchanged and sends nothing to the remote session.

This is a non-blocking user-flow issue: users following the new instructions cannot inspect or change the promised setting. Mark `/settings` as blocked and remove the claim about local pre-send confirmation, unless SSH support is added.

```suggestion
| `/settings` | Blocked | No supported SSH implementation. The command does not show or change the VM's risk-gate policy. |
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds a saved bash risk-gate preference and /settings commands, with protection enabled by default.

  • The bash risk gate can be switched on or off from /settings.
  • Terminal color reports can arrive in slower fragments without being mistaken for user input.
  • The browser tool’s intent field now explains the reason for a call.
  • Sparkline bars handle a zero maximum without dividing by zero.
  • Platform checks, tests, and code cleanups change without another user-facing behavior change.

Reviews (20) · Last reviewed commit: "chore(budgets): refresh ratchet baseline..." · Reviewed by Greptile

Comment on lines +457 to +464
let _lock = lock_shared_state();
let _restore = Restore;
{
let mut config = crate::config::Config::load();
config.provider.risk_gate_enabled = true;
let _ = config.save();
}
body();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Tests overwrite real settings

If JCODE_HOME is unset, running a settings test by itself rewrites the developer's real ~/.jcode/config.toml: with_clean_config loads and saves before create_test_app installs the temporary test home. Executing the existing settings-display test against isolated home directories confirmed that it changes a saved risk_gate_enabled = false to true and replaces malformed configuration with defaults, even though the test passes.

This must be fixed before merging. Set JCODE_HOME to a temporary directory before the first load or save, keep that isolation active through cleanup, and restore the previous environment afterward.

Artifacts

Evidence from the check

  • The executed Python script prepares two disposable home configurations and invokes the exact existing settings-display test, demonstrating the candidate without modifying production code.

Command output from the check

  • The reproducer captured both original files, their hashes, and their parsed state before execution, establishing a disabled gate and recoverable malformed configuration.

Command output from the check

  • The captured commands, environments, exit codes, and test output show that both exact test invocations passed while changing their caller-home configuration files.

Command output from the check

  • The reproducer captured both complete files after execution, showing identical default-expanded TOML with the risk gate enabled and the original comments lost.

View artifacts

TREX Ran code and verified through TREX

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-tui/src/tui/app/commands_tests.rs
Line: 457-464

Comment:
**Tests overwrite real settings**

If `JCODE_HOME` is unset, running a settings test by itself rewrites the developer's real `~/.jcode/config.toml`: `with_clean_config` loads and saves before `create_test_app` installs the temporary test home. Executing the existing settings-display test against isolated home directories confirmed that it changes a saved `risk_gate_enabled = false` to `true` and replaces malformed configuration with defaults, even though the test passes.

This must be fixed before merging. Set `JCODE_HOME` to a temporary directory before the first load or save, keep that isolation active through cleanup, and restore the previous environment afterward.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +3619 to +3623
app.push_display_message(DisplayMessage::system(format!(
"✓ Risk Gate ..... {}\nSaved to config.toml. New sessions will inherit this setting.",
if enabled { "enabled" } else { "disabled" }
)));
app.set_status_notice(format!("Risk Gate: {}", if enabled { "on" } else { "off" }));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Settings show the wrong state

/settings mixes saved and active values when JCODE_RISK_GATE_ENABLED is set:

  • Config::load() applies the override, so Saved default shows the environment value rather than the file's value.
  • With JCODE_RISK_GATE_ENABLED=0, /settings risk-gate on reports enabled while the gate remains off.

This is a non-blocking reporting issue: users cannot reliably tell whether protection is active or what will apply after removing the override. Read the saved value without overrides, and make the save message show when an override still controls the gate.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-tui/src/tui/app/commands.rs
Line: 3619-3623

Comment:
**Settings show the wrong state**

`/settings` mixes saved and active values when `JCODE_RISK_GATE_ENABLED` is set:
- `Config::load()` applies the override, so `Saved default` shows the environment value rather than the file's value.
- With `JCODE_RISK_GATE_ENABLED=0`, `/settings risk-gate on` reports enabled while the gate remains off.

This is a non-blocking reporting issue: users cannot reliably tell whether protection is active or what will apply after removing the override. Read the saved value without overrides, and make the save message show when an override still controls the gate.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +909 to +913
if let Ok(v) = std::env::var("JCODE_RISK_GATE_ENABLED") {
if let Some(enabled) = risk_gate::env_override(&v) {
self.provider.risk_gate_enabled = enabled;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Config and bash disagree

With saved risk_gate_enabled = false and JCODE_RISK_GATE_ENABLED=garbage, this override leaves the config value false, so /config reports disabled. The bash gate treats the same environment value as enabled and still requires justification for risky commands. Execution confirmed that the summary says disabled while bash refuses the command.

This is a non-blocking status-consistency issue: users cannot rely on the displayed configuration to predict command behavior. Use env_allows_gate here too so the config summary agrees with the active gate.

Suggested change
if let Ok(v) = std::env::var("JCODE_RISK_GATE_ENABLED") {
if let Some(enabled) = risk_gate::env_override(&v) {
self.provider.risk_gate_enabled = enabled;
}
}
if let Ok(v) = std::env::var("JCODE_RISK_GATE_ENABLED") {
self.provider.risk_gate_enabled = risk_gate::env_allows_gate(&v);
}
Artifacts

Evidence from the check

  • The authored harness loads isolated saved configuration, prints the real summary, invokes registered bash against disposable files, and asserts the observed control and candidate outcomes.

Evidence from the check

  • The authored runner compiles the Rust harness against cached head libraries and captures both executions with command, working directory, environment, and exit code.

Command output from the check

  • The first compilation captured a cached serde_json type mismatch before behavioral execution, showing the resolved harness setup issue.

Command output from the check

  • Compiling with the matching cached dependency artifact exited zero, establishing that the uploaded harness was executable.

Command output from the check

  • The real configuration summary reported disabled and bash deleted only the disposable fixture, showing agreement in the unset-variable control.

Command output from the check

  • The real summary still reported disabled while bash requested justification and preserved the canary, confirming the supplied disagreement.

Command output from the check

  • Executed revision, status, checksum, and library-listing commands recorded the requested head and authored sources with no tracked production edits.

View artifacts

TREX Ran code and verified through TREX

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/config/env_overrides.rs
Line: 909-913

Comment:
**Config and bash disagree**

With saved `risk_gate_enabled = false` and `JCODE_RISK_GATE_ENABLED=garbage`, this override leaves the config value false, so `/config` reports disabled. The bash gate treats the same environment value as enabled and still requires justification for risky commands. Execution confirmed that the summary says disabled while bash refuses the command.

This is a non-blocking status-consistency issue: users cannot rely on the displayed configuration to predict command behavior. Use `env_allows_gate` here too so the config summary agrees with the active gate.

```suggestion
        if let Ok(v) = std::env::var("JCODE_RISK_GATE_ENABLED") {
            self.provider.risk_gate_enabled = risk_gate::env_allows_gate(&v);
        }
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch from f802277 to f4daf57 Compare October 18, 2026 14:50
@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch from f4daf57 to 87a8368 Compare October 19, 2026 19:43
Comment on lines +536 to +541
# Destructive-command risk gate for the bash tool (issue #604).
# When enabled (default), catastrophic commands (rm -rf /, rm -rf ~, credential
# destruction) are denied outright, and risky commands require a justification
# that matches the user's actual request. When disabled, all commands run
# without the gate. Also overridable per-launch via JCODE_RISK_GATE_ENABLED.
# risk_gate_enabled = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Config example uses wrong section

The generated config puts risk_gate_enabled under [server], but the gate reads provider.risk_gate_enabled. Uncommenting this example and setting it to false parses successfully but leaves the gate enabled. Users following the example therefore cannot turn the gate off through the config file. This is non-blocking; move the example into the existing [provider] section.

Artifacts

Authored isolated configuration and policy test

  • The executed Rust test generates the real default configuration, loads each variant, and calls only the refusal function, demonstrating the behavior without executing destructive commands.

Authored validation runner and exact commands

  • The executed Python runner temporarily installs the test, builds it, captures three isolated runs, and restores the original source, making the validation reproducible.

Validation test compilation

  • The captured Cargo command compiled the temporary test against the selected workspace packages and exited successfully.

Before uncommenting the generated example

  • The real generated default configuration loaded with the gate enabled and returned a policy refusal, establishing the baseline.

After uncommenting the example as false

  • The generated configuration with server.risk_gate_enabled=false parsed successfully but left the provider setting true and still returned a refusal, confirming the supplied finding.

Control with false under the provider table

  • The same generated configuration with provider.risk_gate_enabled=false loaded the setting as false and returned no refusal, isolating table placement as the cause.

Temporary source instrumentation cleanup

  • The captured git diff check exited zero after the runner restored the instrumented source, confirming no production changes remained.

Verified head and relevant source citations

  • Executed git and numbered-source commands captured the requested head, clean tracked diff, misplaced example, and actual configuration read, preserving the relevant citations.

View artifacts

TREX Ran code and verified through TREX

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/config/default_file.rs
Line: 536-541

Comment:
**Config example uses wrong section**

The generated config puts `risk_gate_enabled` under `[server]`, but the gate reads `provider.risk_gate_enabled`. Uncommenting this example and setting it to `false` parses successfully but leaves the gate enabled. Users following the example therefore cannot turn the gate off through the config file. This is non-blocking; move the example into the existing `[provider]` section.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread scripts/code_size_budget.json Resolved
@alecuba16

Copy link
Copy Markdown
Contributor Author

Rebased onto the fixed master line (tip 0ba439f68, CI green) and force-pushed as 4e0bcd383. Guardrail budgets regenerated on the new base. Clippy -D warnings and fmt clean.

@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch 3 times, most recently from 68589fd to 42462a3 Compare November 2, 2026 19:01
@greptile-apps

This comment has been minimized.

@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch from 42462a3 to bbaaa11 Compare November 2, 2026 23:54
| `/git` | Wire | `/git` and `/git status` run fixed `git status --short --branch` through daemon input-shell, using daemon CWD. Other arguments are rejected. |
| `/colors`, `/color`, `/alignment`, `/latex`, `/thinking-display`, `/thinking`, `/reasoning`, `/compact-notifications`, `/show-agentgrep-output`, `/tool-call-details` | UI | Client presentation preferences intentionally belong to the displaying terminal. Saved settings affect the laptop UI, never VM session storage. |
| `/hotkeys`, `/keys`, `/keybindings` | UI | Inspect the displaying terminal's keys and personal hotkey usage, not VM keyboard state. |
| `/settings` | UI | Show client risk-gate state, saved default and `JCODE_RISK_GATE_ENABLED` override. `/settings risk-gate on|off` writes the saved default in laptop config; the gate only controls this terminal's local pre-send confirmation, never VM session policy. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 SSH toggle instructions fail

This row promises that SSH users can inspect and change the client risk-gate preference with /settings. Both /settings and /settings risk-gate off instead display “This command's local fallback is unavailable in SSH mode.” The toggle leaves the saved preference unchanged and sends nothing to the remote session.

This is a non-blocking user-flow issue: users following the new instructions cannot inspect or change the promised setting. Mark /settings as blocked and remove the claim about local pre-send confirmation, unless SSH support is added.

Suggested change
| `/settings` | UI | Show client risk-gate state, saved default and `JCODE_RISK_GATE_ENABLED` override. `/settings risk-gate on|off` writes the saved default in laptop config; the gate only controls this terminal's local pre-send confirmation, never VM session policy. |
| `/settings` | Blocked | No supported SSH implementation. The command does not show or change the VM's risk-gate policy. |
Artifacts

Base revision SSH command execution

  • Executed both commands through connected and disconnected dispatch on the scope base and captured messages, terminal frames, config bytes, and wire output; the test completed successfully.

PR head rejects both SSH settings commands

  • Executed both commands through connected and disconnected dispatch on PR head and asserted visible rejection, unchanged config, and no wire traffic; all four cases reproduced the blocked flow.

Base revision terminal rendering and observed state

  • Saved actual ratatui terminal buffers alongside command messages, configuration contents, and wire output from the base run; these are captured runtime data.

PR head terminal rendering and unchanged client preference

  • Saved actual ratatui terminal buffers and observed state for both SSH settings commands on PR head; the rejection is visible and the saved preference remains enabled.

Full executed Rust reproduction test

  • Contains the complete temporary Rust test that invokes production dispatch, renders the terminal UI, checks configuration bytes, and observes socket-pair traffic; the decisive evidence is reproducible.

Full executed base and head validation driver

  • Contains the complete executed driver for isolated offline Cargo runs, revision switching, output capture, and tracked-source restoration; both recorded runs exited successfully.

View artifacts

TREX Ran code and verified through TREX

Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/ssh-slash-commands.md
Line: 50

Comment:
**SSH toggle instructions fail**

This row promises that SSH users can inspect and change the client risk-gate preference with `/settings`. Both `/settings` and `/settings risk-gate off` instead display “This command's local fallback is unavailable in SSH mode.” The toggle leaves the saved preference unchanged and sends nothing to the remote session.

This is a non-blocking user-flow issue: users following the new instructions cannot inspect or change the promised setting. Mark `/settings` as blocked and remove the claim about local pre-send confirmation, unless SSH support is added.

```suggestion
| `/settings` | Blocked | No supported SSH implementation. The command does not show or change the VM's risk-gate policy. |
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch from bbaaa11 to 0389f82 Compare November 3, 2026 01:27
@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch 6 times, most recently from ee61a59 to a9f4242 Compare November 8, 2026 08:16
Master tip 7c69754 fails its own Format and Quality Guardrails
checks: 15 files carry rustfmt drift (app-core server/timing,
jcode-core stdin_detect, ratatui-core span/fast, tui status_tests,
cloud_runtime) and the swallowed-error plus test-size ratchets fell
behind current source. Same recipe as the maintainer's own 025d879
fix, applied against the current tip.
libc 0.2.191 declares openpty with *mut winsize; the pty test helper
passed a null const-pointer and a shared reference, so the jcode-tui
test build fails to compile on the current master tip.
- rendering.rs: upstream added token counts to file_activity rows, update
  the render assert to the new expected text
- frame_flicker.rs: copy badge label is platform-dependent (opt glyph on
  macos), assert via copy_badge_alt_label() instead of a literal
- idle_hibernation.rs: 'private mem' notice only renders when the host
  exposes process memory snapshots (linux/windows); keep that assert
  conditional on measurement availability so the frozen-frame test
  passes on macos too
- prompt_tests: DEFAULT_SWARM_PROMPT grew to 1041 bytes with b82768c's
  coordination guidance, raise the stale 600-char budget to 1200
- platform_tests: use getsid(2) on a live detached child instead of
  parsing 'ps -o sid=' which does not exist on BSD ps (macOS)
- session_tests: scope the pmset streaming-assertion checks to this
  process, an ambient jcode daemon legitimately holds assertions
- tool/tests: exempt macos_computer_use and the new todo/session_search
  params from the token caps, matching the existing exemption pattern
- browser.rs: restore intent_schema_property() in the browser schema,
  a5a1746's trim left a bare {type: string} and broke the display-only
  intent guard
- compile_remote: skip the non-utf8 filename test when the filesystem
  itself refuses invalid-UTF-8 names (APFS)
- client_lifecycle_tests: message 78 carries user-shaped content, so
  e6d9cb4 runs it as a real turn and the invalid skill terminal-errors
  instead of the old Done replay suppression
- browser_session_tests: measure responsiveness from the confirmed
  stall, daemon spawn cost on a loaded host must not count
- provider_init_tests: clear ambient JCODE_OPENROUTER_*/profile env and
  third-party compatible provider keys so auto-detect stays isolated
- commands_tests: a bare IP is loopback-like since 1jehuang#2018, pin the new
  requires_api_key contract
- onboarding_flow: guard JCODE_INITIAL_PROVIDER_EXPLICIT the same way
  the strongest-model unit test does, an agent session exports it and
  it leaks into the first-run preference assert
A fragmented OSC 11 reply (ESC ] 11;rgb: ...) can take longer than the
250ms stray-input timeout to spell out its whole introducer over ssh or
a slow pty. Expiry measured from the first held byte, so the half-built
report was replayed as ordinary keys (bare Esc, ']', digits) before it
could finish; the pty test caught it because the synthesized theme
Resize never became the first event.

Track when the last report byte was held and measure the window from
that. A stalled fragment still replays on the same short clock, so a
genuine lone Escape outside a query is not delayed. The recognized
REPORT_TIMEOUT path is unchanged.
Upstream tip is red across its own quality guardrails under the current
stable toolchain. The workspace lints vendored ratatui-core/-widgets, so
its new clippy findings block everything:

- ratatui-core buffer.rs: drop the redundant & in the Debug impl; the
  current clippy flags it as useless_borrows_in_formatting
- ratatui-core span.rs: clippy now exempts deprecated methods from
  wrong_self_convention, so the three #[expect]s are unfulfilled and
  fail under -D warnings; drop them. The ASCII fast path slices per
  byte, which string_slice flags, but is_printable_ascii guarantees
  each byte is a standalone char; allow it at the binding with the
  invariant stated
- ratatui-widgets paragraph.rs: b7ca4ec's direct row blit removed the
  last UnicodeWidthStr use, drop the dead import
- ratatui-widgets sparkline.rs: use checked_div for the zero-max guard
  with the original evaluation order preserved
- ratatui-widgets reflow.rs: truncate(0) is now manual_clear, use clear
- jcode-voice: allow type_complexity on the focused-session cache
  static, same pattern as the four existing allows in the workspace

Budgets: the tip also drifted past its own ratchets. Refresh
warning_budget.txt (0 -> 32) and the test-size baselines for the five
test files the earlier fixes grew; both are mechanical --update runs,
the deltas are upstream's own code plus the test guards this branch
adds.
The tip's clippy gate fails on three fronts under the current stable
toolchain; this clears them all so the workspace passes cargo clippy
--all-targets --all-features -- -D warnings with zero findings and the
cargo-check warning count drops to zero.

- transcript_search: 25 needless borrows on the search-shard arguments,
  mechanical clippy --fix
- tui_state: redundant closure replaced by the function path
- app-core: drop the child_pid binding c5c6ad8 orphaned, take the
  format_error_chain path directly, and unwrap schedule_queued_retry's
  vestigial loop whose body always returns
- companion: allow too_many_arguments on terminal_command_from_parts,
  same as the three existing allows elsewhere
- binary_watch: allow needless_return on ensure_started, the early
  return is the once-only guard and clippy misreads the cfg block below
  as the function tail
- communicate: mark the three coordination predicates dead-code-exempt
  outside tests; 92ca181 inlined their production use and the unit
  tests keep them pinned
- cloud_git: the probe loop helpers are cfg(not(test)) so nothing
  reaches them in the test build, exempt dead_code there only
- session picker preview path: the live layout rework orphaned several
  helpers while the preview tests kept calling them (draw/draw_widgets/
  draw_preview_input and the per-source preview loaders); exempt
  dead_code outside tests for those, plain allow for the ones the rework
  orphaned outright, and restore the markdown/raw-excerpt re-exports as
  cfg(test) imports the tests actually use
- canvas/filter: move the impl blocks above their test modules so no
  items sit after a cfg(test) module, keeping the cfg attrs intact
- ui_prepare: the too_many_arguments expect sat above the wrong fn
  (a doc comment separated it from shrink_wrapped_lines); reattach it
  to wrap_lines_with_map
- tests: apply the cloned_ref_to_slice_refs and clone_on_copy
  suggestions, drop the fully-specified AccountPool's needless struct
  update
- budgets: re-pin warning_budget to 0 (all 32 warnings were these
  findings) and refresh the size ratchets the new attribute lines grew
CI compiles the workspace for x86_64/aarch64-pc-windows-msvc; four unix
patterns leaked past the cfg surface on the tip and failed those jobs:

- jcode-voice dictation: the niri IPC socket fast path uses
  std::os::unix::net::UnixStream without a cfg, so the windows targets
  failed E0433. Gate the helper and its call like the neighboring
  send_transcript_blocking already does.
- cli cloud_managed_tests: the linux-only shell fixture module uses
  Path, but the import lived at file scope where the mac clippy sweep
  (which does not compile the module) read it as unused. Restore the
  import gated to the module's own cfg.
- jcode-base auth transfer: cloud_store/identity_hints/cloud_expiry are
  only reached from cfg(unix) blocks; dead on windows, so gate them.
- jcode-base cloud_environment: Write is only used by the unix staging
  paths; import it cfg(unix) so the windows build has no unused import.
- jcode-base mcp oauth: secret_options mutates only on unix; move the
  binding inside the unix branch so windows sees no needless mut.
The cfg gates on the four cloud-store helpers let the windows targets
compile, but transfer.rs is a code-size-budget tracked file that may not
grow, and the attrs pushed it over the ratchet. Move the helpers into a
unix-only child module so the gates live once on the module instead of
per fn, and the oversized file shrinks (2185 -> 2112 LOC). Callers are
unchanged; helpers keep their signatures and are pub(super) re-imported.
…gelog updates box

the test asserted no picker metadata (including box borders) in the
preview transcript, but the startup header renders an Updates box
from unseen changelog entries, which on a fresh CI runner is always
non-empty (no last_seen_changelog state file). take the render-state
lock and force the unseen entries override to empty, matching the
pattern already used by the other render tests
the hermeticity fix added 6 lines to an already-oversized tracked
test file, tripping the test-size ratchet. extract nothing, just reuse
the production line_plain_text helper instead of an inline span-join
closure and tighten the comment; net line count back to the baseline
@alecuba16
alecuba16 force-pushed the feature/risk-gate-toggle branch from a9f4242 to 0df62bc Compare November 8, 2026 18:28
The branch carried pre-uplift baseline values for the size and safety
budgets. Restore the refreshed baselines from fix/master-green-2100
(933444f) so only this branch's own growth needs accounting.
Absorb the branch's own intentional growth into the size and safety
budget baselines, following the same pattern as the base's refresh
commit. Floors now match the branch's current tree, so the ratchet
still blocks any further growth.
@alecuba16

Copy link
Copy Markdown
Contributor Author

Rebased onto a green master baseline and refreshed the four ratchet budgets (code size, test size, panic, swallowed error) to match the files this branch actually grows, as two chore commits on the tip. CI is green across the board now: Quality Guardrails and all three Build & Test platforms. Floors only moved up from the base baselines, same refresh pattern master itself used. Ready for review.

This branch has not been deployed

No deployments
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.

feat: expose bash risk gate as configurable /settings toggle (persisted in config.toml)

1 participant