Skip to content

feat(bazi): expose native reverse lookup with shared core clocks - #17

Merged
RedSC1 merged 1 commit into
mainfrom
codex/bazi-native-reverse-lookup
Oct 19, 2026
Merged

RedSC1 merged 1 commit into
mainfrom
codex/bazi-native-reverse-lookup

Conversation

@RedSC1

@RedSC1 RedSC1 commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Expose BaziContext.reverse_lookup_at_ut1(...) -> (candidates, result_flags) and a support query. Return immutable candidate records for maximal matching half-open UT1 intervals. All four pillars are required; fatal errors use the existing exception hierarchy.
  • Compile the reviewed C++ reverse lookup and shared chart clock, not a Python date-scanning algorithm. Snapshot the owned calendar before releasing the GIL; share the base module's astronomy runtime through the append-only private capsule API. BaZi remains independent of the Ziwei DLL/runtime.
  • Adapt the final core review fixes: use next_pillar_transition for reverse interval boundaries (leave the existing Ziwei point-search helper unchanged), complete shared-clock operator shims, and delegate Split-JD comparison to the base core so noncanonical equivalent dates work.
  • Keep the legacy capsule prefix compatible. Older source cores can still build their existing APIs; unavailable reverse lookup returns UnsupportedOperationError rather than reading beyond the old table.
  • Pin all three CMake packages to reviewed public core commit e233c8fadc4754f8a234757841f5a1ad5334bc32 and its independently downloaded SHA-256 e33401e4cd03bb0e7d93511768b4b36222c58724af65ea655cd8c96253d4d5cd. Isolated CI builds exercise reverse lookup, not just old APIs.
  • Document clock/range semantics in Chinese and English: fixed offset adds to UT1, explicit UTC conversion retains its own flags, no implicit EOP estimate or IANA/DST interpretation.

Validation

  • Rebuilt and installed all three extensions into the repository venv; confirmed loaded module paths. With the local precise data fixtures enabled, all 250 tests passed. Without optional fixture configuration: 188 passed / 62 skipped.
  • New reverse tests cover three chart clocks × three rat-hour modes, half-open interval interiors, unified Zi merging, clipping, empty/no-match/invalid/closed inputs, cross-context concurrency, precise Jie equality-window boundaries, year-500 assigned historical midnight and noncanonical Split-JD representations.
  • Sources plus the new reverse test pass Pyright (0 errors). Full-repository Pyright also reports 13 pre-existing findings in the unchanged Shen Sha test file; those unrelated tests are not modified here.
  • The BaZi module also builds against the previous release core, advertising reverse lookup as unavailable. Dynamic dependency inspection confirms no extra astronomy/Ziwei library is linked into the BaZi extension.
  • Full diff self-audited; diff --check and shared-pin validation pass. The clean-source workflow will independently fetch/verify the public archive and test installed wheels.

Review order / scope

C++ core PR https://github.com/RedSC1/taiyin-ephemeris-dev/pull/86 is merged and its public snapshot is available, so wrapper review can now proceed. Dart companion PR: RedSC1/dart-ephemeris#37.

No package version bump, tag, publication, or new release workflow was triggered. Keep this PR open for review; do not merge or release yet.

RedSC1 commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

@codex review

C++ core-first review is finished: core PR #86 is merged and synchronized to the exact public SHA pinned here. Please review the complete Python diff, especially the append-only private capsule prefix/capability checks, ownership/GIL snapshot, same-runtime forwarding, precise/historical reverse boundaries, and isolated source builds.

Before pushing I reviewed the full diff and rebuilt the real extensions in the local venv. All 250 tests pass with local fixtures; sources plus the new reverse tests are Pyright-clean. New regressions cover all chart clocks/rat modes, half-open clipping/merging, physical Jie equality floors, assigned year-500 midnight, equivalent noncanonical Split-JD inputs, errors/closed contexts and independent-context concurrency. Legacy-core BaZi build also succeeds. There is no new tag/version/publication, and this PR should remain open for review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T04:31:37.100444Z 4417991 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 44179917c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@RedSC1
RedSC1 merged commit 212f9b3 into main Oct 19, 2026
1 check passed
@RedSC1
RedSC1 deleted the codex/bazi-native-reverse-lookup branch October 19, 2026 04:35
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