Skip to content

feat(anti-debt): technical-debt governance agent (V1+V1.2+KG), hardened - #6

Merged
Rwanbt merged 5 commits into
mainfrom
feat/anti-debt-hardening
Jun 18, 2026
Merged

feat(anti-debt): technical-debt governance agent (V1+V1.2+KG), hardened#6
Rwanbt merged 5 commits into
mainfrom
feat/anti-debt-hardening

Conversation

@Rwanbt

@Rwanbt Rwanbt commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

Lands the anti-debt governance agent under stack/agents/anti-debt/ (deterministic scanners, Critic Engine, SQLite Knowledge Graph, governance skills, adapters, CI), with all fixes from two review passes applied.

This is a new self-contained subsystem (~7k LOC) — large by line count, but it adds no diff to existing code. Full test suite is green at HEAD.

Hardening applied (review → fix)

  • Stable finding identity: deterministic fingerprint replaces random UUIDs across all 6 scanners → dedup, KG and history work across scans.
  • Schema↔scanner contract enforced: extended evidence.type/source/estimated_effort enums; new test_schema_conformance validates real scanner output (88+ findings) against the schema in CI.
  • Triage/plan split (Option B): build_triage + debt-triage.schema.json (deterministic) vs debt-plan.schema.json (LLM judgment), gated by validate_plan.py.
  • Critic reconciled to the documented 0.6 reject floor (code + docs + tests).
  • Calibration loop made functional (records original_confidence); KG location unified; kg_migrate uses salt-free hashing for cross-process idempotency.
  • scan_architecture cycle detection fixed for nested packages; scan_periodic/mvp_runtime scan all categories; prevention emits valid rules + real regression tests.
  • Removed dead code, fixed type annotations, MiniMax CJK leaks, severity sort.
  • Test fixtures use a fake non-provider credential (no real-looking provider keys) so secret-scanning push protection is satisfied while still exercising detection.

Tests

9 test files green locally, incl. the new schema-conformance guard. CI workflow covers schemas, critic, KG, layers 1-7, scan quality, dashboard e2e, and (new) full-Python syntax + schema conformance.

Out of scope (left untracked, pre-existing)

AGENTS.md (modified), hooks/, scripts/, routing-guide.md — not part of this audit.

Rwanbt added 5 commits June 18, 2026 21:47
Ignore KG SQLite db, alert logs, periodic-scan reports and Rust test-fixture
build output so they are never committed as part of the anti-debt subsystem.
…rdened

Adds a portable, LLM-agnostic technical-debt governance agent under
stack/agents/anti-debt/: deterministic scanners (code/security/deps/architecture),
a Critic Engine with confidence tiers, a SQLite Knowledge Graph, governance
skills, adapters and a CI workflow.

Hardening applied after two review passes:
- Stable finding identity: deterministic fingerprint replaces random UUIDs across
  all 6 scanners -> dedup, KG and history actually work across scans.
- Schema<->scanner contract enforced: extended evidence.type/source/effort enums;
  new test validates REAL scanner output against the schema in CI.
- Triage/plan split (Option B): build_triage + debt-triage.schema.json
  (deterministic) vs debt-plan.schema.json (LLM judgment), gated by validate_plan.py.
- Critic reconciled to the documented 0.6 reject floor (code+docs+tests).
- Calibration loop made functional; KG location unified; salt-free hashing for
  cross-process idempotency in kg_migrate.
- scan_architecture cycle detection fixed for nested packages; scan_periodic and
  mvp_runtime scan all categories; prevention emits valid rules + real tests.
- Removed dead code, fixed annotations, MiniMax CJK leaks, severity sort.

Full suite: 9 test files green (incl. new schema-conformance guard).
GitHub Actions only executes workflows under the repository-root
.github/workflows/. The anti-debt workflow lived under
stack/agents/anti-debt/.github/workflows/ and therefore never ran — the test
suite was green only locally. Move it to the root (its paths filter already
scopes it to stack/agents/anti-debt/**) and fix a YAML error in a step name
(unquoted colon) that the nested location had hidden.
Running the agent's own static analyzer on itself flagged the worst offenders.
Reduce cyclomatic complexity by extracting helpers — behaviour unchanged, full
suite green:

- critic_v2.main: dispatcher table + per-command functions (CC 21 -> 3)
- scan_code.heuristic_python_scan: split into _scan_secrets / _scan_ast_smells /
  _scan_dead_imports (CC 26 -> ~5); main split into _augment_python /
  _augment_polyglot (CC 17 -> 6)
- kg_migrate.migrate_v1_to_v2: split into _process_scan/_history/_plan_file (CC 25 -> ~6)

Functions with CC>=20 dropped from 5 to 2; the remaining two (detect_js_cycles,
analyze_file) are sequential parsers/AST walkers — documented exceptions.
Activating CI surfaced that test_layer12/test_layer47/test_adapters hardcoded a
Windows absolute path (D:\App\...), so they errored on the Linux runner while
passing locally. Replace with a path derived from __file__. Also add the missing
test-adapters job so the whole suite runs in CI.
@Rwanbt
Rwanbt force-pushed the feat/anti-debt-hardening branch from a1b0464 to 6025f80 Compare June 18, 2026 19:48
@Rwanbt
Rwanbt merged commit 2b8af40 into main Jun 18, 2026
25 checks passed
@Rwanbt
Rwanbt deleted the feat/anti-debt-hardening branch June 18, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant