You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(codequality,qa): reorganize verification into make qa-<speed>[-<filter>] architecture - #1297
Reorganizes KHI's code quality and verification entrypoints into a workflow-agnostic, read-only make qa-<speed>[-<filter>] architecture backed by scripts/codequality so developers, hooks, CI, and multi-agent workflows can compose fast/slow and blocking/advisory verification cleanly.
Key Changes
Unified Make QA Targets (scripts/make/qa.mk):
Adds all 9 qa-<speed>[-<filter>] targets (fast / slow / all × omitted / must / advisory), all read-only, with unified exit code contract (MUSTFIX >= 1 -> exit 1, otherwise exit 0, CLI/runtime errors -> exit 2).
Consolidates and removes 6 legacy duplicate Make targets from scripts/make/testing.mk (codequality, codequality-fast, codequality-decisions, codequality-go, codequality-web, codequality-web-container).
Supports BASE, TARGET, PATHS, CHANGED_SINCE, FORMAT (text|github|json), QA_LANG, USE_CONTAINER, COLOR, VCS, and CODEQUALITY_* overrides, including automatic -include $(HOME)/.config/khi/codequality.mk.
Keeps external billed/API advisories (--decisions / CODEQUALITY_DECISIONS=true, --similarity / CODEQUALITY_SIMILARITY=true) strictly opt-in by default so OSS contributors never trigger external APIs unintentionally, while allowing per-user environment control via ~/.config/khi/codequality.mk or env vars without changing Make commands or skills.
Sets default --max-mutants=0 and --decisions-max-targets=0 (unlimited) across qa and check (retaining explicit --decisions-max-targets=20 in .github/workflows/codequality-comment.yaml).
Adds fast fault isolation (ClassifyGoCompileError) to isolate external-file Go compile errors into skipped_sources, (all, must) fail-fast on fast build/test failure, single-file CheckFileConventions, SkipCloneScan in fast mode, and bounded-worker parallel evaluation in decisioncheck.
Consolidates scripts/gotestutil into scripts/codequality/internal/gotestutil with CurrentOnly default scoping for qa, FilterDiffByPaths, and IntersectDiffChangedSince.
Removes unnecessary whole-project parserOptions.project loading from web/eslint.config.mjs to enable fast single-file ESLint execution.
Updates scripts/pre-commit.sh, scripts/pre-push.sh, scripts/run-codequality-ci.sh, scripts/make/lint.mk, .github/workflows/pullrequest.yaml, and .github/workflows/codequality-comment.yaml directly to the new commands (retaining build-proto in pre-commit.sh and pre-push.sh when proto files change).
Verification
make pre-commit: PASS (0 mustfix, 0 advisory, 0 skipped)
make qa-slow-must QA_LANG=go CODEQUALITY_TIMEOUT=10m (and Go + Web build phases of make pre-push): PASS (670/670 Go mutants killed, 0 survived, 100% patch coverage, 0test_redundancy, unused_exports, deadcode, go_test_race, 4-OS build_go, lint_unused, build_web, build_web_dev, build_storybook all PASS)
go run ./scripts/codequality qa --speed=slow --filter=must --lang=ts --use-container --skip-sources=lint_unused,build_web,build_web_dev,build_storybook: PASS (containerized Karma test_web PASS)
make qa-all-advisory FORMAT=json and make qa-all-advisory FORMAT=json CODEQUALITY_SIMILARITY=false CODEQUALITY_DECISIONS=false: Verified opt-in control via ~/.config/khi/codequality.mk / overrides and zero external API calls when opted out.
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the monorepo's code quality and QA pipeline by transitioning the 'codequality' tool to a subcommand-based CLI supporting 'qa', 'check', 'conventions', and 'unused-exports'. It introduces unified speed ('fast', 'slow', 'all') and severity ('must', 'advisory', 'all') filters, coordinated by a new 'qarunner' package that integrates external checks, internal AST rules, coverage, mutation testing, and remote advisory APIs. Additionally, 'gotestutil' has been internalized, Makefiles and git hooks have been updated to target the new 'qa-fast-must' and 'qa-all-must' workflows, and 'web/eslint.config.mjs' has been optimized to isolate pure AST rules from whole-project TSConfig loading. Extensive contract and unit tests have been added to validate the new scoping, parallel evaluation, and reporting capabilities. I have reviewed the changes and have no feedback to provide.
CI Repair & Retained Advisory Notes (b3df87a8dc2f)
CI Repair (github-codequality):
Root cause: On 095f4411b3f7, TestPipelineStageGatingAndASTCloneScan used an 0o000 subdirectory to trigger a DiscoverProdGoFiles failure, which remained readable under root (uid=0) inside the Cloud Build container and allowed 2 mutants in runASTStage (scripts/codequality/main.go:417) to survive.
Fix (b3df87a8dc2f): Replaced the permission-based fixture with a root-safe ENOTDIR path (<file>/sub) and tightened qa_test.go assertions on runCLI(qa) and executeCheckStages. All 23 CI checks (including github-codequality: 667/667 mutants killed, 100.0%) now pass.
Retained Similarity Advisory (isTargetGoSource vs isConventionTargetGoFile, score 0.967):
Intentionally kept separate: isTargetGoSource (scripts/codequality/internal/qarunner/external.go) filters qarunner Go lint/test scope by excluding web/, pkg/generated/, and zzz_*.go, whereas isConventionTargetGoFile (scripts/codequality/internal/astcheck/conventions.go) has a distinct exclusion rule and lives in a separate internal package (astcheck) that qarunner intentionally does not import.
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
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
Reorganizes KHI's code quality and verification entrypoints into a workflow-agnostic, read-only
make qa-<speed>[-<filter>]architecture backed byscripts/codequalityso developers, hooks, CI, and multi-agent workflows can compose fast/slow and blocking/advisory verification cleanly.Key Changes
scripts/make/qa.mk):qa-<speed>[-<filter>]targets (fast/slow/all× omitted /must/advisory), all read-only, with unified exit code contract (MUSTFIX >= 1-> exit1, otherwise exit0, CLI/runtime errors -> exit2).scripts/make/testing.mk(codequality,codequality-fast,codequality-decisions,codequality-go,codequality-web,codequality-web-container).BASE,TARGET,PATHS,CHANGED_SINCE,FORMAT(text|github|json),QA_LANG,USE_CONTAINER,COLOR,VCS, andCODEQUALITY_*overrides, including automatic-include $(HOME)/.config/khi/codequality.mk.scripts/codequalityCLI & Internal Orchestrator (internal/qarunner):qa,check,conventions, andunused-exports.--speed,--filter,--paths,--changed-since,--skip-sources,--use-container, and--format=json(mustfix,advisory,skipped_sources).--decisions/CODEQUALITY_DECISIONS=true,--similarity/CODEQUALITY_SIMILARITY=true) strictly opt-in by default so OSS contributors never trigger external APIs unintentionally, while allowing per-user environment control via~/.config/khi/codequality.mkor env vars without changing Make commands or skills.--max-mutants=0and--decisions-max-targets=0(unlimited) acrossqaandcheck(retaining explicit--decisions-max-targets=20in.github/workflows/codequality-comment.yaml).fastfault isolation (ClassifyGoCompileError) to isolate external-file Go compile errors intoskipped_sources,(all, must)fail-fast on fast build/test failure, single-fileCheckFileConventions,SkipCloneScanin fast mode, and bounded-worker parallel evaluation indecisioncheck.scripts/gotestutilintoscripts/codequality/internal/gotestutilwithCurrentOnlydefault scoping forqa,FilterDiffByPaths, andIntersectDiffChangedSince.qa-fast-mustruns scopedaddlicense,gofmt,golangci_lint,go_test_short,prettier,prettier_misc,eslint,stylelint,test_scripts,buf_lint,markdownlint, and Stage-1 Go AST + single-file conventions.qa-slow-mustrunsunused_exports(Go),deadcode(path-filtered),go_test_race, 4-target cross-platformbuild_go(windows/amd64,linux/amd64,darwin/arm64,darwin/amd64),lint_unused, read-onlybuild_web,build_web_dev,build_storybook,test_web(with--use-containersupport), and dynamic Go/TS coverage/mutation/redundancy checks.parserOptions.projectloading fromweb/eslint.config.mjsto enable fast single-file ESLint execution.scripts/pre-commit.sh,scripts/pre-push.sh,scripts/run-codequality-ci.sh,scripts/make/lint.mk,.github/workflows/pullrequest.yaml, and.github/workflows/codequality-comment.yamldirectly to the new commands (retainingbuild-protoinpre-commit.shandpre-push.shwhen proto files change).Verification
make pre-commit: PASS (0 mustfix, 0 advisory, 0 skipped)make qa-slow-must QA_LANG=go CODEQUALITY_TIMEOUT=10m(and Go + Web build phases ofmake pre-push): PASS (670/670Go mutants killed,0survived,100%patch coverage,0test_redundancy,unused_exports,deadcode,go_test_race, 4-OSbuild_go,lint_unused,build_web,build_web_dev,build_storybookall PASS)go run ./scripts/codequality qa --speed=slow --filter=must --lang=ts --use-container --skip-sources=lint_unused,build_web,build_web_dev,build_storybook: PASS (containerized Karmatest_webPASS)make qa-all-advisory FORMAT=jsonandmake qa-all-advisory FORMAT=json CODEQUALITY_SIMILARITY=false CODEQUALITY_DECISIONS=false: Verified opt-in control via~/.config/khi/codequality.mk/ overrides and zero external API calls when opted out.go test -race -count=1 ./scripts/vrt/...: PASS