Update Mango library to match current Manifold API - #7
Merged
Merged
Conversation
Documents the plan to modernize the library with parallel agent teams, covering missing endpoints, data structure fixes, and testing strategy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 tasks organized into 3 phases: core infrastructure, domain endpoints (parallel), and integration tests. Includes TDD steps for each task. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Pool type previously hardcoded Option0..Option19 fields which breaks for markets with >20 answers and is brittle. A dynamic map supports any number of outcomes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CloseMarket and AddMarketToGroup used lowercase field names in anonymous
structs, causing json.Marshal to produce {} instead of the intended body.
Capitalizing the field names fixes serialization while preserving the
JSON tag casing. Tests added to verify the fix.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Renamed postRequest to doRequest since it handles any authenticated request. Added getRequest helper that sends the Authorization header for GET requests, replacing bare http.Get() calls that bypassed auth and the client's configured timeout. Simplified GetAuthenticatedUser to use the new helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added readErrorBody helper that reads up to 512 bytes from error responses. All POST endpoint error messages now include the response body, making it much easier to diagnose API errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nge) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Manifold API returns floating point values for fee fields, causing json.Unmarshal errors with the previous int64 type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Created integration_test.go with //go:build integration tag - Added 14 read-only integration tests (users, markets, bets, transactions) - Added write integration test with shared market (1 mana, CANCEL resolution) - Moved 12 legacy real-API tests from api_test.go behind integration tag Bug fixes discovered during integration testing: - PostComment: was incorrectly passing marketId in URL path - PostMarketRequest: added required LiquidityTier field - client.go: fixed unused fmt.Errorf (now fmt.Printf) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Upgrade Go from 1.19 to 1.21 to match go.mod - Update actions/checkout@v3 → v4, actions/setup-go@v3 → v5 - Remove debug echo of API key - Split into unit (always) and integration (push to main only) jobs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
doRequest() rejects empty API keys, so tests that use POST endpoints failed in CI where no .env or MANIFOLD_API_KEY env var exists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- gofmt: fix comment indentation and struct field alignment - staticcheck SA1006: use t.Error(s) instead of t.Errorf(s) for dynamic strings without format verbs - staticcheck U1000: remove unused getMarketProb constant Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
//go:build integrationtag; legacy real-API tests moved behind build tagBreaking Changes
SearchMarkets(terms ...string)→SearchMarkets(req SearchMarketsRequest)with full filter/sort supportPoolstruct replaced withmap[string]float64Feesfields changed fromint64tofloat64Test plan
go build ./...— clean buildgo test ./...— 27 unit tests pass (no credentials needed)go test ./... -tags=integration— 26 integration tests pass against live APIgo vet ./...— clean🤖 Generated with Claude Code