Skip to content

v3.8.0: Sequence-Based Sellability and Fresh Market Discovery

Choose a tag to compare

@pwdel pwdel released this 29 Jul 22:51
9ef6530

Summary

Minor release for sequence-based sellability, stale market discovery read-model fixes, repository metrics maintenance, and backend dependency updates since v3.7.1.

This is v3.8.0 rather than a patch because the sell-share execution model now derives a user's executable value from sequence-based unlocked lots instead of relying on the previous full-position projection guard. Public request and success DTO shapes remain stable.

Trading and Sellability

  • Replaced the sell projection guard with a stateless unlocked-lot replay for unresolved positions.
    • Target-user buy rows create DBPM-valued lots.
    • Later positive buys by another user unlock prior target-user lots.
    • Prior target-user sells consume unlocked lots FIFO.
    • The replay stays O(n) over the market's bet rows.
  • Kept DBPM as the canonical valuation source while limiting quote and execution to the derived unlocked inventory.
  • Aligned /v0/sell/quote and /v0/sell so both validate against the same sellable inventory.
  • Revalidated sellability inside the transaction-scoped sell path before writing sale ledger rows or crediting users.
  • Preserved dust accounting: gross sale value reduces position value, retained dust stays with the market, and only net proceeds are credited.
  • Added user/requester-focused sellability details so clients can explain unsellable-but-present position value without computing market math in the browser.
  • Added and updated regression coverage for the reported mixed buy/sell sequence and oversized sale request, including the 507 credit NO request that now caps to remaining executable value instead of overpaying.
  • Fixed a dev seed race where concurrent admin creation during dev-bootstrap-users could abort startup.

Market Discovery and Read Models

  • Fixed stale Users, Size, probability, and dust values on the /markets discovery list after bets or sells are placed.
  • Market discovery snapshots marked stale are no longer served just because they are still inside the freshness window.
  • Stale per-market accounting snapshots now refresh on the next summary read instead of being reused by rebuilt discovery pages.
  • Added regression coverage for both stale discovery snapshots and stale market accounting summaries.

Repository Metrics and Documentation

  • Replaced the broken external README stargazer chart with a checked-in SVG and JSON data generated from GitHub stargazer timestamps.
  • Added a scheduled/manual stargazer chart refresh workflow that opens or updates a docs PR when chart data changes.
  • Refreshed rolling 14-day repository traffic badge metrics.
  • Documented the repository metrics refresh flow.

Dependencies and Tooling

  • Bumped github.com/getkin/kin-openapi from 0.135.0 to 0.144.0.
  • Added frontend Vitest/jsdom test tooling used by the sell-share UI/API regression tests.

Validation

  • Latest main SHA for this release: 9ef6530b06daf3223da214aa9c353ddc07d481d6.
  • main CodeQL workflow passed for actions, Python, Go, and JavaScript/TypeScript: https://github.com/openpredictionmarkets/socialpredict/actions/runs/30495242741
  • Staging candidate rerun for the merged dependency update passed frontend/backend image build and scan, downstream Ansible deploy, and public staging readiness: https://github.com/openpredictionmarkets/socialpredict/actions/runs/30495243535
  • Merged PR validation included:
    • JWT_SIGNING_KEY=test-secret-key-for-testing go test ./...
    • focused sell, market, repository, handler, and position-math tests
    • node --check integrationtest/scripts/sell-shares-overcashout.mjs
    • local HTTP integration scenario result: 96 passed, 0 failed
    • README metrics generator unit tests and SVG/JSON validation

Commits Since v3.7.1

  • 9ef6530b Chore(deps): Bump github.com/getkin/kin-openapi (#785)
  • 0147aeb3 fix: refresh stale market discovery stats (#786)
  • bc7752c6 Fix sequence-based sellability for unlocked lots (#784)
  • 86922bb6 docs: replace README stargazer chart (#778)
  • 7763d537 docs: update repository traffic badges (#769)

Full changes since v3.7.1: v3.7.1...v3.8.0