- Enforce signature verification on every read of snapshots and ledger
- storage.readIssueSnapshot: verify with verifySnapshot; reject if invalid
- ledger.readLedger: already verifies; keep consistent
- Add optimistic concurrency retries (seq-based)
- On trade: read -> compute -> write (seq+1); re-read and compare seq; retry N times (e.g., 3) on mismatch
- Apply same pattern for ledger writes
- Add write receipts for partial failures
- If ledger updated but market snapshot write fails, post a bot comment noting partial update and suggesting retry/reconcile
- Harden snapshot block parsing
- Ensure only one snapshot block exists; if multiple, prefer the first and remove extras; always re-render at top of body
- Trading permissions
- Restrict to repo collaborators or org members (octokit.repos.getCollaboratorPermissionLevel)
- Optional: team-based allowlist via config
- Conflict-of-interest flags
- If commenter can close the target issue, flag their trades in comments and (optionally) cap trade size
- Max exposure per user per market
- Cap shares per side (e.g., 1,000) to limit manipulation
- Label market issues on creation
- Labels:
forecast-market,target-issue-<n> - Store target linkage in snapshot (already present)
- Labels:
- Fast lookup by label
- In resolution and helpers, query by labels instead of scanning titles
- Support multiple markets per target
- Encode
marketIdin a label (e.g.,market-id:<id>) and in the title to disambiguate
- Encode
- Add
/helpcommand listing supported commands and examples - Add
/sell yes|no <shares>(optional)- MVP: model sell as buying the opposite side; display cost/refund at current price
- Improve trade feedback
- Show pre-trade and post-trade price, slippage, and remaining balance
- Balance/portfolio
/portfolioto list all open market positions and total exposure
- Leaderboard
- Scheduled (GitHub Actions cron) job posts top balances to the Ledger Issue
- For PR-targeted markets, update a "Forecast" check on relevant events
- On trade and on PR sync, call checks.upsertForecastCheck with latest probability
- Optionally display a badge in PR description via a bot comment that updates on trades
- Deadline handling
- Use explicit timezone (UTC) and display local time hints
- Manual override command
/market resolve <yes|no> reason:"..."with audit log in the market issue
- Auto-resolve scheduler
- GitHub Actions workflow that hits a maintenance endpoint or uses the API to scan and resolve past-deadline markets periodically
- Add retry with backoff on GitHub API 5xx / rate limits
- Add minimal request queueing to avoid burst writes on hot markets
- Cache repo metadata (collaborator permission levels) in-memory with TTL
- Paginate issue listing calls (currently per_page=100) and/or filter via labels
- Record trade receipts
- Append a small JSON receipt inside the market issue as a separate block or dedicated comments with a
trade-receiptmarker - Include: user, side, shares, cost, pre/post price, seq, timestamp
- Append a small JSON receipt inside the market issue as a separate block or dedicated comments with a
- Transaction IDs
- Include a monotonic
txIdfield in comments to assist audit/reconciliation
- Include a monotonic
- Repo-level config via a
.ganttmarket.yml- startingCredits, b parameter, rate limits, allowed roles/teams, max shares
- Environment variables validation with human-friendly errors
- Toggle features via labels (e.g.,
forecast-enabled)
- Add unit tests for lmsr, parsing, and snapshot/ledger signing
- Add integration tests using nock to stub GitHub API
- Prettier/ESLint minimal setup for consistency
- Structured logging (JSON) with request IDs and event types
- Optional webhook delivery logging for debugging signature/headers
- Health endpoint to verify env and GitHub App configuration (without secrets)
- Expand README with:
- Resolution criteria and edge cases (reopen after deadline, edited titles)
- Governance policies (who can trade, caps)
- Security model (signed blocks, seq)
- Troubleshooting guide (common webhook errors)
- Redact PII in logs (only show GitHub login when necessary)
- Data residency note (all state is in GitHub; no external DB)
- Optional export command
/exportto produce CSV summary of markets, trades, balances
- Conditional/scenario markets ("If +2 engineers, probability?")
- Milestone and release markets with auto-deadlines from GitHub metadata
- Slack/Teams notifications on big price moves
- Visualization: tiny sparkline image rendered and posted as a comment (optional)