Merge pull request 'fix(ci): pin prettier 3.9.0 (codegen-check + pre-commit) + regenerate stale api-types.ts' (#1981) from fix/ci-prettier-codegen-pin into main
All checks were successful
Deploy / changes (push) Successful in 7s
Deploy / build-backend (push) Has been skipped
Deploy / build-worker (push) Has been skipped
Deploy / build-frontend (push) Successful in 5m29s
Deploy / deploy (push) Successful in 1m16s
CI / changes (pull_request) Successful in 8s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped

Reviewed-on: #1981
This commit is contained in:
lekss361 2026-06-27 11:25:37 +00:00
commit 11861e5dc0
5 changed files with 39 additions and 17 deletions

View file

@ -276,14 +276,17 @@ jobs:
working-directory: backend working-directory: backend
run: uv run python -c "import json; from app.main import app; print(json.dumps(app.openapi()))" > /tmp/openapi.json run: uv run python -c "import json; from app.main import app; print(json.dumps(app.openapi()))" > /tmp/openapi.json
- name: Regenerate api-types.ts + format (prettier defaults) - name: Regenerate api-types.ts + format (project-local pinned prettier)
working-directory: frontend working-directory: frontend
# 1) openapi-typescript из дампнутого файла (эквивалент `npm run codegen`, # 1) openapi-typescript из дампнутого файла (эквивалент `npm run codegen`,
# который читает ту же схему по URL). 2) prettier (defaults, как # который читает ту же схему по URL). 2) ./node_modules/.bin/prettier —
# pre-commit hook) → формат совпадает с committed-файлом. # PROJECT-LOCAL, pinned (prettier 3.9.0 в devDependencies). НЕ `npx
# prettier` (тот резолвится в плавающий latest и расходится с pre-commit,
# ломая этот gate). Pre-commit hook гоняет тот же локальный prettier 3.9.0
# → байт-в-байт идентичный формат. См. .pre-commit-config.yaml.
run: | run: |
npx openapi-typescript /tmp/openapi.json -o src/lib/api-types.ts npx openapi-typescript /tmp/openapi.json -o src/lib/api-types.ts
npx prettier --write src/lib/api-types.ts ./node_modules/.bin/prettier --write src/lib/api-types.ts
- name: Assert api-types.ts is up-to-date - name: Assert api-types.ts is up-to-date
working-directory: frontend working-directory: frontend

View file

@ -30,10 +30,17 @@ repos:
- id: ruff-format - id: ruff-format
files: ^(backend|tradein-mvp/backend)/ files: ^(backend|tradein-mvp/backend)/
# Frontend — prettier on TS/TSX/JSON # Frontend — prettier on TS/TSX/JSON.
# additional_dependencies pins the EXACT prettier engine (3.9.0) so this hook
# and CI (`openapi-codegen-check` → ./node_modules/.bin/prettier, also 3.9.0
# via frontend/package.json) format byte-for-byte identically. Без явного pin
# mirrors-prettier@v4.0.0-alpha.8 тянет CLI-обёртку, а CI `npx prettier`
# плавает в latest → расхождение формата → codegen-gate RED. Меняешь версию
# здесь — синхронно меняй prettier в frontend/package.json + lockfile.
- repo: https://github.com/pre-commit/mirrors-prettier - repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8 rev: v4.0.0-alpha.8
hooks: hooks:
- id: prettier - id: prettier
additional_dependencies: ["prettier@3.9.0"]
files: ^frontend/.*\.(ts|tsx|js|jsx|json|css|md)$ files: ^frontend/.*\.(ts|tsx|js|jsx|json|css|md)$
exclude: ^frontend/(node_modules|\.next|package-lock\.json)/ exclude: ^frontend/(node_modules|\.next|package-lock\.json)/

View file

@ -40,6 +40,7 @@
"jsdom": "^25.0.1", "jsdom": "^25.0.1",
"openapi-typescript": "^7.0.0", "openapi-typescript": "^7.0.0",
"postcss": "^8.4.0", "postcss": "^8.4.0",
"prettier": "3.9.0",
"tailwindcss": "^4.0.0", "tailwindcss": "^4.0.0",
"typescript": "5.9.3", "typescript": "5.9.3",
"vitest": "^2.1.9" "vitest": "^2.1.9"
@ -14055,6 +14056,22 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/prettier": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.0.tgz",
"integrity": "sha512-LjIqSIC5VYLzs9WedVmJ2ljNAGnU+DteIClbahu4L/DBeWjZ6iT/k1lAYyu9JUh+1xINxWadaPw/Pl63y/agAw==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/pretty-format": { "node_modules/pretty-format": {
"version": "27.5.1", "version": "27.5.1",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",

View file

@ -45,6 +45,7 @@
"jsdom": "^25.0.1", "jsdom": "^25.0.1",
"openapi-typescript": "^7.0.0", "openapi-typescript": "^7.0.0",
"postcss": "^8.4.0", "postcss": "^8.4.0",
"prettier": "3.9.0",
"tailwindcss": "^4.0.0", "tailwindcss": "^4.0.0",
"typescript": "5.9.3", "typescript": "5.9.3",
"vitest": "^2.1.9" "vitest": "^2.1.9"

View file

@ -2833,8 +2833,7 @@ export interface components {
nspd_risk_zones?: components["schemas"]["RiskZone"][] | null; nspd_risk_zones?: components["schemas"]["RiskZone"][] | null;
/** Nspd Opportunity Parcels */ /** Nspd Opportunity Parcels */
nspd_opportunity_parcels?: nspd_opportunity_parcels?:
| components["schemas"]["OpportunityParcel"][] components["schemas"]["OpportunityParcel"][] | null;
| null;
/** Nspd Red Lines */ /** Nspd Red Lines */
nspd_red_lines?: components["schemas"]["RedLine"][] | null; nspd_red_lines?: components["schemas"]["RedLine"][] | null;
/** Nspd Dump */ /** Nspd Dump */
@ -3752,8 +3751,7 @@ export interface components {
* @description Категория: competition|permitting|demand|risk|other * @description Категория: competition|permitting|demand|risk|other
*/ */
category?: category?:
| ("competition" | "permitting" | "demand" | "risk" | "other") ("competition" | "permitting" | "demand" | "risk" | "other") | null;
| null;
/** /**
* Is Confidential * Is Confidential
* @description «Непублично» (§7.13): маркировка чувствительной заметки * @description «Непублично» (§7.13): маркировка чувствительной заметки
@ -3846,8 +3844,7 @@ export interface components {
body?: string | null; body?: string | null;
/** Category */ /** Category */
category?: category?:
| ("competition" | "permitting" | "demand" | "risk" | "other") ("competition" | "permitting" | "demand" | "risk" | "other") | null;
| null;
/** Is Confidential */ /** Is Confidential */
is_confidential?: boolean | null; is_confidential?: boolean | null;
/** District */ /** District */
@ -4630,12 +4627,10 @@ export interface components {
year_built?: number | null; year_built?: number | null;
/** House Type */ /** House Type */
house_type?: house_type?:
| ("panel" | "brick" | "monolith" | "monolith_brick" | "other") ("panel" | "brick" | "monolith" | "monolith_brick" | "other") | null;
| null;
/** Repair State */ /** Repair State */
repair_state?: repair_state?:
| ("needs_repair" | "standard" | "good" | "excellent") ("needs_repair" | "standard" | "good" | "excellent") | null;
| null;
/** Has Balcony */ /** Has Balcony */
has_balcony?: boolean | null; has_balcony?: boolean | null;
}; };
@ -7877,8 +7872,7 @@ export interface operations {
cad_num?: string | null; cad_num?: string | null;
/** @description Фильтр по категории */ /** @description Фильтр по категории */
category?: category?:
| ("competition" | "permitting" | "demand" | "risk" | "other") ("competition" | "permitting" | "demand" | "risk" | "other") | null;
| null;
/** @description Фильтр по пометке «непублично» */ /** @description Фильтр по пометке «непублично» */
is_confidential?: boolean | null; is_confidential?: boolean | null;
/** @description Фильтр по автору */ /** @description Фильтр по автору */