Skip to content

feat(miner): add governor event ledger schema and writer - #2795

Merged
loopover-orb[bot] merged 6 commits into
JSONbored:mainfrom
jony376:feat/miner-opportunity-metadata-ranker
Jul 3, 2026
Merged

feat(miner): add governor event ledger schema and writer#2795
loopover-orb[bot] merged 6 commits into
JSONbored:mainfrom
jony376:feat/miner-opportunity-metadata-ranker

Conversation

@jony376

@jony376 jony376 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add typed governor ledger normalization in @jsonbored/gittensory-engine with a fixed decision vocabulary.
  • Add append-only local SQLite writer in @jsonbored/gittensory-miner mirroring the existing event-ledger pattern.
  • Cover happy-path appends, fail-closed unknown event types, repo filtering, and payload round-trips in unit tests.

Closes #2328.

Scope

Validation

  • npm run test:ci locally — Node.js is not installed on the contributor machine; CI will run the full gate on push.
  • New behavior has unit tests for all event types, malformed input rejection, repo filtering, and SQLite permissions.

Safety

  • No secrets, wallet details, hotkeys, or private scoring output in code or PR text.
  • Local-only storage: insert + select only, no GitHub writes, no uploads.

UI Evidence

Not applicable — engine + miner package only.

Notes

  • Mirrors src/selfhost/audit.ts structured-event shape and the miner event-ledger.js local-store pattern.
  • Does not wire governor enforcement yet; this issue defines the storage contract other governor issues will populate.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.22%. Comparing base (db13f71) to head (f4a28a2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2795   +/-   ##
=======================================
  Coverage   96.22%   96.22%           
=======================================
  Files         255      256    +1     
  Lines       27998    28005    +7     
  Branches    10174    10176    +2     
=======================================
+ Hits        26941    26948    +7     
  Misses        433      433           
  Partials      624      624           
Files with missing lines Coverage Δ
packages/gittensory-engine/src/governor-ledger.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-03 22:04:15 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
The change adds a typed governor ledger normalizer in the engine package and a local SQLite append/read wrapper in the miner package, with tests covering the visible happy path, rejection path, repo filtering, singleton handling, and permissions. The storage path, insert flow, and row decoding are coherent, and the miner writer uses the engine normalizer before every insert. The main maintainability issue is that the new engine helpers are hidden from coverage even though they contain the meaningful validation branches this PR is adding.

Nits — 6 non-blocking
  • packages/gittensory-engine/src/governor-ledger.ts:29 wraps the core validation helpers in `v8 ignore` even though these are the changed branches that define this feature, so remove the ignore block and let the existing tests count the real normalization paths.
  • packages/gittensory-miner/lib/governor-ledger.js:30 assumes `dbPath` is string-like and throws a raw `.trim` TypeError for bad programmatic input; normalize it like the env handling and throw `invalid_governor_ledger_db_path` instead.
  • packages/gittensory-miner/lib/governor-ledger.d.ts:13 exposes `eventType` as an open string even though the engine vocabulary is closed; exporting or mirroring the fixed union would keep TypeScript callers from constructing events the runtime always rejects.
  • Remove the `v8 ignore` block around `normalizeRequiredString`, `normalizeOptionalRepoFullName`, and `serializePayload` in `packages/gittensory-engine/src/governor-ledger.ts:29`.
  • Tighten `normalizeDbPath` in `packages/gittensory-miner/lib/governor-ledger.js:30` to check `typeof path === "string"` before trimming.
  • 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 #2328
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 (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: 890 registered-repo PR(s), 639 merged, 28 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jony376; Gittensor profile; 890 PR(s), 28 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: jony376
  • 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: 890 PR(s), 28 issue(s).
  • Related work: Titles/paths share 9 meaningful terms. (issue #2287, issue #2291)
  • Related work: Titles/paths share 8 meaningful terms. (issue #2280, issue #2291)
  • Related work: Titles/paths share 8 meaningful terms. (issue #2278, issue #2291)
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

jony376 and others added 4 commits July 3, 2026 15:00
)

Co-authored-by: Cursor <cursoragent@cursor.com>
Exercise non-string field rejection, null/array payloads, default singleton
helpers, and repo-filter validation so patch coverage clears the 99% gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
…echeck

Co-authored-by: Cursor <cursoragent@cursor.com>
jony376 and others added 2 commits July 3, 2026 15:00
…ch gate

Co-authored-by: Cursor <cursoragent@cursor.com>
@jony376
jony376 force-pushed the feat/miner-opportunity-metadata-ranker branch from bd2c16c to f4a28a2 Compare July 3, 2026 22:00

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit cea601f into JSONbored:main Jul 3, 2026
10 checks passed
JSONbored added a commit that referenced this pull request Jul 3, 2026
…util import (#2855)

Two independently-merged PRs (#2787, #2795) landed a build-breaking
state on main: a spliced-in export block ate the opening brace of the
adjacent contributor-fit re-export (TS1005/TS1109), and governor-ledger.ts
imports node:util under this package's types:[] tsconfig, which never
resolves the module's type declarations. Both broke `tsc --noEmit` and
`build:miner` for every contributor. Replaced isDeepStrictEqual with a
small local structural-equality check scoped to the JSON-safe values this
one call site actually compares.
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.

feat(miner-governor): append-only local event ledger schema + writer

1 participant