Skip to content

Add the donation config keys, off by default, and render them for the dashboard #3693

Closed

Description

@pithead-developer

What's the problem

Part of #2476. Owner priority (2026-10-27): build the opt-in donation feature now, shipping dark. Every other child binds to three config names that do not exist yet. The defaults table (dashboard/mining_dashboard/config/defaults.json:13-27) has proxy.donate_level and the xvb block and nothing for a project donation, so nothing can reach the dashboard.

Add, as a new donation block after xvb:

  • donation.enabled, false.
  • donation.percent, integer 1 to 10, default 2 (the value used when first enabled; the owner has not ruled on the default).
  • donation.tor, true.

Each surface that already carries xvb.tor needs the matching change:

  • Generated exports: run scripts/build-config-defaults.py (:10-47); it rewrites config.reference.json and lib/pithead/19a-config-defaults.sh. The --check leg (:50-75) is run by tests/stack/standalone/test_config_defaults.sh:6.
  • Validation: lib/pithead/28-parse-and-validate-config.sh, beside the proxy.donate_level check at :223-232 (file is 412 of 464 lines).
  • Render: lib/pithead/33-render-env.sh, next to the xvb_tor read at :127-139 and the env lines at :364-368 (466 of 481 lines, so about 15 spare). Emit DONATION_ENABLED, DONATION_PERCENT, DONATION_TOR_ENABLED.
  • Compose, DIY only: the dashboard service env beside XVB_TOR_ENABLED (docker-compose.yml:745-746). The appliance unit is a separate child.
  • Dashboard config: config/config.py next to XVB_TOR_ENABLED (:178), defaults read through default_of as ENABLE_XVB does (:166-168) (674 of 693 lines).
  • Config editor: web/static/config/configlogic.mjs LOGICAL_GROUPS (:98-114). configlogic.test.mjs:170-178 fails any config.reference.json leaf that no group claims, so the donation prefix must be added to a group (the Mining group, beside xvb).
  • Change previews: rows for the three keys in lib/pithead/39b-describe-change-exposure.sh (the XVB_TOR_ENABLED row :33-43 is the pattern), not in 39-describe-change.sh, which is 395 lines. Plain sentences, flagged CONFIRM; for donation.tor false, name that the project endpoint sees this host's IP.
  • Support bundle: lib/pithead/07-support-bundle.sh:17-39 redacts any .env key missing from its survivor list, and tests/integration/selftest/selftest-bundle-redact-env.sh:199 mirrors it and fails by name on a disagreement. Classify the three keys as survivors (not secret).
  • Reference docs: three rows in docs/configuration.md beside the xvb.* rows (:257-259).
  • Gate: the keys are schema-backed, so they take the unlisted route that demands the typed APPLY (lib/pithead/42-control-policy-and-host-checks.sh:42-45, :125-129). Do not add DONATION_* to CONTROL_DASHBOARD_EDITABLE_KEYS (:51-67) or CONTROL_DASHBOARD_APPROVAL_KEYS (:113): the typed APPLY on the unlisted route is where an operator confirms a route change. It prevents operator mistakes, not hostile requests (:30-31), which is why the destination lives in image constants ({{A2}}) and not in these keys.

What it impacts

Existing installs: additive only. A config without the block takes the defaults, no key is rewritten and no migration runs. New installs on all three setup paths. The config editor gains three fields in its Mining group, the support bundle shows the three values, and the rendered .env gains three lines.

How I found it

Read-only scan of origin/develop-v2.1.0 at 02852bd on 2026-10-27 from the paths above. Nothing was executed. Unknown: whether #3632, #3575 or #3576 land first (they edit the same defaults, parse and render files; keep this diff additive and rebase), and the first-enable percentage the owner wants (2 is a suggestion).

How important is it

High inside this lane: every other child depends on these names. Low risk: additive, off by default.

Acceptance criteria

  • python3 scripts/build-config-defaults.py --check passes. The table holds the three keys for diy and appliance; none is in materialize, so config.minimal.json and config.minimal.appliance.json are unchanged.
  • Parse tests under tests/stack/config/ (new file): donation.percent of 0, 11, "5", 2.5 and true fail with a message naming donation.percent; 1 to 10 pass; absent takes the default. donation.enabled and donation.tor accept booleans only.
  • Default off on every path: after the CLI wizard Enter-through, the browser wizard answers, the no-JS form, both minimal configs and the sparse 2.0.0 config, the rendered env has DONATION_ENABLED=false (extend the rows in tests/stack/standalone/test_config_defaults.sh:11-48 and dashboard/tests/web/test_config_defaults.py).
  • The golden env fixtures tests/stack/fixtures/config-2.0.0/diy.env and appliance.env change only by the three added default lines; every existing line is byte-identical (test_config_defaults.sh:33-35).
  • docker-compose.yml passes the three values to the dashboard; a compose test pins them.
  • Dashboard tests (new file, dashboard/tests/config/test_config.py is at its ceiling): the config module exposes the three values and defaults them from the table.
  • configlogic.test.mjs:170-178 passes with the donation prefix claimed.
  • A host preview test beside tests/stack/control/control-sensitive-preview.sh:77-86: enabling and each percent change produce a plain sentence; donation.tor false names the IP exposure. A commit gate test shows donation.enabled is refused without the typed APPLY and accepted with it, and that no DONATION_* key is on the editable or approval lists. A dashboard test shows donation.enabled in _confirm_keys and not in _editable_keys (pattern: dashboard/tests/service/test_control_service.py:304-317).
  • selftest-bundle-redact-env.sh passes with the three keys classified as survivors.
  • The PR changes docker-compose.yml, so it cites a tier4-e2e job (mode targeted) on the head SHA. It changes nothing under os/.
  • make test, make test-patch-coverage (90 % of changed lines) and make lint-file-budget pass with no ceiling raised. make lint-operator-strings passes: the preview sentences name no issue number and no bare docs/ path. No new explanatory code comments.

Possible solutions

  • Render DONATION_PERCENT always, as XVB_TOR_ENABLED is rendered always, so the dashboard never has to guess a default; the alternative of rendering it only when enabled saves a line but forks the test matrix.
  • Keep donation.tor its own key rather than reusing xvb.tor, because the privacy profile will govern the two separately (Add a Performance / Balance / Privacy profile that sets the privacy keys together #3574).
  • If the 15 spare lines in 33-render-env.sh run out, move the new reads into a new slice under lib/pithead/ and run make to regenerate the CLI (make lint-pithead-build checks slice order).

Part of #2476.

Activity

  1. added this to the v2.1.0 milestone on Oct 27, 2026
  2. added
    enhancement
    dashboard
    setup
    on Oct 27, 2026
  3. pithead-developer commented on Oct 27, 2026

    @pithead-developer
    ContributorAuthor

    Owner, 2026-10-27: the dashboard offers 0.1, 0.25, 0.5, 1, 2 and 5 percent, plus a custom value from 0.1 to 10 (#3733). So donation.percent must be a decimal from 0.1 to 10: reject values below 0.1 or above 10, and anything non-numeric. The default stays 2, with donation.enabled false. Validation, docs and tests cover 0.1 and 0.25.

  4. pithead-developer commented on Oct 27, 2026

    @pithead-developer
    ContributorAuthor

    Owner, 2026-10-27: every donation defaults to 0 %, and owners opt in by choosing a share. This replaces the earlier operator answer that donation.percent defaults to 2. donation.enabled defaults to false and donation.percent to 0. Choosing a preset (0.1 to 5 %, or a custom value up to 10) sets both. Validation accepts 0 only while the donation is disabled.

  5. added a commit that references this issue on Nov 10, 2026
  6. pithead-developer commented on Nov 10, 2026

    @pithead-developer
    ContributorAuthor

    Merged in #3721.

  7. added a commit that references this issue on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dashboardenhancementsetup

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions