fix(setup): TETRA-1975 — loại bỏ nuốt exception im lặng (log-then-raise + gate ruff S110) #162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/TETRA-1975-fail-loud-exceptions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Mục tiêu
Hoàn tất TETRA-1975: sau
31fac77(verification cuối pipeline), các phase setup/patch critical giờ fail-loud tại chỗ —bench install-app/bench migratekhông còn exit 0 khi setup hỏng một phần.Thay đổi
Setup hooks — log rồi raise / throw tổng kết cuối loop
setup/payroll.pysetup/permissions.pysetup/asset_categories.pysetup/translations.py(2 loop rename)setup/ensure_accounts.pysetup/holiday_list_assignment.pysetup/holiday_list_migration.pysummary["failed"]+ throw tổng kết (loop vẫn chạy hết)Patches — chỉ raise khi patch KHÔNG làm xong việc
v0_5_0/migrate_salary_structure_templates.py: ImportError + delete template cũ fail → log + re-raise (patch retry lần migrate sau).v0_5_0/update_pit_formula_5_brackets.py: ImportError → log + re-raise (im lặng = site tính thuế biểu cũ).v0_9_0/rename_d02_ts_to_d02_lt.py: gom lỗi 3 step, throw tổng kết cuối.Bare except-pass (audit ~29 site)
Exception): tất cả là guard có chủ đích (tearDown cleanup, autofill best-effort, optional field, stub fall-through) → gắn# noqa: S110kèm lý do từng dòng. Không đổi hành vi.AttributeError,ImportError,DuplicateEntryError...) không bị flag với config mặc định (check-typed-exception=false) — typed = đã chủ đích, giữ nguyên.income_tax_slab.pybuild-slab skip (retry path + đượcrun_verificationcover),leave_types.pymeta-guards + delegate.Lint gate
pyproject.toml: thêm per-rule"S110"vào select (không bật cả set S để tránh noise).test.yml: step mớiruff check --select S110 .(pin ruff==0.8.1 khớp pre-commit). Lưu ý: full-ruleruff check .còn ~550 lỗi baseline (I001/RUF002/RUF003 — phần lớn ký tự tiếng Việt trong docstring) → follow-up riêng, không gate ở đây.Test
ruff check --select S110 .→ 0 lỗi; không phát sinh violation mới trên file đã sửa (diff so với main).test_holiday_list_migrationcập nhật: summary có keyfailed; case delete-fail expect throw tổng kết sau khi loop chạy hết.bench migratestaging kế tiếp.Rủi ro
Refs: TETRA-1975
🤖 Generated with Claude Code