Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions contrib/governance-analyst/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
__pycache__/
*.py[cod]
.venv/
.DS_Store
dist/
publish/
data/cache/
data/raw/
data/runs/
data/research/
data/reviews/
data/reviewed/
data/verification/
data/drafts/REVIEW.md
7 changes: 7 additions & 0 deletions contrib/governance-analyst/HANDOFF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Governance report interface proposal

This optional contribution provides a local research and review tool. It does not deploy a PIVX-owned service, modify pivx.ai, or establish official governance policy. The checked-in example is synthetic and must not be presented as a live report.

A separately reviewed static export can provide `governance/latest.json`, `governance/cycle-<n>.json`, `governance/proposers.json` and `governance.schema.json`. Proposal IDs in verified reports are on-chain hashes. Cycle numbers are mainnet payout heights divided by 43,200. Amounts are decimal strings and unknown judgments remain explicit.

Consumers should verify report status, cutoff, source provenance, coverage and review records. Draft JSON is not a reviewed endpoint. Original policies and history accompany reviewed cycle archives. A deployment, correction invitation, integration or public announcement requires a separate explicit decision; this tool performs none of those actions.
15 changes: 15 additions & 0 deletions contrib/governance-analyst/NEUTRALITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Neutrality and corrections — draft

This is a proposed independent public research project. It is not an official PIVX or pivx.ai service. Reports help readers inspect proposals and evidence; they do not recommend yes/no votes, copy votes, or operate wallets or masternodes.

Michael Korovkin is the intended Phase 1 human reviewer. His PIVX roles, funding and relationships with proposers have not yet been supplied. Disclosure status is **pending**. Do not interpret that as a declaration of no affiliations. Publication is blocked until he confirms a disclosure in the report and reviews this policy. Conflicts should be named and, where possible, addressed through an additional reviewer; report any remaining limitation.

Use only public proposal data, public forum posts, public repositories/releases and public price sources. Do not request private dashboards, Grafana, shell access, Discord data, invoices behind authentication, or internal communications even when a proposer offers them. State that such claims were not independently checked. Phase 1 invokes no paid model API, hosting, domain purchase or transactions.

Machine-generated material remains a draft until Michael reviews every proposal and approves the exact package. Review records bind the report, rubric, this policy and proposer-history file. Changing any of them invalidates prior approvals. Project scripts cannot create human sign-off; a human must author review records. Local preview is explicitly marked as unreviewed and excluded from publication artifacts.

The proposed correction process is: prepare a review package; after Michael authorizes outreach, post a public invitation linking to the drafts and a public forum reply or repository issue; record the channel URL and start time; allow at least 48 hours for replies; record responses and edits; obtain final human sign-off; then prepare publication. Elapsed time is not evidence that anyone was contacted. The gate requires a real public invitation URL. No invitation has been posted yet.

Publish a dated correction log, preserve the prior JSON, identify changed factual claims and notify affected proposers through an authorized public channel. Track factual corrections separately from changes in judgment or new evidence. The target of at most one factual correction per cycle is a quality metric, not a reason to suppress corrections. Provide a right of reply; do not infer intent from missing records or community disagreements.

Public engagement and maintainer adoption are external outcomes. Do not count our own drafts, invitations or automated activity as community responses. Voting comparisons are observational and cannot establish that these reports changed voting behavior.
67 changes: 67 additions & 0 deletions contrib/governance-analyst/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Governance analyst prototype

An optional Python tool for preparing cited PIVX governance reports from public, read-only sources. It runs separately from PIVX Core and does not use wallets, submit votes, operate a node, invoke paid model APIs or publish reports automatically. Python 3.9+ and its standard library are sufficient for runtime.

The checked-in data is entirely synthetic: six invented proposals and a bounded historical-search example. It demonstrates the interface and exercises offline tests; it is not a report about real proposers. Default examples are unverified, unreviewed and refused by the publication gate. Real research snapshots, forum bodies, proposer scores and reviewer records are excluded from this contribution.

## Run locally

From the PIVX repository root:

```sh
cd contrib/governance-analyst
python3 -m analyst validate
python3 -m analyst build
```

Open `dist/index.html` to inspect the local synthetic preview. Generated pages have relative links and no external fonts, scripts or analytics. Draft builds emit `governance/draft.json`; only reviewed exports may emit `governance/latest.json` and cycle JSON. Generated `dist/`, raw network data, caches and review artifacts are ignored by Git.

## Collect public evidence

```sh
python3 -m analyst ingest
python3 -m analyst forum data/runs/<run-id>/snapshot.json
python3 -m analyst price
python3 -m analyst history-inputs --pages 3
python3 -m analyst treasury-history data/runs/<run-id>/snapshot.json --out data/research/treasury-history.json
python3 -m analyst draft-inputs data/runs/<run-id>/snapshot.json
```

The collector uses three named community RPC proxies with bounded retries, caching, retained response bytes and retrieval/checksum metadata, and at most one request per second per collector. It validates mainnet genesis, tip freshness, provider agreement, proposal amounts and vote totals. Mainnet's strictly-next payout boundary is `height - height % 43200 + 43200`, including at an exact boundary. Proposal eligibility includes valid objects spanning the next full period regardless of whether the funding projection includes them. Collection failures remain explicit and return exit status 2.

Forum extraction checks robots.txt, follows bounded public pagination, separates quoted text, preserves original post dates and ignores source text as instructions. History reconstruction remains a curated task; discovery is not a delivery audit. The treasury collector cross-checks six previous payment windows against two explorers, reconciles missing index candidates against actual blocks, and distinguishes coinstake budget outputs in satoshis from staking principal. Unsupported payment shapes fail closed.

Public receipts, code artifacts, proposer self-reports and independent delivery verification are separate facts. A missing receipt match does not establish nonpayment. USD conversions need a dated positive quote and exact arithmetic; cost-per-deliverable stays unknown without a comparable denominator. Five editorial dimensions have explicit rationales and confidence; unknown is not zero. No overall score or voting recommendation is produced.

## Drafting and review

Use the versioned prompt in `prompts/`, retain actual inputs and generation provenance, then edit the structured report manually. No inference service is invoked by this tool. The prototype's single-reviewer policy names Michael Korovkin; adapting that policy to another maintainer is future integration work. The rubric, neutrality policy and human-review checks are proposals for review, not an official DAO policy.

```sh
python3 -m analyst review-template path/to/report.json
python3 -m analyst gate path/to/report.json --reviews path/to/reviews.json
python3 -m analyst export path/to/report.json --reviews path/to/reviews.json
```

Pending templates are not approvals. Reviewed export requires a fresh verified chain snapshot, matching coverage/costs, complete bounded historical search records, retained source integrity, disclosure, an authorized public invitation and completed 48-hour correction window, then explicit per-proposal approval. The package hash binds the report, policies, history, prompt and generation inputs. Changes invalidate approval. Export writes local files only; it does not upload or send messages. These checks prevent accidental release through the CLI and cannot stop manual uploading of arbitrary files.

Collection does not automatically replace the checked-in synthetic example. Prepare and review a real report separately. Historical source coverage must be stated honestly and unknown delivery results retained. See [RUBRIC.md](RUBRIC.md), [NEUTRALITY.md](NEUTRALITY.md), [HANDOFF.md](HANDOFF.md) and [VERIFICATION.md](VERIFICATION.md).

## Validation

```sh
python3 -m unittest discover -s tests -v
node --test tests/filter.test.cjs
python3 -m analyst validate
python3 -m analyst build
```

Node is needed only for two optional interaction tests. The runtime contract checker supports the exported schema's exact vocabulary and fails closed on unsupported keywords. Optional independent Draft 2020-12 and actual Chrome desktop/mobile checks use the development dependencies:

```sh
python3 -m venv .venv
.venv/bin/pip install -r requirements-dev.txt
python3 -m http.server 8768 --bind 127.0.0.1 --directory dist
```

In another terminal, from this same directory, run `.venv/bin/python scripts/check_browser.py`. This requires installed Google Chrome. No Core binary build is needed for the optional tool's tests.
21 changes: 21 additions & 0 deletions contrib/governance-analyst/RUBRIC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Proposal analysis rubric — 1.0-draft

Status: proposed for Michael's review. Scores describe the public evidence available at the report's cutoff. They are editorial judgments, not objective measurements, funding rankings or voting instructions. Vote popularity does not affect a score.

Each dimension has an equal published weight of 20%. The prototype displays dimensions individually and does not calculate a weighted total. Changing weights or anchors requires a new rubric version and renewed report review.

| Dimension | 0 | 1 | 2 | 3 | 4 | 5 |
| --- | --- | --- | --- | --- | --- | --- |
| Clarity | Reviewed proposal contains no identifiable work | Vague activity only | Activities identified, major scope gaps | Work and term described, acceptance details limited | Specific outputs and milestones with limited gaps | Outputs, quantities, owners, timing and acceptance tests are explicit |
| Cost reasonableness | Documented material cost inconsistency remains unexplained | Comparable evidence shows major unexplained premium | Some itemization, important unexplained cost gaps | Public breakdown and relevant comparisons broadly support cost | Strong itemization and alternatives support cost | Reproducible estimates, alternatives and sensitivity analysis support cost |
| Verifiability | Reviewed commitments have no public verification route | Claims only | Verification route described but reporting/baselines limited | Public artifacts or reports exist, acceptance gaps remain | Traceable artifacts and clear progress checks | Reproducible acceptance checks and regularly dated evidence |
| Track record | Public evidence establishes repeated material non-delivery | Public evidence establishes significant unresolved misses | Mixed delivery with documented unresolved gaps | Mostly supported delivery with disclosed limitations | Consistently supported delivery across the researched period | Strong supported delivery and timely reporting across the researched period |
| Ecosystem impact | No explained connection to PIVX needs | Weak or speculative connection | Relevant intent with limited beneficiaries or outcomes | Clear connection to a PIVX need; outcomes remain uncertain | Defined beneficiaries and supported outcome indicators | Measured sustained outcomes support the expected benefit |

Use `null` and confidence `unscored` when evidence is unavailable, history is incomplete, or comparisons cannot be made fairly. Never convert missing evidence into zero. Every score needs a short rationale and source IDs; low/medium/high describes evidence confidence. A public promise is evidence of a promise, not delivery. A merged PR or release supports that artifact's existence, not runtime correctness or all work attributed to a proposer. Lack of public evidence does not prove non-delivery. New proposers are unscored on history unless adequate history exists.

Current cycle coverage means all valid on-chain proposals whose term spans the next payout cycle, including failing and not-yet-established proposals. Core's budget projection identifies expected funding only. Invalid/removed proposals may be absent from `getbudgetinfo`; forum candidates outside the roster belong in a separate research queue. Record the cutoff and refresh the roster before review and publication; late additions require another draft and review.

Costs are decimal strings in PIV, with separate cycle and full-term totals. USD is a dated conversion from an independently fetched public quote, never a live promise or an inferred rate from rounded website totals. If the quote is unavailable, USD is null. Divide cost by deliverables only when comparable, quantified units share an explicit period and denominator. Do not divide a maintenance budget by an arbitrary count of bullets, mix capital/liquidity with service fees, or treat invoice claims as verified payments.

Reviewer checklist: reconcile identities and dates; inspect citations; separate proposed and delivered work; inspect cost assumptions and overlap between proposals; review all five dimensions; confirm disclosures; record unknowns; and approve the exact report package hash. A score change triggers another review and a correction record.
11 changes: 11 additions & 0 deletions contrib/governance-analyst/VERIFICATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contribution verification

The contribution uses synthetic checked-in examples so reviewers can run all tests and inspect the interface without fetching public data or publishing unreviewed real-proposer reports. Tests do not require network access, credentials, a node, a wallet or a model API.

The Python suite exercises exact cycle boundaries and decimal costs, eligibility including failing/unestablished proposals, fallback, mainnet identity/freshness, vote mismatches, raw/cache integrity, malformed HTTP responses, request spacing, bounded redirects, robots policy, XHTML/quote/post-date extraction, missing/stale price rejection, contract semantics, historical-search provenance, treasury index gaps and satoshi units. Synthetic integration tests exercise reviewed export, rejection of pending/stale approvals and two-cycle archive preservation. Synthetic approvals stay in temporary test directories.

The two Node tests exercise filtering, empty results/reset and shared script loading on detail pages. Optional `scripts/check_browser.py` checks the synthetic build with independent Draft 2020-12 validation and real Chrome at desktop/mobile widths, including search, no document overflow, local links/anchors and absence of reviewed latest JSON.

These checks do not establish production delivery, official policy acceptance, live-service availability or Core binary correctness. This optional tool does not change Core consensus, wallet or RPC implementation.

Verified on 2026-10-20T04:41:38.482273+00:00: 29 Python tests and two Node tests passed; the report contract and build passed; independent Draft 2020-12 validation passed; Chrome passed 20 desktop/mobile page checks with no document overflow or page JavaScript errors; all 104 local links/anchors resolved. The default reviewed export was not produced.
1 change: 1 addition & 0 deletions contrib/governance-analyst/analyst/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Public-only PIVX governance research. No wallet or voting functionality."""
3 changes: 3 additions & 0 deletions contrib/governance-analyst/analyst/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .cli import main

raise SystemExit(main())
35 changes: 35 additions & 0 deletions contrib/governance-analyst/analyst/archive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Retain reviewed cycle packages locally, without claiming they were deployed."""
from .contract import review_documents, validate_report
from .core import ROOT, DataError, digest, read_json, write_json


def reviewed_packages():
packages = []
for path in sorted((ROOT / "data/reviewed").glob("cycle-*.json")):
package = read_json(path)
validate_report(package["report"])
report = package["report"]
expected = digest({"report": report, "documents": package["documents"]})
if report["status"] != "reviewed" or report["cycle"] is None or package["reviews"]["package_sha256"] != expected:
raise DataError("Archived review package integrity failed: " + str(path))
for review in package["reviews"]["proposals"]:
if review["decision"] != "approved" or review["reviewer"] != "Michael Korovkin" or review["package_sha256"] != expected:
raise DataError("Archived approval is missing or inconsistent")
if {r["proposal_id"] for r in package["reviews"]["proposals"]} != {p["id"] for p in report["proposals"]}:
raise DataError("Archived review coverage failed")
packages.append(package)
return packages


def package_report(report, reviews):
return {"report": report, "reviews": reviews,
"documents": review_documents(report)}


def retain_reviewed(package):
cycle = package["report"]["cycle"]["id"]
path = ROOT / "data/reviewed" / ("cycle-%s.json" % cycle)
if path.exists() and read_json(path) != package:
old = read_json(path)
write_json(ROOT / "data/reviewed/corrections" / ("cycle-%s-%s.json" % (cycle, digest(old)[:16])), old)
write_json(path, package)
Loading
Loading