issue-tracking
GitHub用于 SWS 项目的 Issue 跟踪与调试技能,涵盖问题分类、复现测试编写、根因分析及修复验证流程。
Trigger Scenarios
Install
npx skills add static-web-server/static-web-server --skill issue-tracking -g -y
SKILL.md
Frontmatter
{
"name": "issue-tracking",
"description": "Triage, debug, fix, and document issues for the Static Web Server (SWS) project — bug reports, root cause analysis, fix implementation, and regression prevention"
}
Issue Tracking & Debugging
Load this skill when triaging bug reports, investigating issues, implementing fixes, or writing post-mortem documentation for SWS.
When to load: triaging a new issue report, investigating a regression, writing a fix for a bug, drafting a post-mortem, or reviewing a bug-fix PR.
Issue Triage
Reproducibility First
- Can you reproduce it? Follow the exact steps in the report. If unreproducible, ask the reporter for environment details (OS, architecture, SWS version, config file, TLS setup)
- Minimal reproduction: Reduce the scenario to the smallest config + file structure that triggers the bug. Strip unrelated features
- Write a failing test first: Before fixing, write a test that reproduces the bug. Use the fixture infrastructure in
tests/andsrc/testing.rs
Severity Classification
| Severity | Definition | Response |
|---|---|---|
| P0 - Critical | Security vulnerability, data exposure, path traversal | Drop everything. Fix immediately. Security release |
| P1 - High | Broken core feature (file serving, TLS), crash on start | Fix in current sprint. Patch release |
| P2 - Medium | Broken non-core feature, workaround exists | Schedule in next sprint |
| P3 - Low | Cosmetic, log message, doc typo | Backlog. Fix when touching related code |
Root Cause Analysis
Debugging Process
- Gather evidence: Logs (
-g trace), stack traces, HTTP response headers, request URIs, config file - Form a hypothesis: Based on the evidence, propose what might cause the bug
- Test the hypothesis: Add tracing, run reproduction, or step through with a debugger
- Identify the root cause: Find the exact line or condition that triggers the bug. Don't stop at symptoms
- Verify the fix: The reproduction test now passes. The original scenario works
Rust Debugging
- Use
tracingcrate for structured logs: SWS usestracing-subscriber. Run with-g tracefor maximum detail. Log levels: ERROR (actionable), WARN (unexpected but handled), INFO (key events), DEBUG (detailed), TRACE (noisy) - Use
dbg!()for quick inspection: Temporary, remove before committing - Enable backtraces:
RUST_BACKTRACE=1for panic backtraces,RUST_LIB_BACKTRACE=1for error backtraces
HTTP Debugging
- Inspect response headers: Use
curl -v http://localhost:8787/pathto see full request/response exchange - Test with specific Accept-Encoding headers:
curl -H "Accept-Encoding: br" ...to test compression variant selection - Check security headers:
curl -I http://localhost:8787/ | grep -i 'x-\|strict\|csp\|referrer' - Test byte-range requests:
curl -H "Range: bytes=0-99" http://localhost:8787/file - CORS preflight debugging:
curl -X OPTIONS -H "Origin: https://example.com" -H "Access-Control-Request-Method: GET" http://localhost:8787/ - TLS verification:
openssl s_client -connect localhost:8787 -servername localhost
File-Serving Debugging
- Path resolution issues: Check if the file exists at the resolved path. SWS logs the resolved path at
tracelevel - Hidden file / symlink blocking: Verify
--include-hiddenand--follow-symlinkssettings (both default tofalse). Hidden files return 404 (stealth), symlinks return 403 - Index file resolution: If a directory returns 404 instead of an index, check
--index-fileslist and file existence - MIME type issues: SWS uses
mime_guessfrom file extension. If the wrongContent-Typeis served, check the file extension
Fix Implementation
Before Writing the Fix
- Is there a failing test that reproduces the bug?
- Is the root cause identified (not just the symptom)?
- Does the fix address the root cause?
- Are there other places in the codebase with the same bug pattern?
Writing the Fix
- Minimal change: Fix the bug with the smallest possible code change. Do not refactor unrelated code in the same PR
- Add a regression test: The reproduction test becomes a permanent regression test
- Update documentation: If the fix changes behavior, update the relevant feature doc in
docs/content/features/
Commit Message Format
fix(scope): brief description of the fix
Detailed explanation of the root cause and the fix.
Include steps to reproduce, expected behavior, and actual behavior.
Fixes #123
scope is the affected module or feature (e.g., compression, tls, static-files). See COMMITS.md for the full convention.
Regression Prevention
- The reproduction test stays: Every bug fix adds a test that prevents the same bug from returning
- Check similar code paths: Search the codebase for patterns that could cause the same class of bug
- Add a lint rule if applicable: If a pattern caused the bug and can be detected statically, add a clippy or ESLint rule
Post-Mortem (P0/P1 only)
For critical and high-severity issues, write a brief post-mortem:
- What happened: Timeline of the incident
- Root cause: The specific code or configuration that caused it
- Impact: What users were affected and how
- Fix: What change resolved the issue
- Prevention: What process, tooling, or test prevents recurrence
Store post-mortems in docs/post-mortems/YYYY-MM-DD-title.md.
Checklist
- Bug is reproduced and understood
- Root cause identified (not just symptom)
- Failing test written before the fix
- Fix is minimal and addresses root cause
- Regression test added
- Similar code paths checked for the same bug pattern
- Commit message follows format
Version History
- 21dc11b Current 2026-08-20 17:42


