Skip to content

chore: fix Rust clippy/fmt errors and add Rust linting to CI#2

Merged
simongdavies merged 1 commit into
hyperlight-dev:mainfrom
simongdavies:fix-rust-fmt
Mar 23, 2026
Merged

chore: fix Rust clippy/fmt errors and add Rust linting to CI#2
simongdavies merged 1 commit into
hyperlight-dev:mainfrom
simongdavies:fix-rust-fmt

Conversation

@simongdavies
Copy link
Copy Markdown
Member

  • Fix clippy errors: unwrap_used, manual_strip, dead code, needless_range_loop
  • Allow expect_used on static regex patterns in plugin_scan.rs
  • Add check-cfg for cfg(hyperlight) in native-globals Cargo.toml
  • Format all Rust code (analysis-guest + sandbox runtime)
  • Update CI to use just lint-all + test-all (adds Rust lint/fmt/clippy)
  • Rename just recipes for clarity: lint-rust -> lint-analysis-guest, etc.
  • Update all docs to reflect renamed recipes

Copilot AI review requested due to automatic review settings March 23, 2026 11:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens Rust quality gates across the repo by fixing clippy/fmt issues in the Rust guest/runtime code, standardizing just recipes, and updating CI + documentation to run the full TS+Rust lint/test suite.

Changes:

  • Fix Rust clippy warnings and apply Rustfmt across the analysis guest/runtime and sandbox runtime modules.
  • Rename just recipes (e.g. test-rusttest-analysis-guest) and update CI to run just lint-all + just test-all.
  • Add unexpected_cfgs check-cfg configuration to silence cfg(hyperlight) warnings in Cargo manifests.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/CLAUDE.md Updates test commands to the renamed just test-analysis-guest recipe.
src/sandbox/runtime/src/main.rs Import ordering tweak to satisfy formatting/lints.
src/sandbox/runtime/modules/native-globals/src/lib.rs Rustfmt-only changes around string eval blocks and whitespace stripping.
src/sandbox/runtime/modules/native-globals/Cargo.toml Adds check-cfg for cfg(hyperlight) to avoid unexpected_cfgs warnings.
src/code-validator/guest/runtime/src/validator.rs Refactors conditionals/loops to satisfy clippy (let-chains, is_some_and, etc.).
src/code-validator/guest/runtime/src/plugin_scan.rs Adds a clippy allow for expect_used in static regex construction.
src/code-validator/guest/runtime/src/metadata.rs Clippy-driven refactors (strip_prefix, let-chains) and minor test assertion formatting.
src/code-validator/guest/runtime/src/lib.rs Removes an unused Vec import.
src/code-validator/guest/runtime/src/js_parser.rs Clippy-driven refactors (let-chains, safer Option handling).
src/code-validator/guest/README.md Updates docs to the renamed Rust test recipe.
src/code-validator/guest/host/src/sandbox.rs Minor import organization + simplifies runtime-handle error construction.
src/code-validator/guest/host/src/runtime.rs Refactors shutdown flow using let-chains (clippy/clarity).
Justfile Renames Rust recipes and updates aggregate targets (lint-all, fmt-all, test-all).
docs/DEVELOPMENT.md Updates developer documentation to the renamed just recipes.
CLAUDE.md Updates top-level instructions for new just recipe names.
.github/workflows/pr-validate.yml CI now runs just lint-all and just test-all for the lint/test job.
.github/instructions/tests.instructions.md Updates test instructions to just test-analysis-guest.
.github/copilot-instructions.md Updates instruction docs for the renamed Rust test recipe.
.claude/CLAUDE.md Updates Claude instructions for the renamed just recipes.

Comment thread .github/copilot-instructions.md
Comment thread src/code-validator/guest/runtime/src/plugin_scan.rs Outdated
@simongdavies simongdavies force-pushed the fix-rust-fmt branch 2 times, most recently from b36ed11 to 5cd684c Compare March 23, 2026 12:00
- Fix clippy errors: unwrap_used, manual_strip, dead code, needless_range_loop
- Allow expect_used on static regex patterns in plugin_scan.rs
- Add check-cfg for cfg(hyperlight) in native-globals Cargo.toml
- Format all Rust code (analysis-guest + sandbox runtime)
- Update CI to use just lint-all + test-all (adds Rust lint/fmt/clippy)
- Rename just recipes for clarity: lint-rust -> lint-analysis-guest, etc.
- Update all docs to reflect renamed recipes

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
@simongdavies simongdavies merged commit 308d9f5 into hyperlight-dev:main Mar 23, 2026
8 checks passed
simongdavies added a commit to simongdavies/hyperagent that referenced this pull request May 14, 2026
- Fix hyperlight-dev#2: Use MCP_SETUP_COMMANDS lookup for correct CLI setup hints
  (was generating 'setup-rti-mcp' instead of '--mcp-setup-fabric-rti')
- Fix hyperlight-dev#3: Show unconfigured status when mcpManager is null
- Fix hyperlight-dev#4: Update test assertion to match corrected setup command
- Fix hyperlight-dev#5: Add highlight.js ^10.7.3 as explicit dependency (was transitive)
- Fix hyperlight-dev#6: Validate Fabric RTI options — reject missing values & unknown flags
- Fix hyperlight-dev#7: Set HYPERAGENT_VERBOSE=1 from cli.verbose flag
- Fix hyperlight-dev#8: Update skill count from 9 to 10 in docs/SKILLS.md
- Fix hyperlight-dev#9: Use stderr 'ignore' instead of 'pipe' to avoid back-pressure
- Fix hyperlight-dev#10: Add CLI parser test for --mcp-setup-fabric-rti flag

Comment hyperlight-dev#1 (hljs types) is invalid — typecheck passes with /// <reference>.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
simongdavies added a commit that referenced this pull request May 14, 2026
* feat: KQL expert skill with requires-mcp, trigger cleanup, syntax highlighting

- Add kql-expert skill (SKILL.md) with 35 triggers, requires-mcp: fabric-rti-mcp
- Add requires-mcp frontmatter support in skill-loader + approach-resolver
- Add MCP enrichment wiring in agent index.ts
- Add --mcp setup-fabric-rti CLI command
- Clean generic triggers across 7 skills to prevent false matches
- Add hljs-kql.ts grammar (derived from @kusto/monaco-kusto MIT)
- Register KQL/Kusto syntax highlighting in markdown-renderer via createRequire
- Add intent-matcher regression tests (27 tests: 22 positive + 5 guards)
- Add skill-loader tests (8 tests) and approach-resolver MCP tests (8 tests)

All 2396 tests pass. Typecheck clean. Fmt clean.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

* fix: gate diagnostic output behind --verbose/--debug flags

- Rust: gate [hyperlight-analysis] eprintln! behind HYPERAGENT_VERBOSE/DEBUG env vars
- MCP: gate [mcp] Connected/Auth success messages behind isVerbose()
- MCP: pipe subprocess stderr when not verbose to suppress Python INFO logs
- KQL skill: remove azuremcpserver reference, add anti-pattern to use fabric-rti-mcp only

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

* docs: update skill tables and add requires-mcp documentation

- Add all 9 skills to tables in docs/SKILLS.md, README.md, skills/CLAUDE.md,
  and .github/instructions/skills.instructions.md (was missing kql-expert,
  xlsx-expert, mcp-services in various files)
- Document requires-mcp frontmatter field in docs/SKILLS.md
- Add requires-mcp to YAML examples in instruction files
- Alphabetise skill tables for consistency

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

* fix: address PR #137 review feedback (9 issues)

- Fix #2: Use MCP_SETUP_COMMANDS lookup for correct CLI setup hints
  (was generating 'setup-rti-mcp' instead of '--mcp-setup-fabric-rti')
- Fix #3: Show unconfigured status when mcpManager is null
- Fix #4: Update test assertion to match corrected setup command
- Fix #5: Add highlight.js ^10.7.3 as explicit dependency (was transitive)
- Fix #6: Validate Fabric RTI options — reject missing values & unknown flags
- Fix #7: Set HYPERAGENT_VERBOSE=1 from cli.verbose flag
- Fix #8: Update skill count from 9 to 10 in docs/SKILLS.md
- Fix #9: Use stderr 'ignore' instead of 'pipe' to avoid back-pressure
- Fix #10: Add CLI parser test for --mcp-setup-fabric-rti flag

Comment #1 (hljs types) is invalid — typecheck passes with /// <reference>.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

---------

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
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.

2 participants