Repository navigation
test: gate real apktool decode behind local opt-in - #39
walsykerem wants to merge 1 commit into
Conversation
|
PR Summary by QodoGate real apktool decode test behind local opt-in
AI Description
Merge Risk
|
Code Review by Qodo
Nice, no open findings for this group 1. Decode test never runs unless someone opts in locally
|
| if os.Getenv("LRECON_OPS_APKTOOL") != "1" { | ||
| t.Skip("real apktool decode is opt-in: set LRECON_OPS_APKTOOL=1 locally") | ||
| } |
There was a problem hiding this comment.
1. Decode test never runs unless someone opts in locally 🐞 Bug ☼ Reliability
The new LRECON_OPS_APKTOOL != "1" guard at line 65 makes TestApktoolDecodeFixture skip on every default go test run, including on machines that have apktool and java installed, which previously exercised it. The PR adds no workflow or other opt-in runner, so after merge the only test that drives the real apktool decode path (items 513-516) is a permanent SKIP in practice, and the four decode subtests never execute.
Agent Prompt
## Issue description
The decode test in test/op_ext_apktool_test.go is now gated behind LRECON_OPS_APKTOOL=1 and skipped when CI is set. Under default `go test` runs it never executes, so the real apktool decode path (items 513-516) has no automated coverage and the skip is easy to miss.
## Fix Focus Areas
- test/op_ext_apktool_test.go[59-75]
## Recommended Fix
Keep the opt-in gate but make the lack of coverage visible: add a named, documented way to run the test (for example a Makefile or script target such as `LRECON_OPS_APKTOOL=1 go test ./test -run '^TestApktoolDecodeFixture$' -v`) and document it in the test file header or the repo README. Where a dedicated runner exists that is allowed to have apktool, have it set the variable. Do not add it to the shared CI workflow if the ticket forbids that, but record the gap in the ticket so the coverage loss is tracked.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| for _, tool := range []string{"apktool", "java"} { | ||
| if _, err := exec.LookPath(tool); err != nil { | ||
| t.Skip(tool + " not installed") | ||
| } |
There was a problem hiding this comment.
2. Opted-in run passes silently when a tool is missing 🐞 Bug ◔ Observability
In TestApktoolDecodeFixture, the loop at lines 68-71 calls t.Skip when apktool or java is not on PATH, and this runs after the developer has already set LRECON_OPS_APKTOOL=1. A developer who explicitly asked for the real decode and has a broken toolchain therefore gets a SKIP line rather than a failure, which hides the misconfiguration the opt-in was meant to surface.
Agent Prompt
## Issue description
In test/op_ext_apktool_test.go the PATH check for `apktool` and `java` calls t.Skip even when LRECON_OPS_APKTOOL=1 was set. An explicit opt-in with a missing toolchain is then reported as a skip and not as a failure, so the misconfiguration goes unnoticed.
## Fix Focus Areas
- test/op_ext_apktool_test.go[62-72]
## Recommended Fix
After the opt-in check, replace the `t.Skip(tool + " not installed")` in the LookPath loop with `t.Fatalf("LRECON_OPS_APKTOOL=1 but %s not on PATH: %v", tool, err)`. Keep the t.Skip only for the unset-opt-in path so that default runs still skip cleanly.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Qodo FixerNo findings are within the configured fix scope. To change which findings are fixed, adjust the setting on your Qodo configuration page. |



Fixes #4
Gate the real apktool/Java decode test so it runs only on a local machine that explicitly opts in with
LRECON_OPS_APKTOOL=1and has bothapktoolandjavaonPATH. WhenCIis set the test skips with a clear reason instead of depending on the runner image. The fixture integrity test and every other test are unchanged.Verified in a temp clone (repo test convention:
cp test/*_test.go lrecon/):go test ./lrecon -count=1 -run '^TestApktoolDecodeFixture$' -v-> SKIP, PASSCI=true go test ./lrecon -count=1 -run '^TestApktoolDecodeFixture$' -v-> SKIP, PASS