Skip to content

feat(engine): parse and coerce MinerGoalSpec from raw config#2652

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
kiannidev:feat/miner-goal-spec-parse
Jul 3, 2026
Merged

feat(engine): parse and coerce MinerGoalSpec from raw config#2652
JSONbored merged 1 commit into
JSONbored:mainfrom
kiannidev:feat/miner-goal-spec-parse

Conversation

@kiannidev

@kiannidev kiannidev commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Scope

Validation

  • npm run build && npx tsc -p tsconfig.test.json && node --test dist-test/miner-goal-spec-parse.test.js — 4/4 passing

Safety

  • Pure parser, no IO, no secrets.

Add a pure parser for .gittensory-miner.yml JSON with safe defaults,
warnings, and deep-frozen output as the JSONbored#2293 follow-up module.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev
kiannidev requested a review from JSONbored as a code owner July 3, 2026 00:27
@dosubot dosubot Bot added the size:L label Jul 3, 2026
@loopover-orb

loopover-orb Bot commented Jul 3, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-03 05:33:37 UTC

3 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
The change adds a focused pure parser for the existing MinerGoalSpec shape, wires it through a package subpath export, and covers the main happy and malformed cases. The implementation follows the documented defaults, floors numeric claims, normalizes policy casing, deduplicates trimmed lists, and returns frozen parser output. I do not see a visible correctness break in the changed files, but the malformed-list warning behavior is thinner than the PR description claims.

Nits — 6 non-blocking
  • nit: packages/gittensory-engine/src/miner-goal-spec-parse.ts:36 silently drops empty or overlong list entries without a warning, even though the parser otherwise reports malformed input; either warn there too or document that those values are intentionally ignored quietly.
  • nit: packages/gittensory-engine/src/miner-goal-spec-parse.ts:59 has no upper bound for maxConcurrentClaims, so a malformed but finite huge number can flow through; consider clamping to a conservative maximum if downstream claim fanout will consume this directly.
  • nit: packages/gittensory-engine/test/miner-goal-spec-parse.test.ts:31 only checks wantedPaths is frozen; add blockedPaths/preferredLabels or a mutation assertion if the deep-freeze contract is important.
  • In packages/gittensory-engine/test/miner-goal-spec-parse.test.ts, add coverage for non-string list entries plus empty/too-long strings so the warning/drop policy is locked down.
  • In packages/gittensory-engine/src/miner-goal-spec-parse.ts, consider extracting the string-list limits into exported or documented constants if callers need to explain rejected config values to users.
  • 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 ⚠️ Missing No linked issue or no-issue rationale found.
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:L; no linked issue context).
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: 1700 registered-repo PR(s), 837 merged, 49 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kiannidev; Gittensor profile; 1700 PR(s), 49 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: kiannidev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 1700 PR(s), 49 issue(s).
  • Related work: Titles/paths share 10 meaningful terms. (issue #2278, issue #2280)
  • Related work: Titles/paths share 10 meaningful terms. (issue #2277, issue #2280)
  • Related work: Titles/paths share 8 meaningful terms. (issue #2280, issue #2291)
Contributor next steps
  • Explain no-issue PR.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
  • 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 3, 2026
@dosubot dosubot Bot added the lgtm label Jul 3, 2026
@JSONbored
JSONbored merged commit 34788b0 into JSONbored:main Jul 3, 2026
9 checks passed
nickmopen added a commit to nickmopen/gittensory that referenced this pull request Jul 3, 2026
JSONbored#2294)

Layers the file-content and discovery parts of JSONbored#2294 on top of JSONbored#2652's already-merged
parseMinerGoalSpec(raw) (raw-object validation/coercion), rather than duplicating it.

- miner-goal-spec-parse.ts gains:
  - parseMinerGoalSpecContent(content, source?): YAML-then-JSON decode (looks-like-JSON →
    JSON.parse, else yaml.parse) that delegates to parseMinerGoalSpec, returning the same
    MinerGoalSpecParseResult. Never throws: empty/missing → defaults (present:false); an
    over-large (>64 KiB) file or invalid syntax → defaults + a source-aware warning.
  - MINER_GOAL_SPEC_FILENAMES discovery order (.gittensory-miner.yml → .github/… → .json
    variants) + pure discoverMinerGoalSpecPath(exists).
- Adds the `yaml` dependency. Exposed via the existing ./miner-goal-spec-parse subpath.
- .gittensory-miner.yml.example at repo root (matching .gittensory.yml.example style).

The `gittensory-miner status` wiring stays deferred: that CLI command does not exist yet
(the package ships a stub dispatcher); the parser + discovery are ready for it to consume.

Tests (new content layer only; raw parser already covered by miner-goal-spec-parse.test.ts):
missing/empty → defaults; YAML + JSON decode + delegate; invalid YAML/JSON → source-aware
warning; over-large ignored; discovery order. Engine package: 29/29 pass.
nickmopen added a commit to nickmopen/gittensory that referenced this pull request Jul 3, 2026
…SONbored#2294)

The tolerant parser (parseMinerGoalSpec / parseMinerGoalSpecContent) landed via
JSONbored#2652/JSONbored#2658; this adds the remaining JSONbored#2294 pieces that were still missing on main:

- discoverMinerGoalSpecPath(exists) + MINER_GOAL_SPEC_FILENAMES in miner-goal-spec.ts:
  the documented discovery order (.gittensory-miner.yml → .github/… → .json variants,
  first match wins). Pure — the existence check is injected, so it stays IO-free; a
  caller reads the returned path and feeds it to parseMinerGoalSpecContent. Exported
  from the barrel.
- .gittensory-miner.yml.example at the repo root, matching .gittensory.yml.example's
  header + per-field "Default: X" style.

Tests: discovery order, first-match-wins, null when absent, and that only the listed
candidates are probed. Engine package: 37/37 pass.
JSONbored added a commit that referenced this pull request Jul 3, 2026
…2294) (#2685)

* feat(miner-foundation): MinerGoalSpec file discovery + example doc (#2294)

The tolerant parser (parseMinerGoalSpec / parseMinerGoalSpecContent) landed via
#2652/#2658; this adds the remaining #2294 pieces that were still missing on main:

- discoverMinerGoalSpecPath(exists) + MINER_GOAL_SPEC_FILENAMES in miner-goal-spec.ts:
  the documented discovery order (.gittensory-miner.yml → .github/… → .json variants,
  first match wins). Pure — the existence check is injected, so it stays IO-free; a
  caller reads the returned path and feeds it to parseMinerGoalSpecContent. Exported
  from the barrel.
- .gittensory-miner.yml.example at the repo root, matching .gittensory.yml.example's
  header + per-field "Default: X" style.

Tests: discovery order, first-match-wins, null when absent, and that only the listed
candidates are probed. Engine package: 37/37 pass.

* refactor(miner-foundation): assert discovery short-circuit + ASCII-only example (#2294)

- Add a probe-recording test that discoverMinerGoalSpecPath stops after the first
  match (.github yml), asserting the later .json variants are never probed — so a
  regression that keeps probing would be caught.
- Replace the Unicode arrows/em-dashes in .gittensory-miner.yml.example with ASCII
  (-> and -) for copy/paste-friendly, diff-friendly config docs.

Engine package: 38/38 pass.

---------

Co-authored-by: Nick M <274344962+nickmopen@users.noreply.github.com>
Co-authored-by: ghost <49853598+JSONbored@users.noreply.github.com>
JSONbored added a commit that referenced this pull request Jul 8, 2026
…d duplicate parser (#4318)

Two independently-filed issues (#2652's follow-up to #2293, and #2301)
both specified a MinerGoalSpec parser. Two implementations landed
around the same time: miner-goal-spec.ts became canonical (re-exported
from the package barrel, the only one packages/gittensory-miner's real
caller actually imports), while miner-goal-spec-parse.ts's own PR
explicitly avoided the barrel "while #2628 is open" as a temporary
conflict-avoidance measure that was never reconciled -- it sat
published as its own npm subpath export with zero real callers
anywhere in the repo.

More importantly: the canonical file has the exact resource-exhaustion
bug that #2896 patched in its orphaned sibling and nowhere else.
normalizeStringList's cap check only fired after a candidate was
accepted, so an array of entries that always take the `continue` path
(non-string, duplicate, or empty-after-trim) never hit the cap and got
scanned in full -- a hostile `.gittensory-miner.yml` with thousands of
duplicate/invalid list entries could force unbounded CPU/memory work
and unbounded warning growth on every repo a miner considers, since
this parser runs on untrusted per-repo config.

- Bound normalizeStringList's iteration to the raw array index, before
  any per-entry work, mirroring #2896's fix -- but WITHOUT that fix's
  own latent bug: a trailing `result.length >= cap` break (kept for
  "defense in depth") fires silently, with no warning, whenever the
  input has exactly cap+1 unique valid entries. A pre-existing test
  ("caps oversized string lists and ignores extra entries") caught
  this regression during review. The index-based check alone is both
  necessary and sufficient to bound work; the trailing check is
  removed rather than mirrored.
- Delete the orphaned miner-goal-spec-parse.ts and its dedicated test
  (confirmed zero real callers, in-repo or via its published subpath).
- Remove the ./miner-goal-spec-parse subpath from package.json's
  exports map. BREAKING CHANGE: @jsonbored/gittensory-engine's
  published subpath export is removed. The package is one week old
  with a single in-repo consumer that never used this subpath; no
  known external impact.
- Add hostile-input regression tests (all-non-string, all-duplicate,
  all-empty, all-overlong) to both the package-level and root-level
  test suites for the canonical parser, mirroring the coverage #2896
  added for its now-deleted sibling.
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants