Skip to content

fix(queue-trends): return null review velocity when observedDays is zero#1756

Merged
JSONbored merged 9 commits into
JSONbored:mainfrom
andriypolanski:fix/queue-trends-zero-observed-days
Jun 30, 2026
Merged

fix(queue-trends): return null review velocity when observedDays is zero#1756
JSONbored merged 9 commits into
JSONbored:mainfrom
andriypolanski:fix/queue-trends-zero-observed-days

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Documents the baseline-selection invariant in buildWindow: once a baseline is found (fetchedAt <= latest - windowDays), observedDays is always at least the requested window span, so ready windows divide safely.
  • Adds regression tests that duplicate latest fetchedAt timestamps still yield finite reviewVelocityPerDay and that ready windows always have observedDays >= windowDays.
  • Does not add a null/zero-day velocity branch — that path is unreachable for ready windows given how baseline is chosen (lines 88–90).

Why not null on zero observedDays?

The gate flagged the prior approach as a dead fix: baseline must be at or before targetMs, so observedDays <= 0 cannot occur on any ready buildWindow result. A null-velocity guard would never run on the real path and contradicted the PR title.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • Focused change in src/services/queue-trends.ts + tests only.

Validation

  • npm run test:ci green
  • npm run test:coverage green

Test plan

  • test/unit/queue-trends.test.ts — duplicate latest fetchedAt → no Infinity; ready windows → observedDays >= windowDays and finite velocity.

Files changed

File Change
src/services/queue-trends.ts Invariant comment only (no dead null branch)
test/unit/queue-trends.test.ts Regression + invariant tests

PR body note (important)

Update the open PR title and description to match this summary. Remove any claim about “return null when observedDays is zero” — that was incorrect for the ready-window path.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 29, 2026
@gittensory-orb

gittensory-orb Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-06-30 07:52:52 UTC

2 files · 1 AI reviewer · no blockers · readiness 71/100 · CI green · unknown

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
This change documents the real buildWindow invariant and adds tests around duplicate latest timestamps plus ready-window observedDays bounds. The production change is safe because the baseline selection requires fetchedAt <= latest - windowDays before computing observedDays, so ready windows cannot divide by zero. The notable issue is metadata drift: the PR title still claims a null-on-zero behavior that the code intentionally does not implement.

Nits — 4 non-blocking
  • nit: Pull request metadata should be updated because the current title says `return null review velocity when observedDays is zero`, while `src/services/queue-trends.ts:90` intentionally keeps finite velocity for ready windows.
  • Update the PR title to match the implemented invariant/test-only fix, for example `test(queue-trends): cover ready-window observedDays invariant` or `docs(queue-trends): document ready-window observedDays invariant`.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (size label size:XS; no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR; address the blocker before review.
Contributor workload ✅ 10/10 Author activity: 87 registered-repo PR(s), 60 merged, 5 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 87 PR(s), 5 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 87 PR(s), 5 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Explain no-issue PR.
  • Fix the blocker.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@gittensory-orb gittensory-orb Bot added gittensor Gittensor contributor context gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. labels Jun 29, 2026
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 29, 2026
@andriypolanski andriypolanski force-pushed the fix/queue-trends-zero-observed-days branch from 1b6768d to 8028431 Compare June 29, 2026 22:09
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jun 29, 2026
@superagent-security superagent-security Bot removed the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 29, 2026
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 29, 2026
@andriypolanski andriypolanski force-pushed the fix/queue-trends-zero-observed-days branch from 4870599 to 70637df Compare June 29, 2026 23:03
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 29, 2026
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jun 30, 2026
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 30, 2026
@superagent-security superagent-security Bot removed the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 30, 2026
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 30, 2026
@andriypolanski andriypolanski force-pushed the fix/queue-trends-zero-observed-days branch from d467467 to ba31b9e Compare June 30, 2026 05:58
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 30, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 30, 2026
@JSONbored JSONbored merged commit 4f92e60 into JSONbored:main Jun 30, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. gittensor Gittensor contributor context lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants