Skip to content

fix(marketdata): support legacy MiniRacer initialization - #166

Merged
TNT-Likely merged 2 commits into
mainfrom
codex/miniracer-runtime-compatibility
Oct 1, 2026
Merged

TNT-Likely merged 2 commits into
mainfrom
codex/miniracer-runtime-compatibility

Conversation

@TNT-Likely

@TNT-Likely TNT-Likely commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Background

The 0.17.0 release stopped during backend tests before building or publishing artifacts. AkShare installs py-mini-racer==0.6.0 on the release runner, while local development uses mini-racer==0.14.1. The new warmup incorrectly assumed both supported context-manager construction. The legacy source distribution also lacks its native binary on ARM, making optional JavaScript initialization a potential startup blocker.

Changes

  • Construct MiniRacer explicitly and call close() when supported; retain legacy garbage-collection cleanup.
  • Keep serial first-isolate initialization and only mark warmup ready after successful evaluation and cleanup.
  • Skip optional warmup when the legacy distribution reports its native binary is unavailable. Other constructor/evaluation failures continue to propagate.
  • Exercise the supported construction API in native concurrency regressions and add legacy, evaluation-failure cleanup, and missing-native-binary cases.
  • Add Python 3.11 PR checks for both runtime packages on AMD64 and ARM64. Native concurrency is explicitly skipped when the installed optional package has no native binary.
  • Run the full backend and marketdata release checks in a Python 3.11 PR job before retrying publication.

Validation

  • pytest tests/ -x -q -rs using the isolated temporary SQLite runner: 888 passed, 3 skipped.
  • python -m pytest --noconftest tests/test_marketdata_javascript_runtime.py -q: 7 passed locally with mini-racer 0.14.1 on macOS ARM64.
  • Parse the new workflow and inspect its two-platform/two-runtime matrix.
  • git diff --check: passed.
  • Release failure log identifies TypeError: 'MiniRacer' object does not support the context manager protocol before Docker build/push. Failed release run.
  • Legacy upstream implementation confirms destructor-based cleanup and the explicit missing-native-library error.
  • Python 3.11 CI: full backend and marketdata release checks passed; all four platform/runtime jobs passed. The legacy ARM job explicitly skips the unavailable native-concurrency case.

Boundaries and risks

  • The legacy package still cannot execute JavaScript on platforms for which it provides no binary. The server can start and other configured data sources remain usable; installing a supported runtime is required for those JavaScript-dependent sources.
  • Native fatal errors remain outside Python exception handling. Serial warmup is retained for the previously reproduced concurrent first-context race.
  • Local tests use Python 3.13; the new CI matrix verifies Python 3.11 and Linux platform/package differences before merge.
  • Local .docs/ reports and AGENTS.md remain excluded.

Follow-up

  • After CI and merge, resume the interrupted 0.17.0 release and verify both published image architectures and release metadata.

@TNT-Likely
TNT-Likely merged commit 26226cc into main Oct 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant