Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/benchmark-latency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ jobs:
- name: Run latency benchmarks
run: |
cargo bench --locked -- \
cli_cold_start \
cli_command_latency \
latency_budget \
'cli_cold_start|cli_command_latency|latency_budget' \
2>&1 | tee target/criterion/latency-bench-output.txt

# Parse Criterion output and check against latency budgets.
Expand Down Expand Up @@ -117,9 +115,15 @@ jobs:
} else {
summary += '_No latency budget report was generated._';
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});
try {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});
} catch (err) {
// Fork PRs get a read-only GITHUB_TOKEN and can't post comments;
// don't fail the whole job just because the summary couldn't be posted.
core.warning(`Could not post latency budget comment: ${err.message}`);
}
56 changes: 39 additions & 17 deletions CODE_STYLE_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,27 +481,49 @@ cargo clippy -- -W clippy::needless_clone

### Project-Specific Allowances

The StarForge project allows these clippy rules in specific circumstances. See `src/main.rs` for the global allowlist:
**There is no crate-wide lint allowlist.** `src/lib.rs` and `src/main.rs` used to
carry a blanket `#![allow(dead_code, unused, clippy::all)]`, and `Cargo.toml`
carried a matching `[lints]` table — together these silenced essentially every
default Clippy lint group (correctness, suspicious, style, complexity, perf)
across the *entire* ~40k-line crate, not just the handful of patterns the
comments claimed to cover. That's exactly backwards: it hid real bugs (see
below) behind the same blanket that was meant to excuse a few CLI functions
with many arguments.

Every remaining `#[allow(...)]` in the codebase is now **scoped to the single
item that needs it** — a function, struct, or field — with a comment
immediately above explaining *why*:

```rust
#![allow(
dead_code, // Some plugin infrastructure code is unused until plugins load it
clippy::needless_range_loop, // Sometimes more readable than alternatives
clippy::redundant_closure, // Used intentionally for clarity in some cases
clippy::too_many_arguments, // Complex CLI commands require many arguments
clippy::type_complexity, // Some type definitions are inherently complex
clippy::unnecessary_lazy_evaluations // Some expressions are evaluated for side effects
)]
// Each parameter is an independent, named input (CLI flags / distinct config
// values); bundling them into a struct here would add indirection without
// reducing real complexity.
#[allow(clippy::too_many_arguments)]
async fn monitor_contract(
contract_id: &str,
events_filter: Option<&str>,
// ...
) -> Result<()> {
```

**When to add to this allowlist:**
- Only for **unavoidable** patterns
- Document *why* with a comment
- Discuss with maintainers before merging

```rust
#![allow(clippy::too_many_arguments)] // Contract CLI requires many parameters for optimization context
```
**When to add a scoped allow:**
- Only on the specific item that triggers it — never on a module, and never
crate-wide.
- Only for patterns that are genuinely **unavoidable or clearly intentional**
for that one item, not as a shortcut past a warning you haven't looked at.
- Always with a comment explaining *why*, not just restating the lint name.
- `dead_code` is the one lint where "unavoidable" usually means "not wired up
yet, but deleting it isn't this change's call to make" — that's a valid
reason, but say so explicitly rather than leaving the allow unexplained.

**What restoring this signal found:** with the blanket removed,
`cargo clippy --all-features` went from silently clean to over 2000
warnings — 94% of them were the single mechanical `uninlined_format_args`
style lint (fixed via `cargo clippy --fix`), but the rest included real
defects the blanket had been hiding, e.g. a constructed template changelog
entry that was built and then silently discarded (`changelog: None` instead
of `Some(changelog)`) and unreachable branches. Local, documented exceptions
don't have that failure mode: each one is small enough to actually read.

**When NOT to add:**
- "I don't want to refactor" — do the refactor
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 1 addition & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,6 @@ name = "starforge"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

# Package-wide lint policy. These lints are intentionally relaxed for the crate
# (including integration tests, which use lightweight mock structs and helpers).
# Centralizing them here keeps `cargo clippy --all-targets -- -D warnings` green.
[lints.rust]
dead_code = "allow"
unused_imports = "allow"
unused_variables = "allow"

[lints.clippy]
needless_range_loop = "allow"
redundant_closure = "allow"
too_many_arguments = "allow"
type_complexity = "allow"
unnecessary_lazy_evaluations = "allow"
items_after_test_module = "allow"
needless_borrow = "allow"
needless_borrows_for_generic_args = "allow"
empty_line_after_doc_comments = "allow"
doc_overindented_list_items = "allow"
expect_fun_call = "allow"
useless_vec = "allow"
single_match = "allow"

[dependencies]
clap = { version = "=4.4.18", features = ["derive", "color"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down Expand Up @@ -84,6 +61,7 @@ zip = "0.6"
tempfile = "3.8"
wasm-bindgen = "0.2"
rusqlite = { version = "0.32", features = ["bundled"] }
thiserror = "1"
csv = "1.0"
minijinja = "1.0"
serde_yaml = "0.9.34"
Expand Down
2 changes: 0 additions & 2 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ ignore = [
# rustls-pemfile unmaintained in 1.0.4; reqwest 0.11 requires it.
# Superseded in reqwest 0.12, which is a breaking change for this crate.
"RUSTSEC-2025-0134",
# anyhow downcast_mut
"RUSTSEC-2026-0190",
]

[licenses]
Expand Down
Loading
Loading