用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/firehol/update-ipsets --skill project-testing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Install, daemon, admin, and runtime operation guidance for update-ipsets. MUST be followed for operational changes.
Go, React, config, and repo conventions for update-ipsets. MUST be followed for all code changes.
Modern Go (1.22+) DOs and DON'Ts for high-performance APIs, clean code, separation of concerns, and avoiding common AI-generated code pitfalls. Use when writing or reviewing Go code.
基于 SOC 职业分类
正在显示 SKILL.md
| name | project-testing |
| description | Test commands, fixtures, and validation patterns for update-ipsets. MUST be followed for test work. |
testing package with colocated *_test.go files (evidence: go.mod, cmd/, internal/, pkg/, and tools/ test files).t.TempDir, inline fixtures, table-driven subtests, and httptest.NewServer.ui/package.json, ui/vitest.config.ts,
ui/vitest.setup.ts, ui/src/test/).eslint-plugin-testing-library scoped to
*.test.{ts,tsx} (evidence: ui/eslint.config.js).pkg/iprange, pkg/config, and pkg/processor;
make fuzz-replay replays the committed seed corpus shape with
go test -run=Fuzz and is wired into CI.1.26.4 in go.mod, React/Vite/TypeScript/Tailwind in ui/package.json.Makefile: govulncheck
v1.3.0, Staticcheck v0.7.0, and golangci-lint v2.11.4.make test, make race, make lint,
make coverage, make vulncheck, make staticcheck, make golangci-lint,
make fuzz-replay, and make bench (evidence: Makefile).make jsonbench runs the isolated
tools/jsonbench module so third-party JSON candidates can be measured
without adding them to the main application dependency graph.make test-tools (currently covers
tools/dronebl2ipsets). make race also runs the nested module's race
tests, and make coverage-tools writes
tools/dronebl2ipsets/coverage.out for its separate coverage gate.make ui-test or pnpm --dir ui test. The
package script disables Node 25 experimental Web Storage for Vitest because
Node's global localStorage path emits --localstorage-file warnings in the
jsdom worker context.make ui-e2e or pnpm --dir ui test:e2e.
These build the production bundle first and run the small Chromium
Playwright suite under ui/e2e/.
The package script clears NO_COLOR for Playwright because the runner sets
color forcing internally and Node warns when both NO_COLOR and
FORCE_COLOR are present.make test-strict (go test -shuffle=on -count=3 ./pkg/scheduler ./pkg/engine ./pkg/web).make coverage for the root module and
make coverage-tools for tools/dronebl2ipsets (evidence:
.github/workflows/ci.yml).CI coverage job. It uploads the
root coverage.out and tools/dronebl2ipsets/coverage.out reports only on
trusted push events to main or master, using CODACY_API_TOKEN and
Codacy's Go coverage parser. Pull-request runs intentionally skip the upload
so untrusted/fork/Dependabot contexts do not need Codacy secrets.make ui-static. Root Go
build/test/coverage/race/strict/cross targets depend on it so clean CI
checkouts build the same pkg/web/static/index.html and
pkg/web/static/assets/ shape that install.sh embeds. Direct go test ./... from a clean checkout is not the release gate because pkg/web
compile-time embeds the generated SPA shell.cd tools/dronebl2ipsets && go test ./... (evidence: nested tools/dronebl2ipsets/go.mod; root go test ./... does not enter nested modules).pnpm --dir ui install --frozen-lockfile,
pnpm --dir ui test, pnpm --dir ui build, and
pnpm --dir ui lint (evidence: install.sh, ui/package.json).make eslint-root-config or
pnpm --dir ui test:eslint-root-config verifies that repository-root
eslint.config.mjs imports the UI flat config, resolves TS/TSX/JS/MJS file
shapes, applies the UI TypeScript rules, and applies Node script rules for
modern .mjs maintenance scripts covered by Codacy/GitHub scanners.ui/pnpm-workspace.yaml; keep
pnpm 11 CI installs green by classifying dependency lifecycle scripts there.make ui-budget or pnpm --dir ui build:budget.
The budget checker reads ui/dist/assets after a production build, matches
stable chunk-name prefixes, and does not require generated assets to be
committed.pnpm --dir ui exec playwright install chromium, then run
make ui-e2e. CI installs Chromium with system dependencies before this
gate../install.sh, then smoke endpoints (evidence: install.sh, README.md).govulncheck, blocking
staticcheck, blocking golangci-lint, and 50% coverage thresholds for
both the root module and tools/dronebl2ipsets (evidence:
.github/workflows/ci.yml)..github/workflows/ci.yml).go test ./... does not cover the nested tools/dronebl2ipsets
module; make test-tools, make race, make coverage-tools,
make vulncheck, make staticcheck, and make golangci-lint explicitly
enter that module.t.TempDir() for filesystem state; do not write into repo source paths.0600 for
files, 0700 for directories) unless the test explicitly verifies a
public/shared mode contract. Do not use 0644/0755 as generic fixture
defaults.httptest for downloader and web/API behavior.configs/firehol/ as a real catalog fixture for catalog validation tests.pkg/config/catalog_verify_test.go; search for the old
count across pkg/config, pkg/processor, and other test packages (from SOW-0008).newEngineFixture helper instead of
direct &Engine{} literals. pkg/engine/engine_fixture_test.go contains an
AST regression guard that enforces this construction boundary (from SOW-0046).pkg_test package. Keep same-package tests for internal algorithms,
package fixtures, global registries, or lock/queue invariants only when the
SOW or test comments make the contract reason clear (from SOW-0064).static: YAML lines must materialize through the normal raw source,
processor, and finalized set path, not through hardcoded internal providers
(from SOW-0017).curl against /healthz, /api/v1/status, /api/v1/sets, and affected admin/public routes../install.sh, use admin repair/reprocess endpoints rather than manual file
edits, and verify both /api/v1/admin/integrity and
/api/v1/admin/integrity/entities return clean after background work
settles (from SOW-0017 regression).pnpm --dir ui build and pnpm --dir ui lint; install when generated static assets or embedded serving are involved.ui/e2e/static-server.mjs, not
vite preview. The production bundle uses /static/ as its public asset
base; vite preview treats that as the app base too, while the embedded Go
server serves public routes from / and assets from /static/*. Keep the
browser test server aligned with the Go serving model (from SOW-0054).ui/src/test/render.tsx, drive interactions with userEvent, mock
backend boundaries with MSW handlers, and assert visible roles/text/links,
accessible names, URL/navigation outcomes, or request parameters. Do not mock
hooks, child components, TanStack Query, or internal state (from SOW-0034).*.test.tsx next to the component or
page under test. Shared test helpers and fixtures belong under
ui/src/test/ (from SOW-0034).vitest-axe check when the jsdom surface can represent the behavior. Disable
jsdom-impossible rules such as color-contrast locally instead of accepting
noisy failures (from SOW-0034).vitest-axe findings as product bugs, not test noise. Fix
source issues such as unlabeled form controls, empty table headers, missing
dialog labeling, and nested interactive controls before disabling a rule.
Disable only checks that jsdom cannot evaluate faithfully (from SOW-0052).provider_set_id rejection in public and
direct JSON routes, insights ignoring stale aggregates, integrity malformed
detection, stale removed-provider artifact deletion, reserved provider names,
generated artifact namespace collisions, exact public feed names that resemble
generated artifact files, static critical IP/CIDR validation, tier-aware
hard/soft/contextual insight thresholds, feed-page default ordering that puts
hard/soft/contextual criticality before matched-IP volume, per-provider
integrity expectations for unloaded providers, stale artifacts for feeds that
stop being comparable targets, raw-route/compose rejection for
non-redistributable critical reference feeds, and role conflicts with
bogons (from SOW-0017)._bogons_, _critical_, _critical_infrastructure, _asn_, and
_country_, and prove exact configured identities win over substring
parsing (from SOW-0017 regression).ProcessedDate after
staged publish; include history, changesets, retention, metadata, comparison,
geo/ASN/bogon, critical, insights, and entity artifacts when touched (from
SOW-0017 regression).pkg/engine/pipeline_integrity_scenario_test.go: each row should
advance a logical timestamp, mutate mocked feed/provider input with add/remove
entries, run the scheduler-style update path, settle queued entity refreshes,
verify expected feed entries when relevant, and fail on any feed-output or
entity-artifact integrity finding. Keep the branch matrix covering initial
publish, ordinary updates, same-body forced/unforced checks, geo/ASN/bogon
provider fan-out, merge exclude recomposition, scoped/global reprocess, and
critical provider-set marker repair (from SOW-0017 regression).StatusSnapshot.Running for main engine runs and Entity artifacts *
background tasks for entity-specific repairs/refreshes. Without both, the
admin API can show transient stale rows as settled issues (from SOW-0017
regression).enableAll behavior (from
SOW-0025 regression)./api/v1/sets/{name}/data, /api/v1/compose,
/files/{feed}.ipset|netset, and direct /{feed}.ipset|netset, because
metadata visibility and raw redistributability are intentionally different
policies (from SOW-0025 follow-up)..ipset/.netset file is missing, so
direct compatibility downloads cannot regress to empty 200 OK responses
(from SOW-0025 regression)..ipset/.netset routes
do not populate the JSON/static artifact cache (from SOW-0036).webHTTPTestServer
fixture so middleware, auth, CORS, gzip, route registration, and file serving
are exercised through real HTTP. Keep direct httptest.NewRecorder tests for
focused middleware, gzip, file-cache, and single-handler path-safety unit
checks where a server adds no contract value (from SOW-0047).Options.WebDir is the served
tree and remove the served artifact while leaving runtime/live-builder inputs
present, so accidental request-time fallback is caught (from SOW-0025
follow-up).{feed}.json still exposes raw/source fields must be
flagged malformed so normal repair regenerates it (from SOW-0025 regression).common == 0 rows are omitted,
stale zero-overlap rows are removed during incremental merge, and integrity
flags old comparison artifacts that still contain explicit zero rows (from
SOW-0026).related and unique-share filtering (from
SOW-0025 follow-up).critical_infrastructure, provider_context,
asn, and geoip sources stay healthy on age alone, while zero-entry
publications for the same roles still classify as empty (from SOW-0037).make race and installed-service smoke
against /api/v1/admin/status queue/metrics visibility when scheduler
runtime code changes (from SOW-0030).startSchedulerRunner harness and assert observable activity,
artifacts, or snapshots. Keep direct private queue-field tests only for
admission, lock, ordering, and requeue invariants that are not exposed without
slow or timing-sensitive full-runner flows (from SOW-0066).context.Canceled without publishing partial outputs (from SOW-0035).Runner.Run to return
before test cleanup. A test that only calls cancel() can hide real runner
ownership bugs as timing-sensitive t.TempDir cleanup failures (from
SOW-0035).time.Sleep as synchronization. Use an observable
condition with a bounded ticker/timer, a channel/HTTP readiness signal, or a
package status snapshot. For admin/background-work tests, prove the scheduled
work produced its expected artifact or state change and that the relevant
background task list is empty before cleanup (from SOW-0032).t.Setenv instead of raw os.Setenv/os.Unsetenv in tests, so
process-wide environment changes are scoped to the test and remain
incompatible with unsafe parallel ancestors (from SOW-0032).b.Loop() on the Go 1.26 toolchain
instead of the legacy for i := 0; i < b.N; i++ loop shape (from SOW-0032).FuzzLoadYAML,
FuzzRunDeterministicTextProcessors, and multi-range testing/quick
invariants for pkg/iprange (from SOW-0032).testing/synctest with the whole operation inside
the bubble and synctest.Wait() before assertions; pkg/engine
cancellation tests are the first local pattern (from SOW-0039).*_test.go helper files and let the architecture posture gate block
accidental large-file growth (from SOW-0039).project-content-surfaces; tests alone are insufficient. For methodology pages, scan for misplaced implementation markers such as configs/, pkg/, use:, artifact filenames, YAML fences, and raw API route lists when those details are not part of the page's public interpretation job (from SOW-0017 regression).TestEffectiveEntryHelpersExposeSnapshotCost prevents cheap-looking effective-entry/feed-health helpers and fresh full-cache snapshot calls inside loops (from SOW-0024).testing.AllocsPerRun must not fail under
-race; race detector instrumentation changes allocation counts. Keep the
allocation ceiling active in normal make test, and gate only the
allocation-count assertion under the race build tag when needed (from
SOW-0117).