pb go Flow Fix PlanThe pb go wizard in packages/pb-js/src/cli.js (lines 1222-1474) has two bugs:
voluntary_items (line 1386). Should only reveal selected_items.servers.json → reveal_publishers.Step 1: Hash (unchanged)
Step 2: Commit (unchanged)
Step 3: Submit (unchanged)
Step 4: Publish (was Step 5 — move up, make mandatory, add publish-server upload)
Step 5: Reveal (was Step 4 — move down, only reveal selected items)
packages/pb-js/src/cli.jsMove the publish block (current lines 1453-1463) to run BEFORE the reveal block (current lines 1372-1451). Update step numbering from "Step X of 5" accordingly.
Current code (line 1457-1460):
const publishAnswer = await prompt(' Publish now? [y/N] ');
if (publishAnswer.toLowerCase() === 'y') {
Change to always publish (no prompt). The step description should say:
Step 4 of 5 — Publish
Publish your data and protocol evidence to GitHub and a publish server.
After the GitHub publish succeeds, also attempt to upload to one of the reveal_publishers from servers.json.
The publish server upload should:
getRevealPublishers() from packages/pb-js/src/registry.js (line 59)dev-cloudflare)POST /v1/upload (multipart form: receipt JSON field + files[] file fields)dev-reveal-publishing-helpers/cloudflare-r2/src/routes/upload.jsserver-receipts.json or receipt.json from the dirregisterMirrorWithServers() at line 543)Pseudocode for the new publish step:
// ── Step 4: Publish ──
console.log(' Step 4 of 5 — Publish');
console.log(' Publish your data and protocol evidence to GitHub and a publish server.');
await waitForEnter();
// 4a. GitHub publish (required — error if fails)
await cmdPublishGithub(dirPath);
// 4b. Publish server upload (best-effort — warn if fails)
try {
const publishers = getRevealPublishers();
if (publishers.length > 0) {
const publisher = publishers[0];
// Build multipart form with receipt + data files
// POST to publisher.url + '/v1/upload'
// On success: register mirror with commit-reveal servers
// On failure: console.log warning, continue
}
} catch (err) {
console.log(` ⚠ Publish server upload failed: ${err.message}`);
console.log(' (continuing — GitHub publish succeeded)');
}
Current code (line 1386-1393):
const voluntaryItems = commitment.items.filter(h => !selectedItems.includes(h));
const revealPayload = {
...
selected_items: selectedItems,
voluntary_items: voluntaryItems,
...
};
Change to:
const revealPayload = {
spec_version: '0.2.0',
commitment_hash: commitment.commitment_hash,
selected_items: selectedItems,
voluntary_items: [], // <-- empty, only reveal what was selected
revealed_at: new Date().toISOString(),
signing_key: key.did || key.did_key,
};
Also update the log line (line 1403) to not mention voluntary count:
console.log(` ✓ Revealing ${selectedItems.length} selected item${selectedItems.length !== 1 ? 's' : ''}`);
"Publish your data and protocol evidence to GitHub and a publish server.""Sign and submit reveal for the randomly selected items.""→ reveal.json, reveal-receipts.json"The summary (lines 1465-1473) should reflect the new order and mention publication.json (which cmdPublishGithub already writes):
Done! Evidence chain in ${dirPath}:
manifest.json file hashes
commitment.json signed commitment
server-receipts.json server timestamps
publication.json publish receipts
reveal.json signed reveal
reveal-receipts.json server confirmations
| File | What |
|---|---|
packages/pb-js/src/cli.js lines 1222-1474 |
cmdGo() — reorder steps, fix reveal scope, add publish server |
| File | Why |
|---|---|
packages/pb-js/src/registry.js |
getRevealPublishers() helper (line 59) |
servers.json |
reveal_publishers array with R2/GCS URLs |
dev-reveal-publishing-helpers/cloudflare-r2/src/routes/upload.js |
Upload API shape (multipart: receipt + files[]) |
dev-reveal-publishing-helpers/cloudflare-r2/src/middleware/auth.js |
Auth requirements for upload |
cmdPublishGithub() function (line 780) already handles: git push, mirror registration, publication verification, and writing publication.json. No changes needed there.requireAuth() middleware). Check dev-reveal-publishing-helpers/cloudflare-r2/src/middleware/auth.js for auth details. If no auth token is available, skip the publish server upload with a warning.getRevealPublishers is already exported from registry.js but not currently imported in cli.js — add it to the import.