Skip to content

refactor(queue): extract gate-check policy/publish/audit functions into their own module - #4965

Merged
JSONbored merged 1 commit into
mainfrom
refactor/4013-extract-gate-checks
Jul 11, 2026
Merged

refactor(queue): extract gate-check policy/publish/audit functions into their own module#4965
JSONbored merged 1 commit into
mainfrom
refactor/4013-extract-gate-checks

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Part of #4013 (more extraction steps remain in the sequence — not closing the tracking issue).

Test plan

  • npx tsc --noEmit -p . — zero errors
  • npx vitest run test/unit test/integration — 696/697 files passed (1 skipped, pre-existing)
  • npm run test:coverage (unsharded) — 94.46% statements / 93.43% branches / 93.7% functions / 95.04% lines, no threshold failures; gate-checks.ts itself is 100% line + branch + function covered
  • npm run docs:drift-check, npm run manifest:drift-check, npm run engine-parity:drift-check — all ok
  • npm audit --audit-level=moderate — 0 vulnerabilities

@superagent-security

superagent-security Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor
\nSuperagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.26%. Comparing base (b94589c) to head (fe888de).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4965   +/-   ##
=======================================
  Coverage   94.26%   94.26%           
=======================================
  Files         448      449    +1     
  Lines       38900    38900           
  Branches    14172    14172           
=======================================
  Hits        36669    36669           
  Misses       1574     1574           
  Partials      657      657           
Flag Coverage Δ
shard-1 46.54% <94.11%> (-0.29%) ⬇️
shard-2 33.58% <88.23%> (+0.26%) ⬆️
shard-3 31.56% <76.47%> (+0.14%) ⬆️
shard-4 32.61% <47.05%> (-0.54%) ⬇️
shard-5 34.14% <0.00%> (+0.61%) ⬆️
shard-6 45.86% <52.94%> (+0.61%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/gate-checks.ts 100.00% <100.00%> (ø)
src/queue/processors.ts 95.41% <ø> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 11, 2026
@loopover-orb

loopover-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-11 05:31:25 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This is a pure mechanical extraction of three functions (gateCheckPolicy, recordPublishedGateCheckSummary, auditGateCheckPermissionMissing) from processors.ts into a new gate-checks.ts module, matching the established pattern from the prior seven steps of the #4013 split sequence. The moved code is byte-identical to the original (comments, v8-ignore pragmas, and logic all preserved), imports in the new file are all accounted for (recordAuditEvent/upsertCheckSummary, GITTENSORY_GATE_CHECK_NAME, guardrailPathMatches, RepositorySettings, nowIso), and processors.ts correctly drops upsertCheckSummary from its own import list while re-exporting only gateCheckPolicy (the only one of the three that was previously exported and consumed by external test files) to preserve the existing test import paths. No behavior change is evident anywhere in the diff.

Nits — 4 non-blocking
  • No new test-path changes accompany this move (external brief flags 0 test lines added) — worth a one-line confirmation in the PR that test/unit/gate-check-policy.test.ts and test/unit/repository-settings-enforcement.test.ts still pass unchanged against the re-export shim, since that's the only coverage evidence for the moved code.
  • The flagged console.error at src/queue/gate-checks.ts:138 is pre-existing code moved verbatim (with a comment justifying it as an intentional Sentry-visibility signal for an install-wide permission gap), not a new debug leftover — no action needed, but worth noting for anyone scanning the diff cold.
  • Once the remaining refactor(queue): split processors.ts into cohesive modules #4013 steps land and processors.ts is fully decomposed, consider dropping the processors.ts re-export shims in a follow-up cleanup PR that also updates the two test files' import paths directly to ../../src/queue/gate-checks, rather than carrying the shim indefinitely.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 48 registered-repo PR(s), 40 merged, 423 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 48 PR(s), 423 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ⚠️ ℹ️ None detected risk: low · value: none — No structural-improvement signals were detected for this PR.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 48 PR(s), 423 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • 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

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 11, 2026
…to their own module

Part of #4013's module-split sequence (step 8, after transient-locks.ts,
signal-snapshot.ts, duplicate-detection.ts, slop-detection.ts,
review-evasion.ts, ci-resolution.ts, and retention.ts): gateCheckPolicy,
recordPublishedGateCheckSummary, and auditGateCheckPermissionMissing
move to src/queue/gate-checks.ts. Pure mechanical move, no behavior
change. These three were never physically adjacent in the original
file (interspersed with unrelated linked-issue/pre-merge-check/public-
surface helpers that stay behind), but share no state and have no
caller besides processors.ts's own many disposition/publish call
sites, so they group cleanly by concern here.

A re-export shim keeps this file's own internal callers and the
existing test/unit/gate-check-policy.test.ts /
test/unit/repository-settings-enforcement.test.ts imports working
unchanged.
@JSONbored
JSONbored force-pushed the refactor/4013-extract-gate-checks branch from 89c5612 to fe888de Compare July 11, 2026 04:43
@JSONbored
JSONbored merged commit ab45d70 into main Jul 11, 2026
18 checks passed
@JSONbored
JSONbored deleted the refactor/4013-extract-gate-checks branch July 11, 2026 05:35
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 — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant