feat: wrapper-to-implementation inference + fix broken auto-generated tests#931
Merged
feat: wrapper-to-implementation inference + fix broken auto-generated tests#931
Conversation
Delete 300 lines of auto-generated tests that never compiled: - Duplicate test function names (E0428) - Wrong argument counts (E0061) — called 3-9 arg functions with 0 args - Wrong return types (E0599) — called .is_ok() on (), HashMap, Option - Invalid format strings — backticks in assert messages These were committed by homeboy-ci[bot] in 8653206 via the auto-refactor pipeline. The test generation fixer (#818) has known bugs that produced this output: depth tracking error in contract extraction, missing signature awareness, and no dedup on generated test names. This was the sole cause of all 39 `cargo test --lib` compilation errors. Suite now: 844 passed, 0 failed.
Add MissingWrapperDeclaration audit finding type and wrapper_inference
module that detects wrapper files missing explicit declarations of what
they wrap.
Detection: for files matching configurable wrapper_glob, check if the
expected_field exists. If not, trace internal calls against configurable
regex call_patterns to infer the implementation target and report it.
Configuration in homeboy.json under audit_rules.wrapper_rules:
{
"name": "tool_ability_link",
"wrapper_glob": "inc/Engine/AI/Tools/**/*.php",
"expected_field": "ability",
"call_patterns": ["wp_get_ability\\('([^']+)'\\)"],
"field_format": "'ability' => '{inferred}'"
}
Language-agnostic pattern matching — works for PHP, Rust, TypeScript,
or any language with configurable call patterns.
Includes 10 unit tests covering field detection, call tracing, suggestion
building, and edge cases.
src/commands/fleet.rs src/commands/release.rs src/commands/version.rs src/core/code_audit/conventions.rs src/core/code_audit/wrapper_inference.rs src/core/deploy/version_overrides.rs src/core/release/workflow.rs
Contributor
Homeboy Results —
|
The builtin Rust validation used `cargo check` which only checks lib/bin targets. Generated test code (#[cfg(test)] modules) was not validated, allowing broken tests (wrong signatures, duplicate names, bad format strings) to pass the refactor pipeline's write gate. Change to `cargo check --tests` so all test code is compiled before the refactor pipeline accepts the changes. On failure, the planner rolls back all modifications.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #903 (wrapper-to-implementation inference)
Two changes:
1. Fix: Remove broken auto-generated tests (commit 1)
Deletes 300 lines of auto-generated tests in
version_overrides.rsthat never compiled. These were committed byhomeboy-ci[bot]in8653206via the auto-refactor pipeline. The test generation fixer (#818) has known bugs:test_deploy_with_override_default_path× 3fetch_remote_versions()called with 0 args, needs 3.is_ok()on(),HashMap,OptionThis was the sole cause of all 39
cargo test --libcompilation errors. Suite is now: 844 passed, 0 failed.2. Feat: Wrapper-to-implementation inference (commit 2)
New
MissingWrapperDeclarationaudit finding type. Detects wrapper files that call implementation functions but don't explicitly declare the relationship.Configuration in
homeboy.json:{ "audit_rules": { "wrapper_rules": [{ "name": "tool_ability_link", "wrapper_glob": "inc/Engine/AI/Tools/**/*.php", "expected_field": "ability", "call_patterns": ["wp_get_ability\\('([^']+)'\\)", "(\\w+Abilities)::\\w+\\("], "field_format": "'ability' => '{inferred}'" }] } }How it works:
wrapper_glob, check ifexpected_fieldexistsinternal_callsagainst configurablecall_patternsMissingWrapperDeclarationwith inferred target and suggested fixLanguage-agnostic — works for any language with configurable regex patterns.
10 unit tests covering field detection, call tracing, suggestion building, multi-target inference, and edge cases. All pass.
Changes
src/core/deploy/version_overrides.rs— remove 300 lines of broken auto-generated testssrc/core/code_audit/conventions.rs— addMissingWrapperDeclarationvariantsrc/core/code_audit/mod.rs— wire wrapper inference into audit pipeline (Phase 4m)src/core/code_audit/wrapper_inference.rs— new module: config, detection, call tracing, testsTesting
cargo test --lib: ✅ 844 passed, 0 failed (was 39 compilation errors)cargo test --bin homeboy: ✅ 25 passed