feat(miner): validate config content in doctor, not just its path - #5402
Conversation
doctor only reported the discovered .gittensory-miner config file's path, so a malformed config silently degraded to defaults instead of being caught before a run. Add a config-content check that parses the discovered config with the tolerant goal-spec parser and surfaces its warnings, so doctor reports specific, actionable errors (and exits non-zero) for a malformed config. No config file is fine (defaults apply); a read failure is reported. runDoctorChecks/runDoctor now take an optional cwd (the config is discovered relative to it), defaulting to process.cwd(). Closes JSONbored#4873
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5402 +/- ##
=======================================
Coverage 94.44% 94.44%
=======================================
Files 552 552
Lines 44291 44298 +7
Branches 14657 14657
=======================================
+ Hits 41832 41839 +7
Misses 1784 1784
Partials 675 675
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-12 16:52:11 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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.
|
Summary
doctoronly reported the discovered.gittensory-minerconfig file's path — it never validated the file's content, so a malformed config silently degraded to defaults instead of being caught before a run.This adds a
config-contentdoctor check: it parses the discovered config with the engine's tolerant goal-spec parser (parseMinerGoalSpecContent) and surfaces itswarnings, sodoctorreports specific, actionable errors for a malformed config (e.g.MinerGoalSpec field "wantedPaths" must be a list; ignoring a string value) and exits non-zero.runDoctorChecks/runDoctornow take an optionalcwd(the config is discovered relative to it), defaulting toprocess.cwd()— backward-compatible.Scope
packages/), noblockedPaths, no secrets/private terms.d.tscompanion updated (new export + the optionalcwdparams)Validation
npm run typechecknpm run test:coverage(full unsharded suite)test/unit/miner-status.test.ts:checkConfigContentunit tests (no config → pass, well-formed → pass, malformed → flagged with the parser's warnings, unreadable → reported), the doctor check list now includesconfig-content, anddoctorflags a malformed config file and exits non-zeromainbaseline (the one Windows-only path-separator test failure is pre-existing and unrelated)Safety
Closes #4873