Skip to content

feat(miner-discovery): implement MinerGoalSpec parser with safe-default fallback #2301

Description

@JSONbored

Implement the actual parser for .gittensory-miner.yml (the MinerGoalSpec), consuming the schema documented in the companion schema-doc issue. Pure, deterministic, no IO — mirrors parseFocusManifest's malformed-input-degrades-to-safe-defaults behavior in src/signals/focus-manifest.ts exactly: a broken or missing .gittensory-miner.yml must never throw, it must degrade to an empty/neutral spec with a warning.

Deliverables

  • packages/gittensory-engine/lib/miner-goal-spec.tsexport type MinerGoalSpec (fields per the schema-doc issue: preferredLanes, blockedPaths, maxFilesChanged, maxLoc, freshnessDays, avoidLabels, present: boolean, warnings: string[]) and export function parseMinerGoalSpec(raw: unknown): MinerGoalSpec, following the exact malformed-input-degrades pattern of parseFocusManifest (src/signals/focus-manifest.ts:995) — non-object input, array input, and unknown-field input all degrade to a safe empty spec with a warning pushed, never a thrown error.
  • export function parseMinerGoalSpecContent(content: string | null | undefined): MinerGoalSpec — the YAML/JSON string-content wrapper, mirroring parseFocusManifestContent (src/signals/focus-manifest.ts:1043): empty/null content also degrades to the empty spec, not an exception.
  • Unit tests covering: a fully-populated valid spec, a missing file (empty content), a malformed (non-mapping) raw value, and each individual field's out-of-range / wrong-type value degrading independently (mirrors the per-field warning tests already used for parseFocusManifest).
  • Export MinerGoalSpec and both parse functions from packages/gittensory-engine/lib/index.ts so packages/gittensory-miner can import them from @jsonbored/gittensory-engine.

References

  • src/signals/focus-manifest.ts lines 995-1043 (parseFocusManifest, parseFocusManifestContent) — the exact degrade-on-malformed-input pattern to mirror
  • .gittensory-miner.yml.example (from the companion schema-doc issue) — the fixture shape to parse
  • packages/gittensory-engine/lib/index.ts (from the engine-scaffold issue) — where these exports land

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions