Repository navigation
feat(findings): report stage separate from triage status - #308
Conversation
BaaRai
left a comment
There was a problem hiding this comment.
Thanks for taking the second half of #297, and for reusing the bulk helper from #298 instead of duplicating it. The shape is right: a workflow stage separate from the verdict, no notification event, and the filter, stats, export and UI are all wired.
One blocker before merge: restoring an archive created before this migration fails.
insertArchiveRows restores every table with INSERT INTO findings SELECT * FROM json_populate_recordset(NULL::findings, …) (db/task_archives_restore.go:364-399). As the comment right above it explains for the side-memory fields, json_populate_recordset inserts NULL for a column absent from the JSON, bypassing the SQL default. An archive written before this PR has no report_state key, and the column is NOT NULL DEFAULT 'none', so the restore hits a not-null violation and the whole restore is refused. The existing side-memory workaround is the pattern to apply here: set "none" when the row lacks report_state. Please add a test that restores a findings row serialized without the column; the round-trip test archives from the current schema, so it cannot catch this.
One coordination note: this uses migration 0006 and #300 also uses 0006. Whichever lands first keeps it; if this one lands first I'll ask #300 to renumber to 0007.
df0c14b to
6a0b79d
Compare
|
Thanks. I pushed the review fixes to your branch before merging: rebased on current main, renamed the migration to 0007 (0006 is taken by the activity outbox), and added the archive-restore compatibility for report_state ( |
Closes #297.
Triage already has a bulk status action. This is the other half: a
report_statecolumn (none/submitted/accepted/rejected/duplicate) so a finding can be confirmed and submitted at the same time.It's a workflow stage, not a verdict. Lesson extraction still reads
status. Status-change notifications do not fire when only the report stage changes.The Findings toolbar can set it in bulk the same way as status (one transaction, per-id result, cap 500). List, filter, stats, detail, and export follow.
Verified:
go build ./...,go vet ./server ./db ./report, handler validation and DTO tests. The PG tests skip locally and run in CI.