Repository navigation
ci(lint): move static checks into lint, cut rule-harness time 75% - #1630
Conversation
Preserve per-fixture diagnostics while avoiding one subprocess per case. Verified all existing rule cases and typecheck.
Use standard explained disables and retain the canonical owner exemption. Preserve HOME and learnings runtime tests. Verified focused rules, home behavior, lint and typecheck.
Enforce path ownership for skills, rules and claudemd while retaining locate behavior coverage. Verified ruleHarness cases, locate tests, lint and typecheck.
Replace the source scan with an enabled rule while preserving launch runtime coverage. Verified 35 focused tests, lint and typecheck.
Preserve direct and transitive policies, standardize explained exceptions and retain the lookup type contract. Replace both source scanners. Verified rule fixtures, provider behavior, lint and typecheck.
Read the Windows CI selection from its existing owner and replace the POSIX source scan. Verified rule fixtures, list integrity, lint and typecheck.
Replace source inspection with a rule and retain OpenCode activation behavior tests. Verified focused tests, lint and typecheck.
Move producer enumeration out of Vitest while preserving record privacy and publication behavior. Verified 86 focused tests, lint and typecheck.
Move markdown consistency and executable guide checks into the lint command. Keep package and runtime skill coverage in Vitest. Verified check/write CLI refusal cases, 152 focused tests, lint, typecheck, and check mode on Node 20.19.5.
Reject bare config-loader calls and object options that omit preview policy. Keep explained write and session paths local, and retain tests for wrapper behavior the rule cannot prove. Verified red-green ruleHarness cases, 107 focused helper and runtime tests, lint, and typecheck.
Check deletion and ledger cleanup directly, including absent copies and neighboring paths. Keep tombstone and persisted uninstall coverage in the real CLI suite. Verified focused helper tests and all six retained delivery E2Es after npm run build.
Use typed Babel traversal and separate import recognition from graph reachability. Keep policy array lookup tied to its runtime declarations. Verified 95 rule cases, lint, typecheck, and subprocess coverage. Added characterization of re-exports, transitive mocks, TSX, and unrelated calls.
Keep the shared refusal unit cases and a real CLI profile-preservation case, plus init/provider ordering and Git preview transitions. Drop repeated classification-only CLI cases and the directly guarded projects loader row. Verified 104 focused unit tests and 13 real CLI E2Es after npm run build.
The PR description documents sufficient testing: it records a post-build real-CLI E2E run with 2 files and 13 tests passing. No testing-record blocker. Review was read-only; I did not run, build, or install PR code. |
|
Fixed in e545ed2. |
Earlier concatenated-learnings-root finding: resolved by the new The PR description documents sufficient testing, including a post-build real-CLI E2E record: 2 files, 13 tests passed. No testing-record blocker. Review was read-only; I did not run, build, or install PR code. |
|
Fixed in 409eacc. The snapshot predicate now converts the path |
Both earlier findings are resolved: concatenated learnings roots are detected, and the snapshot delivery check normalizes Windows paths. The PR description documents sufficient testing, including a post-build real-CLI run with 2 files and 13 tests passing. No testing-record blocker. Review was read-only; I did not run, build, or install PR code. |
|
Agreed, they test behaviour, not source. Restored in 9c37bac: |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Re-checked at 409eacc9 (reviewed at 2bfef910, then the two follow-ups). This does what #1590 asked: the scanners are gone, every teamai/* rule is enabled (including learnings-root), the doc generators moved to scripts/ and check-docs.mjs runs in npm run lint, and the built dist/index.js is byte-identical to main. @babel/parser and @babel/types add nothing to the lockfile; they were already installed at the same version through @vitest/coverage-v8.
The automated review's point is fixed in e545ed2f: getKnowledgeDir(config) + '/learnings', a bare '/learnings' literal and an expression-less template are all reported now (probed). The new test covers the first two; a fixture for the bare literal would pin the third.
[P1 blocking] The dry-run cases removed from dry-run-load-path.test.ts are not replaced. remove, roles init/add/remove/update, source add/remove/add-http, packages install, import --from-iwiki/--from-mr/--from-claude and mcp inject lost their runtime check that config.yaml is not rewritten under --dry-run. teamai/config-load-options only checks that a dryRun property is present, not that it carries the flag: changing src/remove.ts to pass { dryRun: false } still passes lint, and the built CLI then migrates config.yaml under teamai remove … --dry-run, while the unmodified build leaves it untouched. The new comment ("These wrapper paths are not proven by the direct config-load rule") says the same. Restoring those rows in the existing it.each table keeps the runtime guarantee; the lint rule can stay as the cheap first line.
Non-blocking:
- [P2 non-blocking] Two E2E cases go without a replacement: "pull deletes a skill the member excludes and takes it off the record" in
remove-delivered-record-1577.test.ts(the rule proves the helper is called, not the exclusion path), and thedigest/import --dry-runrefusal indry-run-refusal.test.ts(dry-run-guardonly checks the classification). - [P2 non-blocking]
AGENTS.mdnow exempts "a docs-only, tests-only, or static guard change" from the real-CLI record. "Static guard" also covers a PR that changes runtime code alongside a rule; #1590 asked only that lint-enforced helper calls neednpm run lintplus the helper's unit test. Scoping it to "no runtime change" keeps the rule as asked. - [P3 nit]
workflow-records.test.tsalso failed when a code inKNOWN_FAILURE_CODESwas never written; the rule checks only the forward direction, so dead entries pass. - [P3 nit]
no-provider-merge.jsscopes withfile.includes('/src/providers/'), the substring approach8875e595removed from the other rules. - [P3 nit] Stale comments after the move:
src/tools.ts:311namestool-support.ts(now underscripts/), and.github/workflows/ci.yml:237sayswindows-test-list.test.tskeeps the list honest (nowteamai/windows-tests).
|
All points addressed at df177ad.
|
|
No new findings in the scoped PR diff. All three earlier findings are resolved:
The PR description documents sufficient testing: a post-build real-CLI E2E run records 2 files and 17 tests passing. No testing-record blocker. Review was read-only; I did not run, build, or install PR code. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Approved at df177ad1. dry-run-load-path.test.ts is back to main's version, so every --dry-run command still checks at runtime that config.yaml is not rewritten. The two E2E cases are restored (excluded-skill pull, and the digest / import preview refusal), the AGENTS.md exemption is scoped to lint-rule-only changes with no runtime code, no-provider-merge scopes from the package root with a test for a parent src/providers/ directory, the bare '/learnings' literal has a fixture, and the stale comments are updated (the ci.yml change is comment-only). Remaining from my earlier notes, non-blocking: the reverse check that every KNOWN_FAILURE_CODES entry is still written. The automated review at this head reports no new findings and marks its earlier three resolved. CI is green.
Main moved the static checks from Vitest scanners into lint (Tencent#1630). The benchmark additions to the deleted scanners move with them: the src/benchmark/ entries and the rule that no workflow module imports a benchmark module go to teamai/workflow-boundaries, the benchmark refusal codes to the failure-code policy, the README benchmarks column to doc-checks/readme-matrix, and the benchmark guide checks to doc-checks/workflow-docs-examples.
…t#1630) Move the static checks that ran as Vitest scanners (import boundaries, banned APIs, required helper calls, doc drift) into npm run lint: enabled teamai/* rules plus scripts/check-docs.mjs, whose --write mode regenerates the command reference and tool-support pages. Delete the scanners they replace, batch ruleHarness into one oxlint run per test file, and update AGENTS.md and CONTRIBUTING.md. Closes Tencent#1590.
Summary
Static checks (import boundaries, banned APIs, required helper calls, doc drift) ran as Vitest tests that read
src/from disk, and the rule harness started oneoxlintprocess per case. This moves them intonpm run lintas enabledteamai/*rules plus a docs check/write script, deletes the scanners they replace, and batchesruleHarnessinto oneoxlintper test file: the 105 rule tests run 75% faster (3.37 s → 0.85 s).What a contributor now sees (real output):
Custom
// learnings-root ok:comments and hardcoded allowlists became// oxlint-disable-next-line teamai/<rule> -- <reason>, which--report-unused-disable-directiveskeeps honest.AGENTS.mdand.github/CONTRIBUTING.mdsay where these checks belong, replace the-ucommands, and show each guard's failure and fix.Type of Change
Test Plan
npx tsc --noEmitpasses (npm run typecheck, which also checks the plugin)npm run lintpasses (oxlint +Documentation checks passed.), on Node 24 and Node 22; Node 20 is left to CInpx vitest runpasses except three GitLab request-deadline tests that also fail onorigin/mainon this machine (below)ruleHarnessfile per rule, written red first;scripts/check-docs.test.tsproves check mode never writes, stale output fails, and--writetouches only the three generated filesHarness A/B: all 105 rule tests, same fixtures and rules; the only difference is one
oxlintper case versus one per file. Five alternating runs, 105/105 passing every run.npx vitest run oxlint-plugin-teamaiWhole suite, for honesty: three alternating runs of
npm run lintthennpx vitest runonorigin/mainvs this branch.npx vitest runwall time is unchanged within noise (median 251.4 s → 253.7 s): it is dominated by Vitest worker setup across ~630 files, and this PR removes scanner files while adding the rule test files.npm run lintgrows from ~1.8 s to ~5.5 s because it now runs the moved checks. The win is that violations fail in lint, beforenpm run build, and the rule suite no longer scales with one process per case.Real CLI, after
npm run build, the two E2E files covering the guarded helpers (removeDelivered,--dry-runrefusal):Pre-existing failures, not touched here:
gitlab-mr-create-timeout,gitlab-mr-timeout,gitlab-org-timeoutfail on this host in isolation on both this branch andorigin/main(78b6869c), so they are timing-sensitive on this machine, not caused by this diff.Related Issues
Closes #1590
Notes for Reviewers
teamai/workflow-boundariesand the snapshot part ofteamai/no-provider-mergefollow transitive imports. oxlint'scontext.languageOptions.parser.parsethrowsnot implemented yet, so the sharedimports.jsparses reachable dependencies with@babel/parser(pinned to the version already in the lockfile, now declared as a direct devDependency). The snapshot graph follows eager runtime imports only, matching the old scanner; the skill-driver graph also follows type, dynamic andvi.mockedges.teamai/windows-teststhrows ifWINDOWS_TESTShas no literal list;teamai/rules-locateand the delivery scope ofteamai/no-provider-mergethrowLint rule scope file missing: …if their file is renamed (checked by renamingsrc/resources/rules.ts: oxlint exits 1).src/" from the package root (inProductionSourceinutils.js), not from any/src/in the absolute path. Before that, a checkout cloned under a directory namedsrc(for example~/src/teamai-cli) failednpm run linton a clean tree with threeteamai(launch-env)errors in the plugin's own file; it now exits 0 there and still reportssrc/violations.teamai/config-load-optionschecks that named loader calls pass preview options; it cannot prove the flag's value is forwarded ({ dryRun: false }passes). Every--dry-runpreview case indry-run-load-path.test.tsstays, checking thatconfig.yamlis left unchanged. No E2E case is removed: the exclusion path inremove-delivered-record-1577.test.tsand thedigest/importrefusals indry-run-refusal.test.tsprove behaviour the rules cannot.AGENTS.mdexempts only docs-only, tests-only and lint-rule-only changes (no runtime code touched) from the real-CLI record.src/diffs are disable-comment swaps and the two generator files moving toscripts/. If a rule turns out too strict, a reasoned inline disable or a rule tweak fixes it.