Skip to content

feat(bazi): add isolate-local Shen Sha catalog bindings - #35

Merged
RedSC1 merged 5 commits into
mainfrom
codex/bazi-shen-sha-bindings
Sep 11, 2026
Merged

RedSC1 merged 5 commits into
mainfrom
codex/bazi-shen-sha-bindings

Conversation

@RedSC1

@RedSC1 RedSC1 commented Sep 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add immutable BaZi Shen Sha catalogs, custom callback modules, disabled-rule selections and standalone contexts.
  • Keep isolate-local callback ownership explicit; remove callbacks from removed modules and retain independent snapshots safely.
  • Accept separate coreLibraryPath and BaZi libraryPath overrides.
  • Prepare ephemeris, ephemeris_bazi and ephemeris_ziwei 1.0.0-beta.10 against public Taiyin v1.0.0-beta.12 (compatible C ABI 11).

Validation and release gate

  • Local BaZi suite: 34 passed, one opt-in stress test skipped; analyzer clean.
  • Native CI rebuilds and tests macOS ARM64, Linux x64 and Windows x64.
  • Bundled native artifacts must be replaced with the passing beta.12 CI artifacts before publication. Older beta.11 binaries do not export the new catalog functions.

@RedSC1

RedSC1 commented Sep 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8895f0fbca

ℹ️ 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".

import 'package:test/test.dart';

int evaluateInIsolate() {
final astro = Ephemeris.open().createContext();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Attach workers to the initialized runtime

When this test starts four Isolate.run workers concurrently, each worker executes Ephemeris.open(), which reinitializes the process-wide native runtime. One worker can therefore reset shared runtime state while another is creating or using its context, making this callback-isolation test race or fail for reasons unrelated to Shen Sha. Initialize the runtime once in the main isolate and use Ephemeris.attach() in each worker, as the existing BaZi concurrency test does.

Useful? React with 👍 / 👎.

);
return BaziShenShaCatalog._(
_host,
_ShenHandle(_handle.module, out.value.cast(), false, _handle.callbacks),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drop callbacks belonging to removed modules

After removeModule(label) creates a catalog without that module's rules, this line still retains every callback from the source catalog. Consequently, a long-lived catalog produced through repeated add/remove cycles permanently pins removed predicates and anything their closures capture until the final descendant closes. It also makes the busy checks treat contexts as sharing callbacks that are no longer present in one context, causing otherwise independent nested evaluations to be rejected. Track callbacks by module and omit the removed module's callbacks from the new handle.

Useful? React with 👍 / 👎.

/// and callbacks must not be shared across isolates.
final class BaziShenShaCatalog implements Finalizable {
factory BaziShenShaCatalog({String? libraryPath}) {
final host = TaiyinExtensionHost.open();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expose a core-library override for standalone catalogs

When an application loads the core through Ephemeris.open(libraryPath: ...) because no compatible core is discoverable at the default location, this constructor ignores that path and independently calls TaiyinExtensionHost.open() with no override. Catalog creation can therefore fail before the explicitly selected BaZi module is opened, even though the application already has valid custom core and extension libraries. Accept a separate coreLibraryPath and pass it here, matching the standalone ZiweiDataCatalog API.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 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-09-11T01:54:09.459025Z fbaaa6e 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.

@RedSC1

RedSC1 commented Sep 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fbaaa6e4fd

ℹ️ 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".

Comment on lines +151 to +154
validateTaiyinRequiredSymbols(
providesSymbol: module.library.providesSymbol,
requiredSymbols: taiyinBaziShenShaSymbols,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Ship a native module that implements the catalog ABI

When callers use the package-bundled BaZi library—the documented default—this validation always rejects it because the checked-in Linux module exports none of these beta12 symbols (verified with nm), so BaziShenShaCatalog() cannot be constructed without an external override. The native-integration workflow also still checks out and stages v1.0.0-beta.11 in .github/workflows/native-integration.yml, meaning its BaZi tests will exercise the same incompatible ABI. Update/stage the native dependency and bundled artifacts alongside this facade.

Useful? React with 👍 / 👎.

@RedSC1
RedSC1 merged commit 8854a65 into main Sep 11, 2026
1 check passed
@RedSC1
RedSC1 deleted the codex/bazi-shen-sha-bindings branch September 13, 2026 01:56
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