Technical Debt Tracking
This document describes how TODO/FIXME items are tracked and managed in the codebase.
Overview
The project uses a custom scanner (scripts/todo_scanner.py) to detect and track technical debt markers in the codebase. This integrates with CI to prevent debt accumulation and generate reports.
Debt Markers
The scanner recognizes these marker types:
| Marker | Priority | Usage |
|---|---|---|
TODO |
Normal | Planned work that should be done |
FIXME |
High | Known bugs or broken code needing repair |
HACK |
High | Temporary workarounds requiring proper solutions |
XXX |
Critical | Dangerous code or urgent attention needed |
Format
Use this format for debt markers:
# TODO(scope): description [TUN-XXXX]
# FIXME(core): handle edge case when input is None [TUN-1234]
# HACK(ui): temporary workaround for layout bug [TUN-5678]
- scope: The component or module affected
- description: Clear explanation of what needs to be done
- TUN-XXXX: Optional ticket reference from the
tksystem
CI Integration
Pull Request Checks
The tech-debt.yml workflow runs on every PR:
- Scans for all debt markers
- Compares against
scripts/todo_baseline.json - Fails if debt increases from baseline
Weekly Reports
Scheduled runs (Sundays at 00:00 UTC):
- Generate full debt report
- Upload artifact for analysis
- Create/update GitHub issue if debt found
Managing Debt
View Current Debt
# Text report
uv run python scripts/todo_scanner.py --format text
# Include test files
uv run python scripts/todo_scanner.py --format text --include-tests
# JSON output
uv run python scripts/todo_scanner.py --format json
Update Baseline
If you've intentionally added or removed debt items:
uv run python scripts/todo_scanner.py --output scripts/todo_baseline.json
Commit the updated baseline:
git add scripts/todo_baseline.json
git commit -m "chore: update tech debt baseline"
Fail on New Debt
To enforce zero debt (fails if any markers found):
uv run python scripts/todo_scanner.py --fail-on-new
Baseline File
scripts/todo_baseline.json represents the accepted debt level. CI compares current scans against this baseline:
- Below baseline: OK (debt reduced)
- At baseline: OK (no change)
- Above baseline: FAIL (debt increased)
Exclusions
These paths are excluded from scanning:
.git/,__pycache__/,.venv/build/,dist/,*.egg-info/pyproject.toml,.pre-commit-config.yaml- Markdown files (
*.md) - Test files (unless
--include-testsflag used)
Related Tools
- Ruff: Already configured with
FIXandTDrules for TODO/FIXME detection - tk CLI: Use for ticket management alongside debt markers
- Quality Gates: See
quality-gates.mdfor broader quality standards
Workflow Example
Add a TODO while coding:
# TODO(parser): add validation for nested tags [TUN-1234]Create ticket with
tk:tk add "Add validation for nested tags in parser"Update baseline after PR merge:
uv run python scripts/todo_scanner.py --output scripts/todo_baseline.jsonTrack progress via weekly reports or:
uv run python scripts/todo_scanner.py --format text