Skip to content

Aggregation: concatenate fold inputs without promotion; pair_sum is Int-only - #32

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/aggregation-fold-promotion
Oct 20, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/aggregation-fold-promotion

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Follow-up to #31, which merged at 13:24:58Z on 9ef30be, about 30 seconds before Codex finished reviewing that commit. Codex raised two P2 findings on it. Both reproduce, so this PR fixes them.

Changes

  • Type promotion in the fold-law checks. oplus_fold_append_holds and aggregation_as_fold_holds joined their inputs with vcat, which converts element types. An Int next to a Float64 is converted and can round. With an exact, non-promoting max (Monoid(0, (a, b) -> a > b ? a : b)) on [2^53 + 1] and [Float64(2^53)], both checks returned false on a lawful monoid. They now use _concat, which keeps each element as given.
  • pair_sum accepted any Integer tuple. sum_monoid's unit is an Int, so Int8 inputs overflowed in the direct sum (100 + 100 = -56) but not in the fold (200), and pair_sum_is_fold((Int8(100), Int8(100))) returned false. The example models ℕ as non-negative Int, so pair_sum and pair_sum_is_fold are now restricted to Tuple{Int,Int}; other integer types raise a MethodError instead of silently disagreeing.

Testing

julia --project=. -e 'using Pkg; Pkg.test()' on Julia 1.10.4: 302 pass, 0 fail (was 297). Both findings were reproduced before the change; the new assertions cover the promotion case for both checks and the Int8 rejection. The README test count is updated to match.

Notes


Generated by Claude Code

…(Codex P2 x2)

- oplus_fold_append_holds / aggregation_as_fold_holds joined their inputs
  with vcat, which promotes element types (an Int next to a Float64 is
  converted, and can round). With an exact non-promoting max this reported a
  false counterexample on a lawful monoid. They now use _concat, which
  keeps each element as given.
- pair_sum and pair_sum_is_fold accepted any Integer tuple, but sum_monoid's
  unit is an Int, so Int8 inputs overflowed in the direct sum but not in the
  fold and pair_sum_is_fold returned false. The example models N as
  non-negative Int, so both methods are restricted to Tuple{Int,Int}.

Both reproduced before the change. Adds 5 assertions (297 -> 302).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MF5GeeBBDF6sUzr6pZTjWV
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 10979ee0-d093-4f92-b6ec-360187c842ad
📥 Commits

Reviewing files that changed from the base of the PR and between 19657d4 and 025909e.

📒 Files selected for processing: 3
  • README.adoc
  • src/EchoTypes.jl
  • test/runtests.jl
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@hyperpolymath
hyperpolymath marked this pull request as ready for review October 20, 2026 13:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-20T13:29:57.028954Z 025909e 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.

@hyperpolymath
hyperpolymath merged commit b3cba75 into main Oct 20, 2026
15 checks passed
@hyperpolymath
hyperpolymath deleted the fix/aggregation-fold-promotion branch October 20, 2026 13:33
hyperpolymath added a commit that referenced this pull request Oct 20, 2026
## Summary

Prepares v0.4.0. No code change.

- `Project.toml`: 0.3.0 → 0.4.0.
- `CITATION.cff`: adds `version: 0.4.0` and `date-released: 2026-10-20`.
- README and the source header no longer call `EchoAggregation`
"unreleased".

## Why 0.4.0 and not 0.3.0

`Project.toml` already said 0.3.0, but the tags stop at `v0.2.0`:
**v0.3.0 was never tagged**. Its content (the Tier-3 audience spine, 258
assertions) ships in v0.4.0 together with `EchoAggregation`, which is a
new module. The README status paragraph says so.

## Readiness

- `julia --project=. -e 'using Pkg; Pkg.test()'`: **302 pass, 0 fail**.
- `main` at the #31 merge: Governance green; the Secret Scanner run was
cancelled only because #32 landed a minute later.
- This repository has no Julia CI job, so the test count is a local
result, as it was for v0.1.0 and v0.2.0.
- Stale and untouched: `.machine_readable/contractiles/Justfile` and
`.machine_readable/6a2/PLAYBOOK.a2ml` still carry `0.1.0`.

## After merge

The tag is the owner's to push (signed, annotated, admin bypass of the
tag rule):

```
git tag -s -a v0.4.0 -m "EchoTypes.jl v0.4.0 — adds EchoAggregation" <merge-commit-sha>
git push origin v0.4.0
```

---
_Generated by [Claude
Code](https://claude.ai/code/session_01MF5GeeBBDF6sUzr6pZTjWV)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants