3.0 KiB
3.0 KiB
2026-03-27 Q-004 Coverage Remediation
Scope
- Objective: continue remediating
Q-004 自动化覆盖率不足,回归安全网偏薄. - This round focused on the highest-value low-coverage areas identified in the audit:
- Frontend:
router, auth guards,AdminLayout,ImportExportPage - Backend:
internal/database,internal/auth/providers
- Frontend:
Changes
Frontend
- Added route and guard regression tests:
frontend/admin/src/app/router.test.tsxfrontend/admin/src/components/guards/guards.test.tsx
- Added navigation and permission-surface tests:
frontend/admin/src/layouts/AdminLayout/AdminLayout.test.tsx
- Added import/export product-flow tests:
frontend/admin/src/pages/admin/ImportExportPage/ImportExportPage.test.tsx
- Tightened the new router test so it passes both
vitestandtsc -b.
Backend
- Added database bootstrap and upgrade-path coverage:
internal/database/db_test.go
- Added provider auth URL/state coverage without live-network dependency:
internal/auth/providers/provider_urls_test.go
- Fixed Windows-specific SQLite test cleanup by explicitly closing the underlying
sql.DBhandle indb_test.go. - Removed an invalid provider test that attempted to hit the real Google endpoint during unit test execution.
Verified Commands
cd D:\project\frontend\admin
npm.cmd run test:run -- src/components/guards/guards.test.tsx src/app/router.test.tsx src/layouts/AdminLayout/AdminLayout.test.tsx src/pages/admin/ImportExportPage/ImportExportPage.test.tsx
npm.cmd run lint
npm.cmd run build
npm.cmd run test:coverage
cd D:\project
go test ./internal/database ./internal/auth/providers -count=1
go test ./... -count=1
go vet ./...
go test ./internal/auth/providers ./internal/database ./internal/repository -cover
Results
Frontend coverage
- Overall:
- statements
37.09% - branches
35.91% - functions
30.30% - lines
37.40%
- statements
- Target modules:
src/app/router.tsx:47.72%statementssrc/components/guards/RequireAuth.tsx:100%src/components/guards/RequireAdmin.tsx:100%src/layouts/AdminLayout/AdminLayout.tsx:80.00%src/pages/admin/ImportExportPage/ImportExportPage.tsx:83.58%
Backend coverage
internal/database:83.2%internal/auth/providers:4.0%internal/repository:10.5%
Real Conclusion
- This round materially improves the regression net around routing, auth gating, admin navigation, import/export flows, and database bootstrap behavior.
Q-004is improved but not fully closed.- The real remaining coverage gaps are now concentrated in:
- Frontend:
UsersPage,WebhooksPage, large parts ofProfileSecurityPage, and several service/http branches - Backend:
internal/repositoryand deeperinternal/auth/providerstoken-validation/error branches
- Frontend:
- Based on the current state, the next open remediation priority remains:
- continue
Q-004depth expansion - then
Q-005dev toolchain SCA cleanup - then
Q-006external alert delivery evidence closure
- continue