Keep Rust PRs green with a minimal CI gate

Add a focused GitHub Actions workflow for pull requests into main plus
manual dispatch. The workflow checks workspace formatting and runs the
rusty-claude-cli crate tests so we get a real signal on the active Rust
surface without widening scope into a full matrix.

Because the workspace was not rustfmt-clean, include the formatting-only
updates needed for the new fmt gate to pass immediately.

Constraint: Keep scope to a fast, low-noise Rust PR gate
Constraint: CI should validate formatting and rusty-claude-cli without expanding to full workspace coverage
Rejected: Full workspace test or clippy matrix | too broad for the one-hour shipping window
Rejected: Add fmt CI without reformatting the workspace | the new gate would fail on arrival
Confidence: high
Scope-risk: narrow
Directive: Keep this workflow focused unless release requirements justify broader coverage
Tested: cargo fmt --all -- --check
Tested: cargo test -p rusty-claude-cli
Tested: YAML parse of .github/workflows/rust-ci.yml via python3 + PyYAML
Not-tested: End-to-end execution on GitHub-hosted runners
This commit is contained in:
Yeachan-Heo
2026-04-02 07:31:56 +00:00
parent fd0a299e19
commit aea6b9162f
6 changed files with 103 additions and 38 deletions

View File

@@ -30,12 +30,11 @@ use plugins::{PluginManager, PluginManagerConfig};
use render::{MarkdownStreamState, Spinner, TerminalRenderer};
use runtime::{
clear_oauth_credentials, generate_pkce_pair, generate_state, load_system_prompt,
parse_oauth_callback_request_target, resolve_sandbox_status, save_oauth_credentials,
ApiClient, ApiRequest, AssistantEvent, CompactionConfig, ConfigLoader, ConfigSource,
ContentBlock, ConversationMessage, ConversationRuntime, MessageRole, PromptCacheEvent,
OAuthAuthorizationRequest, OAuthConfig,
OAuthTokenExchangeRequest, PermissionMode, PermissionPolicy, ProjectContext, RuntimeError,
Session, TokenUsage, ToolError, ToolExecutor, UsageTracker,
parse_oauth_callback_request_target, resolve_sandbox_status, save_oauth_credentials, ApiClient,
ApiRequest, AssistantEvent, CompactionConfig, ConfigLoader, ConfigSource, ContentBlock,
ConversationMessage, ConversationRuntime, MessageRole, OAuthAuthorizationRequest, OAuthConfig,
OAuthTokenExchangeRequest, PermissionMode, PermissionPolicy, ProjectContext, PromptCacheEvent,
RuntimeError, Session, TokenUsage, ToolError, ToolExecutor, UsageTracker,
};
use serde_json::json;
use tools::GlobalToolRegistry;
@@ -3146,7 +3145,8 @@ fn build_runtime(
allowed_tools: Option<AllowedToolSet>,
permission_mode: PermissionMode,
progress_reporter: Option<InternalPromptProgressReporter>,
) -> Result<ConversationRuntime<AnthropicRuntimeClient, CliToolExecutor>, Box<dyn std::error::Error>> {
) -> Result<ConversationRuntime<AnthropicRuntimeClient, CliToolExecutor>, Box<dyn std::error::Error>>
{
let (feature_config, tool_registry) = build_runtime_plugin_state()?;
let mut runtime = ConversationRuntime::new_with_features(
session,
@@ -3286,7 +3286,6 @@ impl AnthropicRuntimeClient {
progress_reporter,
})
}
}
fn resolve_cli_auth_source() -> Result<AuthSource, Box<dyn std::error::Error>> {
@@ -4023,7 +4022,9 @@ fn push_prompt_cache_record(client: &AnthropicClient, events: &mut Vec<Assistant
}
}
fn prompt_cache_record_to_runtime_event(record: api::PromptCacheRecord) -> Option<PromptCacheEvent> {
fn prompt_cache_record_to_runtime_event(
record: api::PromptCacheRecord,
) -> Option<PromptCacheEvent> {
let cache_break = record.cache_break?;
Some(PromptCacheEvent {
unexpected: cache_break.unexpected,
@@ -4245,18 +4246,17 @@ fn print_help() {
#[cfg(test)]
mod tests {
use super::{
describe_tool_progress, filter_tool_specs, format_compact_report, format_cost_report,
format_internal_prompt_progress_line, format_model_report, format_model_switch_report,
format_permissions_report,
create_managed_session_handle, describe_tool_progress, filter_tool_specs,
format_compact_report, format_cost_report, format_internal_prompt_progress_line,
format_model_report, format_model_switch_report, format_permissions_report,
format_permissions_switch_report, format_resume_report, format_status_report,
format_tool_call_start, format_tool_result, normalize_permission_mode, parse_args,
parse_git_status_branch, parse_git_status_metadata_for, permission_policy,
print_help_to, push_output_block, render_config_report, render_diff_report,
render_memory_report, render_repl_help, resolve_model_alias, response_to_events,
parse_git_status_branch, parse_git_status_metadata_for, permission_policy, print_help_to,
push_output_block, render_config_report, render_diff_report, render_memory_report,
render_repl_help, resolve_model_alias, resolve_session_reference, response_to_events,
resume_supported_slash_commands, run_resume_command, status_context, CliAction,
CliOutputFormat, InternalPromptProgressEvent,
InternalPromptProgressState, SlashCommand, StatusUsage, DEFAULT_MODEL,
create_managed_session_handle, resolve_session_reference,
CliOutputFormat, InternalPromptProgressEvent, InternalPromptProgressState, SlashCommand,
StatusUsage, DEFAULT_MODEL,
};
use api::{MessageResponse, OutputContentBlock, Usage};
use plugins::{PluginTool, PluginToolDefinition, PluginToolPermission};
@@ -5051,8 +5051,13 @@ mod tests {
let resolved = resolve_session_reference("legacy").expect("legacy session should resolve");
assert_eq!(
resolved.path.canonicalize().expect("resolved path should exist"),
legacy_path.canonicalize().expect("legacy path should exist")
resolved
.path
.canonicalize()
.expect("resolved path should exist"),
legacy_path
.canonicalize()
.expect("legacy path should exist")
);
std::env::set_current_dir(previous).expect("restore cwd");