Skip to content

refactor(build): extract enrichment-queue pure module from build-artifacts#2047

Open
kiannidev wants to merge 1 commit into
JSONbored:mainfrom
kiannidev:refactor/2042-enrichment-queue-lib
Open

refactor(build): extract enrichment-queue pure module from build-artifacts#2047
kiannidev wants to merge 1 commit into
JSONbored:mainfrom
kiannidev:refactor/2042-enrichment-queue-lib

Conversation

@kiannidev

@kiannidev kiannidev commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #2042.

Extracts enrichment queue / evidence / targets artifact derivation from scripts/build-artifacts.mjs into scripts/lib/enrichment-queue-artifacts.mjs, following the scripts/lib/build-readiness.mjs decomposition pattern (#1901).

Scope summary

Area Change
Files touched 2 — scripts/lib/enrichment-queue-artifacts.mjs (new), scripts/build-artifacts.mjs (import refactor)
Behavior change None — byte-identical review/enrichment-queue.json, evidence, and targets artifacts
Generated artifacts None committed
Functions extracted buildEnrichmentQueueArtifacts + ~25 helpers; directSubmissionKindsForProfile re-exported for profile artifact builder
Tests No new test file — existing artifacts.test.mjs enrichment invariants cover output
Out of scope No registry, API contract, schema, or workflow changes

What Changed

  • scripts/lib/enrichment-queue-artifacts.mjs (~1000 lines): pure enrichment queue / evidence / targets derivation
  • scripts/build-artifacts.mjs: imports from new module (−960 lines); passes contractVersion + generatedAt explicitly

Registry Safety

  • No secrets, PATs, wallet data, private dashboards, private URLs, or validator-local state.
  • No generated artifacts committed.
  • No public API/OpenAPI/schema changes.

Validation

  • node scripts/build-artifacts.mjs succeeds
  • npm run lint + npm run format:check — passed
  • Byte-identical enrichment artifact output (pure refactor)

Test plan

  • node scripts/build-artifacts.mjs — build succeeds
  • npm run lint + npm run format:check — passed locally
  • CI npm test (includes artifacts.test.mjs enrichment invariants)

…facts (JSONbored#2042)

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev kiannidev requested a review from JSONbored as a code owner June 26, 2026 23:12
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (2bcd5c1) to head (b33888d).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2047   +/-   ##
=======================================
  Coverage   93.23%   93.23%           
=======================================
  Files          48       48           
  Lines        7626     7626           
  Branches     2804     2804           
=======================================
  Hits         7110     7110           
  Misses         90       90           
  Partials      426      426           

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gittensory-orb

gittensory-orb Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review — held for maintainer review

2 files · 1 AI reviewers · no blockers · readiness 55/100 · CI green · unknown

⏸️ Held for maintainer review — Touches a guarded path — held for manual review

Review summary
This PR mechanically extracts ~960 lines of enrichment queue, evidence, and targets derivation from `build-artifacts.mjs` into a new pure module `scripts/lib/enrichment-queue-artifacts.mjs`, following the existing `build-readiness.mjs` decomposition pattern. The only non-verbatim change — converting `contractVersion` and `generatedAt` from closed-over module-level variables into explicit parameters — is applied correctly at both the new function signature and the call site in `build-artifacts.mjs`. All CI checks pass and the byte-identical output claim is credible.

Signal Result Evidence
Code review ✅ No blockers 1 reviewers, synthesized
Linked issue ✅ Linked #2042
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Review load ❌ 8/20 Readiness component derived from cached public PR metadata and labels.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 20 open PR(s), 15 likely reviewable, 5 unlinked.
Contributor context ✅ Confirmed Gittensor contributor kiannidev; Gittensor profile; 3052 PR(s), 55 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Nits — 8 non-blocking
  • `countBy`, `groupBy`, and `groupByNetuid` are duplicated verbatim between `build-artifacts.mjs` and `enrichment-queue-artifacts.mjs`; lifting them to `lib.mjs` would prevent future divergence between the two copies.
  • `enrichmentContributionHint` in `enrichment-queue-artifacts.mjs` contains a dead branch for `lane === "monitoring-followup"` — `enrichmentLane` only ever returns `"baseline-monitoring"` as its fallback, so that hint string is unreachable (pre-existing issue, but more conspicuous in isolation).
  • `monitoring_followup_count` in `queueArtifact.summary` filters on `lane === "monitoring-followup"`, which `enrichmentLane` never produces, so this summary field is always 0 in practice (also pre-existing).
  • Move `countBy`, `groupBy`, and `groupByNetuid` from `enrichment-queue-artifacts.mjs` (and `build-artifacts.mjs`) into `lib.mjs` — they are stable pure utilities now shared identically across both build scripts.
  • Follow up to reconcile `"monitoring-followup"` vs `"baseline-monitoring"`: either rename the lane returned by `enrichmentLane` to `"monitoring-followup"` throughout, or remove the dead branch in `enrichmentContributionHint` and drop the always-zero `monitoring_followup_count` summary field.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
  • Diff looks like trivial or whitespace-only churn — Reduce whitespace-only or formatting-only churn and keep the diff focused on substantive changes.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Review context
Contributor next steps
  • Review top overlaps.
  • Add scope summary.
  • Fix blocker.
  • Expect slower review.
  • 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.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Review details

Generated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative.

This PR mechanically extracts ~960 lines of enrichment queue, evidence, and targets derivation from `build-artifacts.mjs` into a new pure module `scripts/lib/enrichment-queue-artifacts.mjs`, following the existing `build-readiness.mjs` decomposition pattern. The only non-verbatim change — converting `contractVersion` and `generatedAt` from closed-over module-level variables into explicit parameters — is applied correctly at both the new function signature and the call site in `build-artifacts.mjs`. All CI checks pass and the byte-identical output claim is credible.

Nits (5)

  • `countBy`, `groupBy`, and `groupByNetuid` are duplicated verbatim between `build-artifacts.mjs` and `enrichment-queue-artifacts.mjs`; lifting them to `lib.mjs` would prevent future divergence between the two copies.
  • `enrichmentContributionHint` in `enrichment-queue-artifacts.mjs` contains a dead branch for `lane === "monitoring-followup"` — `enrichmentLane` only ever returns `"baseline-monitoring"` as its fallback, so that hint string is unreachable (pre-existing issue, but more conspicuous in isolation).
  • `monitoring_followup_count` in `queueArtifact.summary` filters on `lane === "monitoring-followup"`, which `enrichmentLane` never produces, so this summary field is always 0 in practice (also pre-existing).
  • Move `countBy`, `groupBy`, and `groupByNetuid` from `enrichment-queue-artifacts.mjs` (and `build-artifacts.mjs`) into `lib.mjs` — they are stable pure utilities now shared identically across both build scripts.
  • Follow up to reconcile `"monitoring-followup"` vs `"baseline-monitoring"`: either rename the lane returned by `enrichmentLane` to `"monitoring-followup"` throughout, or remove the dead branch in `enrichmentContributionHint` and drop the always-zero `monitoring_followup_count` summary field.

🟩 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 Bug labels Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Bug gittensor Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(build): extract enrichment-queue pure module from build-artifacts

1 participant