Skip to content

fix(signals): keep a signal open while its finding is still detected - #843

Merged
gkhngyk merged 1 commit into
mainfrom
feature/signal-resolve-on-absence
Sep 27, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/signal-resolve-on-absence

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Stops the nightly pass from closing signals whose problem is still there.

Each library detector writes at most maxSignalsPerKind (5) signals per kind, strongest first. Everything past the cap was dropped before the resolution step. The resolution step then closed every open signal that was not in tonight's list. So when a second pass on the same night reranked sources, a signal that slipped from fifth to sixth was marked resolved, even though the condition it described had not changed. On the first night of the V1 library, one brand had 13 signals closed this way within two and a half hours of being raised.

Now:

  • cap() marks over-cap findings with overflow instead of dropping them. libraryCandidates() returns them separately.
  • An over-cap finding counts as detected, so its open signal is not resolved. The signal is refreshed with tonight's values.
  • An over-cap finding raises nothing new and reopens nothing, so the cap still bounds what a night writes. A closed finding comes back only when it ranks inside the cap again.
  • The resolve and refresh decisions are pulled out as pure functions (signalsToResolve, overflowRefreshes) and tested directly.

Signals already closed this way stay closed. They reopen on their own once they rank inside the cap again.

Related issue

Follow-up to #839 · tracking #818

Type of change

  • fix — Bug fix

How to test

  • cd server && npx vitest run → 845 passing (9 new in signals/resolution.test.js)
  • After deploy, on a night with two passes for the same brand, signal_runs.detail.signals.autoResolved on the second pass should count only findings that disappeared, not ones that moved down the ranking.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

Library detectors write at most maxSignalsPerKind signals per kind. The
rest were dropped before the resolution step, so a finding that slipped
from fifth to sixth between two passes was closed as resolved while the
problem was still there.

Over-cap findings are now marked instead of dropped: they refresh an open
signal and count as detected, but raise nothing new and reopen nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gkhngyk
gkhngyk merged commit eec7764 into main Sep 27, 2026
6 checks passed
@gkhngyk
gkhngyk deleted the feature/signal-resolve-on-absence branch September 27, 2026 09:52
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