Skip to content

feat(miner-foundation): MinerGoalSpec type definitions (#2293) - #2603

Merged
JSONbored merged 4 commits into
JSONbored:mainfrom
nickmopen:feat/miner-goal-spec
Jul 2, 2026
Merged

feat(miner-foundation): MinerGoalSpec type definitions (#2293)#2603
JSONbored merged 4 commits into
JSONbored:mainfrom
nickmopen:feat/miner-goal-spec

Conversation

@nickmopen

Copy link
Copy Markdown
Contributor

Closes #2293.

Defines the TypeScript type surface for a repo's .gittensory-miner.yml — the miner-side analogue of the review-side .gittensory.yml focus manifest — in the shared @jsonbored/gittensory-engine package (per the phase's "shared logic lives in gittensory-engine" principle). Types only; the parser (raw-YAML validation + coercion) is a separate follow-up issue, mirroring how FocusManifest's type precedes its parser.

Deliverables

  • src/miner-goal-spec.ts:
    • MinerGoalSpecminerEnabled: boolean, wantedPaths: string[], blockedPaths: string[], preferredLabels: string[], maxConcurrentClaims: number, issueDiscoveryPolicy: "encouraged" | "neutral" | "discouraged". Field names/semantics that overlap the review side are carried over verbatim from .gittensory.yml.
    • DEFAULT_MINER_GOAL_SPEC — the safe defaults: minable by explicit opt-out (minerEnabled: true, so a public repo with no file is still minable), no path/label preferences, 1 concurrent claim, neutral discovery.
    • MinerIssueDiscoveryPolicy union.
    • JSDoc Default: X on every field, matching the .gittensory.yml.example convention.
  • Exported from the package barrel.

Field list is intentionally small for this foundation phase (easy to add later, painful to remove once relied on). Unblocks the goal-model (#2304) and the parser issues.

Validation

npm test in packages/gittensory-engine (tsc build + node:test):

ℹ tests 18
ℹ pass 18
ℹ fail 0

Covered for this module: DEFAULT_MINER_GOAL_SPEC's exact runtime values and field surface; a compile-time check that it satisfies MinerGoalSpec (fails tsc if the shape drifts); and a lint-style test asserting every field documents a Default: in its JSDoc. No parser logic (out of scope). tsc clean under strict + noUncheckedIndexedAccess.

Add the type surface for a repo's .gittensory-miner.yml — the miner-side analogue
of the .gittensory.yml focus manifest — in the shared gittensory-engine package.
Types only; the parser is a separate follow-up.

- src/miner-goal-spec.ts: `MinerGoalSpec` (minerEnabled, wantedPaths, blockedPaths,
  preferredLabels, maxConcurrentClaims, issueDiscoveryPolicy) with a JSDoc
  "Default: X" on every field, plus `DEFAULT_MINER_GOAL_SPEC` (safe defaults:
  minable by explicit opt-out, no path/label preference, 1 claim, neutral
  discovery) and the `MinerIssueDiscoveryPolicy` union. Field names/semantics
  overlapping the review side are carried over verbatim from .gittensory.yml.
- Export all three from the package barrel.

Tests: assert the default's runtime values + exact field surface, a compile-time
check that DEFAULT_MINER_GOAL_SPEC satisfies MinerGoalSpec, and a lint-style test
that every field documents a "Default:" in its JSDoc. 18/18 pass.
@nickmopen
nickmopen requested a review from JSONbored as a code owner July 2, 2026 12:31
@dosubot dosubot Bot added the size:M label Jul 2, 2026
@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:56:50 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
The change adds a narrow exported TypeScript type surface, default singleton, README note, and tests for the new repo config contract. The runtime default values, barrel export, and deep-freeze behavior are coherent with the stated types-only scope, and the tests exercise the public package entrypoint plus the field surface. I do not see a reachable correctness defect in the provided files.

Nits — 5 non-blocking
  • nit: packages/gittensory-engine/src/miner-goal-spec.ts:24 uses `readonly string[]` for list fields while the PR description says `string[]`; either align the public type with the advertised contract or document that parsed specs are intentionally immutable.
  • nit: packages/gittensory-engine/test/miner-goal-spec.test.ts:47 relies on a regex over source text for JSDoc coverage, which is fine as a lightweight guard but brittle if formatting changes around the type fields.
  • packages/gittensory-engine/src/miner-goal-spec.ts:24: decide whether the parsed config object should be mutable by consumers; if not, update the issue/README language to call out readonly arrays explicitly.
  • packages/gittensory-engine/test/miner-goal-spec.test.ts:47: keep the source-layout assertion, but consider tightening the regex to the `export type MinerGoalSpec = { ... }` body so future unrelated docs cannot accidentally satisfy it.
  • 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 #2293
Related work ⚠️ 3 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:M; 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: 100 registered-repo PR(s), 65 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nickmopen; Gittensor profile; 100 PR(s), 1 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
…aims range (JSONbored#2293)

- Make the array fields `readonly string[]` and deep-freeze DEFAULT_MINER_GOAL_SPEC
  (object + arrays) so the shared singleton can't be mutated; a test asserts the
  freeze. Callers clone before layering repo overrides.
- Document maxConcurrentClaims as a positive integer (>= 1) with the parser
  expected to floor/reject below-1 values.

npm test: 19/19 pass.
…path (JSONbored#2293)

- maxConcurrentClaims contract now names a single coercion rule (floor a
  non-integer via Math.floor, reject below 1) instead of the ambiguous
  "floor/round", since the comment is the parser contract.
- Comment the field-documentation test to confirm dist-test/ is a sibling of
  src/ so ../src/ resolves independent of emit details (readFileSync fails loud
  otherwise).

npm test: 19/19 pass.
…SONbored#2293)

The default was runtime-frozen but typed mutable, so DEFAULT.maxConcurrentClaims = 2
compiled and only failed at runtime. Type it Readonly<MinerGoalSpec> so the
compile-time API matches the frozen runtime contract. Also escape field names
before interpolating them into the source-lint RegExp, so that helper stays safe
if reused on a less controlled field surface.

npm test: 19/19 pass.
@dosubot dosubot Bot added the lgtm label Jul 2, 2026
@JSONbored
JSONbored merged commit 36405d4 into JSONbored:main Jul 2, 2026
8 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(miner-foundation): MinerGoalSpec type definitions for .gittensory-miner.yml

2 participants