fix: make the snippet queue reviewable (#35) #36

Merged
david merged 1 commits from fix/snippet-queue-signal into main 2026-11-05 05:20:41 +00:00
Owner

Closes #35.

17,262 candidates, 25 ever encoded. Two causes, both fixed.

1. Classification

trivialProbe returned false for anything containing a newline, so multi-line commands were never judged and every cd X && sed -n … chore became a "technique".

  • newlines are now segment separators, like ;
  • sed counts as an inspection unless it has -i
  • read-only git subcommands count (status, log, diff, show, rev-parse, describe, blame, shortlog, ls-files, grep, cat-file, reflog) — deliberately not branch/tag/remote/config, where the flag decides
  • context flags keep a command: -A/-B/-C, -p, -F, --since, --until, --graph, --author, --follow, --all

Measured over the live corpus: 307 → 1,081 trivial verdicts out of 11,552 techniques, and the archaeology worth keeping (git log --all -p --since=… | grep -B 50 "class …") still survives.

2. Retention

Nothing aged a candidate out; 16,149 were 7–30 days old. knox snippets expire --days N [--dry-run] rejects uncurated candidates older than the window.

It never touches encoded rows and is reversible like any rejection (knox snippets reopen, or scope=techniques for every rejected technique). Retention is not judgement — the code did not change, the window moved past it.

Tests

  • TestTrivialProbe — 18 cases: single/chained/multi-line reads, git chores, test runs, archaeology, context grep, ssh read vs ssh diagnostic, heredoc, sed -i, redirection, substitution, docker compose up.
  • TestExpireSnippets — expires the old candidate only; recent candidate and encoded snippet untouched; reason recorded.

go build ./... && go vet ./... && go test ./... pass.

Closes #35. 17,262 candidates, 25 ever encoded. Two causes, both fixed. ### 1. Classification `trivialProbe` returned false for anything containing a newline, so multi-line commands were never judged and every `cd X && sed -n …` chore became a "technique". - newlines are now segment separators, like `;` - `sed` counts as an inspection unless it has `-i` - read-only `git` subcommands count (`status`, `log`, `diff`, `show`, `rev-parse`, `describe`, `blame`, `shortlog`, `ls-files`, `grep`, `cat-file`, `reflog`) — deliberately not `branch`/`tag`/`remote`/`config`, where the flag decides - context flags keep a command: `-A/-B/-C`, `-p`, `-F`, `--since`, `--until`, `--graph`, `--author`, `--follow`, `--all` Measured over the live corpus: **307 → 1,081** trivial verdicts out of 11,552 techniques, and the archaeology worth keeping (`git log --all -p --since=… | grep -B 50 "class …"`) still survives. ### 2. Retention Nothing aged a candidate out; 16,149 were 7–30 days old. `knox snippets expire --days N [--dry-run]` rejects uncurated candidates older than the window. It never touches `encoded` rows and is reversible like any rejection (`knox snippets reopen`, or `scope=techniques` for every rejected technique). Retention is not judgement — the code did not change, the window moved past it. ### Tests - `TestTrivialProbe` — 18 cases: single/chained/multi-line reads, git chores, test runs, archaeology, context grep, ssh read vs ssh diagnostic, heredoc, `sed -i`, redirection, substitution, `docker compose up`. - `TestExpireSnippets` — expires the old candidate only; recent candidate and encoded snippet untouched; reason recorded. `go build ./... && go vet ./... && go test ./...` pass.
david added 1 commit 2026-11-05 05:20:35 +00:00
fix: make the snippet queue reviewable (#35)
build / image (push) Successful in 51s
build / test (push) Successful in 4m48s
3b24e3b8be
Two causes, both fixed here.

Classification: trivialProbe bailed out on any newline, so multi-line
chores were never judged — 'cd X && sed -n 60,200p f' and 'git status &&
git log --oneline -3' all became technique candidates. Newlines are now
segment separators like ';', sed (without -i) and read-only git
subcommands count as inspections, and context flags (-A/-B/-C, git log -p,
--since, --graph, --all) keep a command because selecting history is
method, not a chore.

Over the live corpus the trivial verdicts go from 307 to 1,081 of 11,552
techniques, and the archaeology that matters (git log -p | grep -B 50)
still survives.

Retention: nothing ever aged a candidate out, so 16,149 of them sat in the
queue. knox snippets expire --days N rejects uncurated candidates older
than the window. It is reversible and never touches encoded rows: the code
did not change, the review window moved past it.
david merged commit f410d3b46c into main 2026-11-05 05:20:41 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/knox#36