2.7 KiB
2.7 KiB
2026-03-27 Q-004 Coverage Remediation Pass 2
Scope
- Continue remediating
Q-004 自动化覆盖率不足,回归安全网偏薄. - This pass focused on:
- Frontend
WebhooksPageandservices/webhooks.ts - Backend
internal/repository/webhook_repository.go - Frontend production build stability under current
Vite 8 + Windows + --configLoader native
- Frontend
Changes
Frontend
- Added page-level regression tests for:
frontend/admin/src/pages/admin/WebhooksPage/WebhooksPage.test.tsx
- Added service-level tests for:
frontend/admin/src/services/webhooks.test.ts
- Added a Windows/Vite stability fix:
frontend/admin/vite.config.js- explicitly set
build.rollupOptions.input = 'index.html'to avoid the native-loader absolute HTML input emission failure observed duringnpm.cmd run build
Backend
- Added repository tests for:
internal/repository/webhook_repository_test.go
- Hardened Webhook repository create behavior:
internal/repository/webhook_repository.go- explicit inactive status (
status=0) is now preserved instead of being swallowed by the DB default duringCreate
Verified Commands
cd D:\project\frontend\admin
npm.cmd run test:run -- src/pages/admin/WebhooksPage/WebhooksPage.test.tsx src/services/webhooks.test.ts
npm.cmd run lint
npm.cmd run build
npm.cmd run test:coverage
cd D:\project
go test ./internal/repository -count=1
go test ./... -count=1
go vet ./...
go build ./cmd/server
go test ./internal/auth/providers ./internal/database ./internal/repository -cover
Results
Frontend coverage
- Overall:
- statements
41.06% - branches
38.48% - functions
36.00% - lines
41.47%
- statements
- Target modules:
src/pages/admin/WebhooksPage/WebhooksPage.tsx:93.15%src/services/webhooks.ts:100%src/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/repository:15.1%internal/auth/providers:4.0%
Real Conclusion
- This pass materially strengthens regression coverage for Webhook list/filter/action flows and their client adapters.
- It also closed one real build stability issue on Windows for the currently supported frontend build entry.
Q-004is improved again, but still not fully closed.- The current main remaining coverage gaps are:
- Frontend:
UsersPage, deeperProfileSecurityPage, and multiple service/http branches - Backend:
internal/auth/providersdeep token-validation/error paths and the rest ofinternal/repository
- Frontend: