feat(miner-foundation): MinerGoalSpec type definitions (#2293) - #2603
Conversation
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.
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-02 22:56:50 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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.
|
…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.
Closes #2293.
Defines the TypeScript type surface for a repo's
.gittensory-miner.yml— the miner-side analogue of the review-side.gittensory.ymlfocus manifest — in the shared@jsonbored/gittensory-enginepackage (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 howFocusManifest's type precedes its parser.Deliverables
src/miner-goal-spec.ts:MinerGoalSpec—minerEnabled: 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,1concurrent claim,neutraldiscovery.MinerIssueDiscoveryPolicyunion.Default: Xon every field, matching the.gittensory.yml.exampleconvention.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 testinpackages/gittensory-engine(tsc build +node:test):Covered for this module:
DEFAULT_MINER_GOAL_SPEC's exact runtime values and field surface; a compile-time check that it satisfiesMinerGoalSpec(failstscif the shape drifts); and a lint-style test asserting every field documents aDefault:in its JSDoc. No parser logic (out of scope).tscclean understrict+noUncheckedIndexedAccess.