RI-7720 Lock TS errors per project with .tscheck.rec.json baselines#5926
Open
KrumTy wants to merge 8 commits into
Open
RI-7720 Lock TS errors per project with .tscheck.rec.json baselines#5926KrumTy wants to merge 8 commits into
KrumTy wants to merge 8 commits into
Conversation
Adopt the per-file/per-error-code baseline pattern from redislabsdev/cloud-ui#1930 so TS error counts can only decrease. Wires a new type-check job into tests.yml that gates PRs on UI, API, Desktop, and configs. - scripts/ts-error-check.ts: port of cloud-ui's script, takes the rec-file path as an arg so checks run from repo root - redisinsight/api/tsconfig.check.json: extends base with strict (minus strictPropertyInitialization and useUnknownInCatchVariables); keeps base tsconfig.json untouched so nest build is unaffected - Baselines: ui=1848, api=4114 (strict), desktop=512, configs=0 - E2E is already covered by tests-e2e-playwright-lint.yml - New type-check-baselines skill documents the dev workflow Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
The package provides its own type definitions, and the stub @types entry caused yarn --frozen-lockfile to fail in CI because the lockfile didn't include it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Desktop sources import compiled api modules from redisinsight/api/dist/**. Without building first, the desktop check reports 7 TS2307s for missing modules that don't exist in CI's clean checkout. Run build:api conditional on run-desktop so we don't pay the cost when only ui/api changed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
build:api runs build:prod which sets declaration: false. Without declarations, desktop fails type-checking with TS2749s for value-used-as-type on CloudAuthService and AzureAuthService imports from api/dist. The plain nest build (default tsconfig.json) emits declarations. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Code Coverage - Backend unit tests
Test suite run success3429 tests passing in 307 suites. Report generated by 🧪jest coverage report action from 6740414 |
Contributor
Code Coverage - Integration Tests
|
Contributor
Code Coverage - Frontend unit tests
Test suite run success6934 tests passing in 799 suites. Report generated by 🧪jest coverage report action from 6740414 |
KrumTy
commented
May 15, 2026
| @@ -0,0 +1,337 @@ | |||
| import { diff } from 'deep-object-diff' | |||
Contributor
Author
There was a problem hiding this comment.
custom "battle-tested" script ported from cloud-ui
UI plugins under redisinsight/ui/src/packages/* are sub-projects whose sources get type-checked through the UI tsconfig. Without their deps installed, module resolution shifts (TS2307 vs TS7016 etc.) so local results diverge from CI. Running build:statics before yarn type-check:ui makes the baseline hermetic. Cache the plugin node_modules keyed on the plugin yarn.locks to keep warm-cache cost low. Regenerated redisinsight/ui/.tscheck.rec.json with plugin deps installed: 1848 -> 1837 errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
UI: plugin deps must be installed (yarn build:statics) before yarn type-check:ui matches CI. Desktop: api/dist must be populated via the dev nest build (declaration files needed), not build:prod. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
valkirilov
previously approved these changes
May 15, 2026
| "test:cov:unit": "jest ./redisinsight/ui --group=-component --coverage -w 1", | ||
| "test:cov:component": "jest ./redisinsight/ui --group=component --coverage -w 1", | ||
| "type-check:ui": "tsc --project redisinsight/ui --noEmit", | ||
| "type-check": "yarn type-check:ui && yarn type-check:api && yarn type-check:desktop && yarn type-check:configs", |
There was a problem hiding this comment.
Another possible approach would be to move these into their respective workspace's package.json e.g.:
// <workspace_name>/package.json
"scripts": {
"type-check": "...",
}and then, in your type-check.yml you can call them like
yarn workspace <workspace_name> type-check
This way your root package.json will stay lean.
Contributor
Author
There was a problem hiding this comment.
good suggestion, done, but I kept a single type-check root script for convenience
Replaces 11 type-check / tscheck scripts at the repo root with one aggregate "type-check" and three matching scripts per workspace (ui, api, desktop). Each workspace owns its own type-check, tscheck, and tscheck:force. Root package.json shrinks from 11 to 1 entry. CI workflow and the type-check-baselines skill updated to call workspaces directly (yarn --cwd redisinsight/<workspace> <task>). Baselines regenerated with workspace-relative paths (totals unchanged: ui=1837, api=4114, desktop=512). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
yarn 1.x without workspaces does not surface root binaries (tsc, tsc-output-parser, tsx) to nested yarn --cwd invocations. CI calls workspace scripts directly with no outer yarn, so the pipeline shells fail with "tsc-output-parser: not found" / "tsx: not found". Add the root .bin to GITHUB_PATH once after install so subsequent workspace steps inherit it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adopt the per-file/per-error-code baseline pattern from redislabsdev/cloud-ui#1930. Current TS error counts are recorded in
.tscheck.rec.jsonfiles per project; CI fails if any (file × error-code) count increases. Counts can only go down.Scope:
redisinsight/ui,redisinsight/api,redisinsight/desktop,configs. E2E Playwright is unchanged (already gated by the existingtests-e2e-playwright-lint.ymlworkflow).Initial baselines:
strictenabled, see below)API strict mode
Strict settings for the API:
Live in a new
redisinsight/api/tsconfig.check.jsonthat extends the base config. The baseredisinsight/api/tsconfig.jsonis unchanged, sonest buildis unaffected (enablingstrictin the base broke the build with 939 errors — verified). The check tsconfig is only used byyarn type-check:api.Local setup (run once)
For local
yarn type-checkto match CI, you need three installs done in this order:If you skip
build:statics, the ui check will report extraTS7016("Could not find a declaration file for ...") errors because the plugins underredisinsight/ui/src/packages/*have their own deps in nestednode_modules.If you skip the api dev build, the desktop check will report
TS2749errors because desktop imports compiled api modules fromredisinsight/api/dist/src/**.Daily flow
yarn type-checkyarn type-check:{ui,api,desktop,configs}yarn tscheck:{ui,api,desktop}and commit the updated.tscheck.rec.jsontscheck:*:forceto paper over themyarn tscheck:{ui,api,desktop}:forceCI runs the same checks via a new reusable workflow
.github/workflows/type-check.yml, invoked fromtests.ymlwith path-filtered inputs (skips ui check if no ui files changed, etc.).frontend-tests,backend-tests, andintegration-testsnowneeds: [type-check, ...].CI returns a clear message in both failure modes:
Reviewer red flags:
.tscheck.rec.jsoncounts going up without a corresponding code fix, or:forceused in any commit.Testing
yarn type-checkpasses locally (~25s end-to-end after setup)const x: number = 'string'→yarn type-check:desktopexits 1 with file/line/error-code printedyarn type-check:desktopexits 1 with hintyarn --cwd redisinsight/api buildandyarn --cwd redisinsight/api build:prodstill complete cleanly (strict only applies viatsconfig.check.json, not the base)Docs:
*.tsbuildinfoadded to.gitignore(api hasincremental: true)🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it changes CI gating and build pipelines (new reusable workflow, new scripts, and strict-mode type-checking for API), which can cause unexpected PR failures or longer CI if misconfigured.
Overview
Adds a TypeScript error baseline system that records per-file/per-error-code TS error counts in
.tscheck.rec.jsonforui,api, anddesktop, and fails CI if any count increases.Introduces a new
scripts/ts-error-check.tscomparator/overwriter plus workspacetype-check/tscheckscripts, including an API-onlytsconfig.check.jsonthat enablesstrict(with select relaxations) without impactingnest build.Updates CI to run a dedicated reusable
type-check.yml(with UI plugin deps + API build pre-step for desktop) and makes frontend/backend/integration test jobs depend on it; also updates docs and ignores*.tsbuildinfo.Reviewed by Cursor Bugbot for commit 6740414. Bugbot is set up for automated code reviews on this repo. Configure here.