Repository navigation
feat(ci,scripts): unify Go and TypeScript quality checks into codequality - #1268
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces the legacy mutation-diff tool with a comprehensive, unified codequality framework for Go and TypeScript. It introduces strict AST structural budgets (for cognitive complexity, nesting, function/file size, parameter bounds, and code clones), enforces a no-worsening ratchet on legacy code, and implements advanced differential coverage and mutation testing. The development guides, coding rules, and .golangci.yaml have been updated to reflect these new standards, and existing Go files have been refactored to comply with the new linter rules (e.g., using errors.Is/errors.As and go-cmp). The single review comment was filtered out because it incorrectly claimed a sorting call was inside a loop when it was actually outside. We have no further feedback to provide as the implementation is exceptionally thorough and well-tested.
Summary
Replaces
scripts/mutation-diffwith a single unified Go and TypeScript code and test quality engine (scripts/codequality,--lang=all|go|ts).Key Changes
scripts/codequality):internal/astcheck), differential line coverage (internal/covcheck), Super-Mutant differential mutation testing (internal/mutcheck), TypeScript Istanbul differential coverage + Karma Super-Mutant evaluation (internal/tscheck), and shared polarity + kill-set subsumption redundant test detection (internal/redundancy) under one rule and reporting model (internal/rule,internal/report).--lang=all|go|ts(defaultall),--fast(sub-second Go Stage-1 AST check),--workers=0(defaults to logical CPU core count),--fail-on-violations(enforced for Go), and--ts-fail-on-violations(advisory by default for TypeScript).CODEQUALITY_ALLOWDirective & No-Worsening Ratchet:after <= beforeratchet on pre-existing legacy units (using lazy base-revision reconstruction ininternal/overlayfor dynamic coverage and mutation comparisons).// CODEQUALITY_ALLOW(<rule_id>, <category>[, <operator>...]): <reason>with category validation, invariant-suppression rejection, and unused-directive detection..golangci.yaml):depguardarchitectural layer rules,errorlint,forbidigo(reflect.DeepEqualin tests and non-contextslog/fmt.Print*inpkg/task/**), andnolintlint, resolving existing violations acrosspkg/.scripts/make/testing.mk(make codequality,make codequality-fast,make codequality-go,make codequality-web,make codequality-web-container),.github/workflows/pullrequest.yaml,.agents/rules/{go,ts}-coding-rule.md, and EN/JA development guides.Verification
make codequality-fast: PASS (0 violationsacross 51 prod files, 51 test files, 654 units)make codequality-go CODEQUALITY_MAX=0: PASS (96.3%patch coverage,99.9%mutation score — 2,309/2,312 killed,0 violations)make codequality-web: PASSmake build-go,make test-go,make lint-go,make lint-web,make pre-commit: PASS