Repository navigation
fix(staged_tasks): filter completed entities in creation dedup and default relevance_score (#21875) - #21876
Conversation
|
Hi @Git-on-my-level, @kodjima33, All automated CI checks, hygiene preflights, and backend unit suites are now 100% green:
Ready for maintainer review and merge! |
|
Reviewed both changed files against issue #21875 — this fix checks out. backend/database/staged_tasks.py
backend/tests/unit/test_staged_tasks_dedup.py
Two non-blocking notes:
Checks pass on the head (Backend unit suite, Backend Hermetic Merge Gate, Formatting, Hygiene). Thanks @hardik4love-lang — clean diagnosis and a well-scoped fix with the right tests. Leaving the merge decision to a human maintainer. AI-generated maintainer feedback on behalf of the Omi maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Thanks @Git-on-my-level! Appreciate the detailed review and confirmation. Ready for human maintainer merge. |
|
The production change here is correct and nicely scoped — this is a genuine fix for the dedup deadlock and the missing-field sort drop described in #21875, and I have no blocking findings. Leaving formal sign-off to a human maintainer. What I verified on the head:
Performance: no new queries; the dedup loop still streams the same collection it did before. USER IMPACT: users who completed or promoted a staged task can now have that same task suggested again instead of it being silently blocked forever, and newly suggested tasks always appear in the staged-task list and promotion queue. What I would still want as a reviewer: the default relevance_score of 0 sorts first in the ascending promotion order (lowest promoted first), so unscored tasks jump the queue ahead of scored ones — worth a quick maintainer sanity-check that this matches the intended ranking semantics. A test asserting that a relevance_score explicitly passed via kwargs still overrides the default would also be a cheap addition. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
26a94ef to
8f39938
Compare
|
Verdict: correct, well-scoped fix for #21875 — both defects are real and the patch addresses them with hermetic test coverage. No blocking issues; merge sign-off left to a human maintainer. Verified on head 8f39938:
Nit (non-blocking): kwargs.get('relevance_score', 0) if kwargs.get('relevance_score') is not None else 0 has a dead ", 0" fallback — the else branch already covers the omitted/None cases; feel free to simplify on a future touch. Performance: the dedup loop still streams the full subcollection (pre-existing O(n) scan); the added completed check is trivial. USER IMPACT: staged tasks a user already completed or promoted no longer block the same task from being captured again later, and newly captured tasks without a relevance score are no longer silently hidden from the staged-task list. Still wanted (non-blocking): rows created before this fix still lack relevance_score and remain invisible to the ordered queries — a small backfill (batch_update_staged_scores-style sweep) would be a good follow-up. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
create_staged_task still returns the first matching description, including a completed row, and it omits relevance_score unless the caller passes one. test_create_staged_task_ignores_completed_staged_task_in_dedup and test_create_staged_task_defaults_relevance_score_when_omitted pin both on 8f39938. Hygiene, Formatting, and the backend unit suite are green.
What changed and why
Fixes #21875 by filtering out completed staged tasks during creation-time deduplication in
create_staged_task()and defaultingrelevance_scoreto 0 when omitted. This ensures previously completed/promoted staged tasks do not deadlock future candidate creation, and that all newly created staged tasks have a valid sort key for Firestoreorder_by('relevance_score')queries.Product invariants affected
How it was verified
Verified via hermetic pytest suite in
backend/tests/unit/test_staged_tasks_dedup.py(18/18 tests passing), covering:relevance_scoreto 0 when omitted.Tests
backend/tests/unit/test_staged_tasks_dedup.py
UI evidence
UI-Evidence: none
Failure class (fixes)
Failure-Class: none