Skip to content

feat(ai): create AI quality gate presets for PR bots (resolves #779) - #1020

Open
TheWeirdDee wants to merge 1 commit into
Nanle-code:masterfrom
TheWeirdDee:feat/779-ai-quality-gate-presets
Open

TheWeirdDee wants to merge 1 commit into
Nanle-code:masterfrom
TheWeirdDee:feat/779-ai-quality-gate-presets

Conversation

@TheWeirdDee

Copy link
Copy Markdown
Contributor

Summary

Resolves #779.

This PR adds curated AI quality gate presets (conservative, default, strict) and PR bot automation support to StarForge, with zero-leak secret redaction in all reports and GitHub Actions annotations.


Changes Implemented

1. Preset Engine (src/utils/ai_quality_gates.rs)

  • Added QualityGatePreset enum with three curated profiles:
    • conservative: Leniency for legacy repositories or rapid prototyping (quality score >= 50, coverage >= 50%, docs >= 50%, allows up to 10 unwraps and TODOs, permissive licensing).
    • default / Recommended: Production standard for Soroban smart contracts (quality score >= 70, coverage >= 80%, docs >= 80%, 0 unwraps, 0 TODOs, 0 high/critical vulnerabilities).
    • strict: High-assurance financial-grade / mainnet protocol standards (quality score >= 90, coverage >= 90%, docs >= 95%, 0 medium/high vulnerabilities, 100ms benchmark cap).
  • Added QualityGatePreset::config(&self) and write_preset_config(&Path, QualityGatePreset).
  • Integrated redact_secrets into all gate evaluation paths and redact_report to prevent secret leakage.
  • Added format_github_annotations producing sanitized ::error / ::warning workflow commands for GitHub Actions PR bots.

2. CLI Support (src/commands/ai_quality_gate.rs)

  • Extended starforge ai quality-gate init with --preset <conservative|default|strict>.
  • Extended starforge ai quality-gate check with:
    • --preset <conservative|default|strict> (direct inline preset evaluation without file dependencies).
    • --github-annotations (emits workflow commands for PR annotations).

3. Example Configuration & Guide

  • starforge-gates.example.toml: Documented example configuration detailing every parameter, preset comparisons, custom regex/file check gates, and PR bot setup.
  • docs/AI_QUALITY_GATES.md: Comprehensive guide covering preset selection, secret redaction guarantees, example GitHub Actions workflows with mocks, limitations, and human-review expectations.

4. Tests

  • tests/ai_quality_gate_presets.rs: Integration and schema tests verifying preset threshold hierarchies, TOML roundtrip serialization, mock project evaluations, custom rules, and zero-leak secret redaction in annotations.

Verification

  • Unit & integration tests pass cleanly.
  • Presets validated against schema.
  • GitHub Actions workflow annotations verified with simulated secrets (redacted to [REDACTED]).

Closes #779.

…code#779)

- Add `conservative`, `default`, and `strict` presets for AI quality gates
- Add `--preset` and `--github-annotations` CLI flags to `ai quality-gate` commands
- Guarantee zero-leak secret redaction in quality gate reports and GitHub workflow annotations
- Add comprehensive `starforge-gates.example.toml` configuration template
- Add unit/integration tests in `tests/ai_quality_gate_presets.rs` validating preset hierarchies, custom rules, and secret redaction
- Add `docs/AI_QUALITY_GATES.md` detailing preset selection, PR bot GitHub Actions integration, and human-review boundaries
@drips-wave

drips-wave Bot commented Sep 24, 2026

Copy link
Copy Markdown

@TheWeirdDee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[Advancement] Create AI quality gate presets for PR bots

1 participant