Skip to content

docs(plan): design R statistical API and formula lowering over JC - #1613

Merged
AdaWorldAPI merged 1 commit into
mainfrom
docs/jc-r-statistical-api-plan-20261019
Oct 19, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
docs/jc-r-statistical-api-plan-20261019

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Purpose

Follow up the CerebroCortex-RS ACT-R/SoA integration proposal with the missing detailed R-as-JC-API plan in the repository that owns JC.

This PR is documentation only, and proposes:

  • Two optional R surfaces: (1) a restricted, typed R-style statistical/formula frontend; (2) an external R package/client binding. No embedded R interpreter in the cognitive hot path.
  • Reuse existing JC functions such as pearson_from_cross_power_sums, anova_from_power_sums, simple_regression_from_cross_power_sums, reliability, effect sizes and Jirak calibration. No duplicated estimators.
  • Lower admitted statistical requests via existing typed/co-addressed relalg/R2IL/Quack → Mask-RISC → ndarray paths. Quack is already a lance-graph crate, not another SQL engine.
  • Explicit NA/NaN/Inf, validity-mask, scope, sample-unit, factor-codebook, dataset-witness and dependence-aware significance contracts.
  • A D-JCR-0..8 staged plan, R differential-oracle strategy, adversarial falsifier matrix and stop conditions.

Relationship to existing plans

This is additive to:

  • .claude/plans/sql-polyfill-r2il-v1.md (procedures, not new opcodes)
  • .claude/plans/relalg-v1.md (current IR limits)
  • .claude/plans/souffle-ram-64-thought-stack-v1.md (no extra AST or foreign gather)
  • The existing mathematical ownership contract in crates/jc

The first proposed implementation PR is only D-JCR-0/1 (typed contract and parity inventory), followed by a separately gated Pearson moment probe. This PR does not implement any R bindings or claim performance improvements.

Verification

  • Added only one Markdown plan file.
  • Audited against current JC moment/statistics APIs and the SQL/relalg compilation plans.
  • Public open-source architecture only; no private project or employer details.
  • No runtime tests applicable; no runtime code modified.

Plan: .claude/plans/jc-r-statistical-api-v1.md

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42bbf88b-0978-434a-9c98-adfa6980ffc0
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 19, 2026 01:49
@AdaWorldAPI
AdaWorldAPI merged commit 58b50fc into main Oct 19, 2026
4 checks passed

@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: 48d02ccfa1

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

| Sample covariance from cross moments | jc::stats::sample_covariance_from_cross_power_sums | Resident covariance |
| Simple OLS and R² from cross moments | jc::stats::simple_regression_from_cross_power_sums / r_squared_from_cross_power_sums | Small model-spec subset |
| One-way ANOVA and eta² from per-group moments | jc::stats::anova_from_power_sums / eta_squared_from_power_sums | Grouped response ~ categorical predictor |
| Weak-dependence calibration | jc::jirak | Explicit noise-floor claims, not ordinary independent-sample p-values |

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 Stop treating jc::jirak as a calibration API

jc::jirak does not expose a weak-dependence calibration that can consume a statistical request: its only public function is prove(), which runs a fixed 5,000-sample simulation and returns a PillarResult. Consequently it cannot implement the later CalibrationId path or provide an alternative to the classical p-values, and it also contradicts the following claim that the last four entries consume moment structures. Mark this capability as missing and gate a real input-dependent calibration API before listing it among implementations to reuse.

Useful? React with 👍 / 👎.

Comment on lines +175 to +177
- CrossPowerSums / PowerSums have bounded exact integer accumulation and
checked conversions; specifically preserve the currently documented
~2^32 rows/group bound and checked i128 centering. Overflow is refusal.

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 Preserve the terminal's total-plane row limit

The existing Mask-RISC validation checks planes.n_rows > MASKED_SUM_I32_MAX_ROWS before either grouped-moment terminal runs, so a population with more than 2^32 total rows is refused even when every individual group is below this stated per-group bound. If D-JCR-1 validates only the documented group counts, such requests will pass the new contract and then fail during execution; specify the total input-plane bound in addition to JC's per-group moment constraint.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

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-19T01:51:44.935754Z 48d02cc Draft marked ready
ℹ️ 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.

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