Skip to content

feat(dlq): add dead-letter job-type breakdown helper - #2602

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
9876543210-tc-0123456789:feat/dlq-dead-letter-breakdown-2082
Jul 2, 2026
Merged

feat(dlq): add dead-letter job-type breakdown helper#2602
JSONbored merged 2 commits into
JSONbored:mainfrom
9876543210-tc-0123456789:feat/dlq-dead-letter-breakdown-2082

Conversation

@9876543210-tc-0123456789

Copy link
Copy Markdown
Contributor

Summary

  • Add countRecentDeadLettersByType beside the existing DLQ counter so the dashboard can aggregate recent dead letters by jobType.
  • Normalize missing or blank jobType metadata to unknown and return a deterministically sorted object shape for stable consumers.
  • Add unit coverage for multi-type, single-type, empty-window, and unknown-fallback branches.

Closes #2082.
Part of #1208.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • npm run test:ci was run end-to-end locally, which executed the lint, coverage, workers, MCP, REES, and UI validation steps above.
  • npx vitest run test/unit/db-parsers.test.ts was also run while iterating on the new helper and tests.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable; this PR only adds a backend repository helper and unit tests.

Notes

@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 22:35:04 UTC

2 files · 1 AI reviewer · no blockers · readiness 62/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
The change adds a narrow repository helper that counts recent DLQ audit events by normalized `jobType`, with SQL-level fallback for missing or blank metadata and deterministic ordering before constructing the returned object. The added tests exercise multi-key grouping, single-key grouping, empty windows, and the unknown fallback, so the visible behavior matches the PR description. I do not see a reachable correctness break in the changed code from the provided diff.

Nits — 5 non-blocking
  • nit: `src/db/repositories.ts:2240` uses a long block comment for a small helper; consider converting it to the shorter house style if nearby repository helpers avoid multi-line narrative comments.
  • nit: `test/unit/db-parsers.test.ts:374` covers missing and blank `jobType`, but it does not pin behavior for a non-string JSON value; add that only if the dashboard contract needs to tolerate malformed producer metadata.
  • `src/db/repositories.ts:2243`: If consumers require stable key order for arbitrary metadata, document that numeric-looking job types are not part of the contract because JavaScript object enumeration reorders integer-like keys.
  • `test/unit/db-parsers.test.ts:374`: A small assertion that stale DLQ rows are excluded even when they share a grouped `jobType` would make the cutoff behavior explicit for this new aggregate helper.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2082
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:S; 1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 37 registered-repo PR(s), 17 merged, 3 issue(s).
Contributor context ✅ Confirmed Gittensor contributor DragunovX16; Gittensor profile; 37 PR(s), 3 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
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

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.02%. Comparing base (612969d) to head (144fd35).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2602   +/-   ##
=======================================
  Coverage   96.02%   96.02%           
=======================================
  Files         233      233           
  Lines       26077    26081    +4     
  Branches     9474     9474           
=======================================
+ Hits        25041    25045    +4     
  Misses        425      425           
  Partials      611      611           
Files with missing lines Coverage Δ
src/db/repositories.ts 96.55% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9876543210-tc-0123456789
9876543210-tc-0123456789 force-pushed the feat/dlq-dead-letter-breakdown-2082 branch from 1f84356 to c4d366c Compare July 2, 2026 12:47
@dosubot dosubot Bot added the lgtm label Jul 2, 2026
@JSONbored
JSONbored merged commit 05cff17 into JSONbored:main Jul 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(dlq): per-job-type dead-letter breakdown helper for the DLQ dashboard

2 participants