check-safety/check_buildmodeplugin.go
Alex Dunmow b423f90e29 feat: no -buildmode=plugin check (disabled until WO-WZ-017)
Adds check 29: ported plugin repos must not carry a `-buildmode=plugin` build
target (the legacy .so compile the wasm migration retires). Lands DISABLED
behind a per-check const toggle (enableBuildmodePluginCheck=false) so it emits
no output and never fails while the fleet is still porting; WO-WZ-017 flips it
on. Scans plugin Makefiles/*.sh only. Unit-tested; golden snapshots unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 18:34:28 +08:00

40 lines
1.4 KiB
Go

package main
import "fmt"
// enableBuildmodePluginCheck is the per-check enable toggle. It ships DISABLED
// (WO-WZ-009): the wasm plugin migration is still porting the fleet off `.so`,
// so a `-buildmode=plugin` target is not yet a hard error. WO-WZ-017 flips this
// to true once every plugin repo builds wasm via `ninja plugin build`.
//
// While disabled the check prints NOTHING and never fails, so it neither
// disturbs golden snapshots nor blocks in-flight ports.
const enableBuildmodePluginCheck = false
func init() {
register(Check{
Seq: 290,
ID: "29",
Title: "No -buildmode=plugin targets in ported plugin repos",
Run: func(ctx *ScanContext, rep *Reporter) {
if !enableBuildmodePluginCheck {
return // disabled until WO-WZ-017; emit no output
}
fmt.Println("=== Check 29: No -buildmode=plugin targets in ported plugin repos ===")
violations := checkBuildmodePlugin(ctx.resolvedPluginTargets)
if len(violations) > 0 {
fmt.Printf(" FAIL: %d legacy .so build target(s) found:\n", len(violations))
for _, v := range violations {
fmt.Printf(" %s:%d %s\n", v.file, v.line, v.snippet)
}
fmt.Println("\n Fix: build wasm with `ninja plugin build` (make build-wasm); drop the -buildmode=plugin target.")
rep.Fail()
} else {
fmt.Println(" OK: No -buildmode=plugin targets found")
printPerTargetOKLines(pluginTargetLabels(ctx.resolvedPluginTargets))
}
fmt.Println()
},
})
}