fix(review): plan dedup keeps a lowered_from that is not a severity, so rule B counts it as blocker

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-16 16:36:38 +02:00
commit f70aed5d47
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
2 changed files with 39 additions and 3 deletions

View file

@ -20,7 +20,9 @@
// top-level `marks: [{agent, id, resolved}]` in input order; a malformed mark
// is dropped, never thrown on, and `sources` keeps exactly {agent, present}.
// A finding keeps an integer `line_end` ≥ `line`, rule B's `lowered_from`
// (normalized) and a non-empty `caught_by`, and carries `rule_keys`: the union
// (normalized when it is a severity, absent when blank, and kept as given
// otherwise, so rule B refuses it and counts it as blocker) and a non-empty
// `caught_by`, and carries `rule_keys`: the union
// of the keys merged into it, so a security key survives a merge into a
// differently-keyed survivor. Two defects are fixed. A `line` that is not a
// finite integer becomes null and an empty `file` or `rule_key` becomes null,
@ -188,8 +190,9 @@ function annotate(finding, agent) {
if (line !== null && Number.isInteger(finding.line_end) && finding.line_end >= line) {
out.line_end = finding.line_end;
}
if (finding.lowered_from !== undefined && finding.lowered_from !== null) {
out.lowered_from = normalizeSeverity(finding.lowered_from);
const lf = finding.lowered_from;
if (lf !== undefined && lf !== null && !(typeof lf === 'string' && lf.trim() === '')) {
out.lowered_from = normalizeSeverity(finding.lowered_from) ?? finding.lowered_from;
}
if (typeof finding.caught_by === 'string' && finding.caught_by.trim() !== '') {
out.caught_by = finding.caught_by;