Skip to content

scan: persist debt marker positions (debt_marker table) - #8566

Merged
squid-protocol merged 1 commit into
mainfrom
sensors/debt-marker-table
Nov 17, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
sensors/debt-marker-table

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

The scan now records where each TODO / FIXME / HACK / XXX marker sits: a new debt_marker table (file, line, class, comment text up to 200 characters). The engine already counted markers per file and function (state_planned_debt, state_fragile_debt) and the detector already worked out each marker's line to attribute it to a function, but neither the line nor the text reached the database, so a marker could not be followed from one scan to the next or given an age. The detector now returns them as debt_markers and the recorder writes one row each. Part of #8534 (the debt ledger).

Safe for scan output

DB-only. No report, brief, SARIF, SBOM or GPU output changes: crucible_check.py passes on both legs without a re-bless. The key is added to a file's result only when it has markers. The table cascades with its file and is cleared on a rescan of the same commit (same handling as fcall_external).

Tests

tests/tools_recorders/test_debt_marker.py scans a small C file with a block-comment TODO, a line-comment FIXME and a trailing HACK and checks lines 3, 5 and 10, their classes and text, and that rows go with their file. audit_check clean.

Not here

Marker age and author (need git blame at scan time or a comparison across scans), the repository's own repayment yardstick, and any report that reads the table. gitgalaxy change (#8561) can read it for a "while you are here" prompt next.

Type of change

  • Other: scan database (new table); no parsing change, no report change

Class / Sibling gaps

Class: facts the scan computes but does not persist. Handled: marker positions. Sibling gaps: (1) the class is the engine's planned/fragile split, not per-word (TODO vs FIXME vs HACK vs XXX are not separated); (2) markers in languages whose comment rules do not define the debt patterns are not recorded; (3) text is the whole comment line, trimmed, so a marker inside a long comment may be cut at 200 characters.

Lessons for agents

  • data_payload.update(logic_data) in galaxyscope.py carries any key the detector adds to its result into the file record the recorder reads, so a new per-file fact needs only the detector key and a recorder insert (add the key only when non-empty).

🤖 Generated with Claude Code

https://claude.ai/code/session_018srRveGdV73aUiuqkipAic

…comment text)

The engine counted TODO/FIXME/HACK/XXX markers per file and function but kept neither where they sit nor what they say, so a marker could not
be followed between scans or given an age. The detector already knows each marker's line (the positional comment pass); it now returns them
as debt_markers and the recorder writes one row per marker. DB-only: no change to any report; table cascades with its file and is cleared on rescan.
Part of #8534.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018srRveGdV73aUiuqkipAic
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 3f1d777 into main Nov 17, 2026
64 checks passed
@squid-protocol
squid-protocol deleted the sensors/debt-marker-table branch November 17, 2026 14:44
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 17, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

squid-shepherd Bot pushed a commit that referenced this pull request Nov 17, 2026
… you are here" marker list (#8582)

Functions touched: a function whose signature changed (parameter count differs between --base-db and --scan-db, or, without a base scan, a hunk
covers its declaration line) comes first and has up to five callers named, because in the study behind the order fixes after a signature change landed
in the callers about 1.2 times as often as in other functions of the same file (exploratory). The rest stay most-called first.

New section: when the change adds or removes 50+ source lines, the open TODO/FIXME/HACK/XXX markers in the touched files from the scan's debt_marker
table (merged in #8566), this author's first and then the oldest, aged by git blame at REV; markers the change itself wrote are left out. A scan without
markers says "not measured". No scan output changes.


Claude-Session: https://claude.ai/code/session_018srRveGdV73aUiuqkipAic

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant