Skip to content

feat: add core canonical encoder - #33

Merged
flyingrobots merged 9 commits into
mainfrom
core-ir/canonical-encoder
Jun 24, 2026
Merged

feat: add core canonical encoder#33
flyingrobots merged 9 commits into
mainfrom
core-ir/canonical-encoder

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Summary

  • Add the first reference edict.canonical-cbor/v1 encoder for in-memory Core modules.
  • Add canonical CBOR decode/re-encode validation, including stable error kinds for non-canonical bytes and duplicate map keys.
  • Add behavior tests for map-order independence, mutation sensitivity, decode/re-encode stability, integer width stability, and source alpha-renaming invariance.
  • Update Core IR and compiler-spine topic shelves, README status, crate docs, package metadata, and CHANGELOG while keeping reviewed golden bytes and exact digest fixtures deferred to Core IR: golden bytes and exact digest fixtures #22.

Closes #21

RED/GREEN Evidence

RED: cargo test -p edict-syntax --test canonical_encoding -- --nocapture failed before implementation because the public canonical encoder API did not exist.

GREEN/VERIFY:

  • cargo test -p edict-syntax --test canonical_encoding -- --nocapture
  • cargo fmt --all --check
  • cargo clippy -p edict-syntax --all-targets --all-features -- -D warnings
  • markdownlint-cli2 README.md CHANGELOG.md docs/topics/core-ir/README.md docs/topics/core-ir/test-plan.md docs/topics/compiler-spine/README.md docs/topics/compiler-spine/test-plan.md
  • git diff --check
  • cargo xtask verify

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@flyingrobots, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 5 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 48c05c98-4d76-4631-83c1-34ac5d74b191

📥 Commits

Reviewing files that changed from the base of the PR and between 7dd4802 and f9ce2ed.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • README.md
  • crates/edict-syntax/Cargo.toml
  • crates/edict-syntax/src/canonical.rs
  • crates/edict-syntax/src/lib.rs
  • crates/edict-syntax/tests/canonical_encoding.rs
  • docs/topics/compiler-spine/README.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/core-ir/README.md
  • docs/topics/core-ir/test-plan.md

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.

@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: 8b7731821e

ℹ️ 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 thread crates/edict-syntax/src/canonical.rs Outdated
Comment thread crates/edict-syntax/src/canonical.rs Outdated
Comment thread crates/edict-syntax/src/canonical.rs Outdated
Comment thread crates/edict-syntax/src/canonical.rs Outdated
Comment thread crates/edict-syntax/src/canonical.rs Outdated
Comment thread crates/edict-syntax/src/canonical.rs
Comment thread crates/edict-syntax/src/canonical.rs
@flyingrobots

Copy link
Copy Markdown
Owner Author
ID Severity Source File Lines Issue
SELF-001 P2 Self crates/edict-syntax/src/canonical.rs L295-L296 inputConstraints preserves caller vector order, so equivalent Core intents with the same coordinate-keyed constraints in a different order can encode to different canonical bytes. Cc: @codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

Commit / PR

  • Committed changes on the current branch: 28c1f66 fix canonical input constraint ordering.
  • Created PR: fix canonical input constraint ordering.

Testing

  • cargo test -p edict-syntax --test canonical_encoding canonical_core_bytes_are_independent_of_input_constraint_order -- --nocapture — expected RED before implementation; failed because input constraints preserved vector order.
  • cargo test -p edict-syntax --test canonical_encoding canonical_core_bytes_are_independent_of_input_constraint_order -- --nocapture
  • cargo fmt --all --check
  • cargo test -p edict-syntax --test canonical_encoding -- --nocapture
  • cargo xtask verify
  • git diff --check

View task →

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 24, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 24, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 24, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 24, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 24, 2026
@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer Activity Summary

# Severity Source File Commit Outcome
1 P1 PR crates/edict-syntax/src/canonical.rs 1d8909f Rejected unresolved Core import digests before canonical encoding.
2 P2 PR crates/edict-syntax/src/canonical.rs 2a9dd46 Omitted source-local import aliases from canonical bytes.
3 P2 PR crates/edict-syntax/src/canonical.rs bdbdb9a Sorted resolved Core imports before canonical encoding.
4 P2 PR crates/edict-syntax/src/canonical.rs 29a25df Excluded local source spelling from canonical local references.
5 P2 PR crates/edict-syntax/src/canonical.rs 411f6b7 Canonicalized requiredCoreCapabilities as a sorted set.
6 P2 PR crates/edict-syntax/src/canonical.rs d22b387 Guarded declared CBOR lengths before allocation.
7 P2 PR crates/edict-syntax/src/canonical.rs c282da7 Normalized uppercase SHA-256 hex review forms to digest bytes.
8 P2 Self crates/edict-syntax/src/canonical.rs f9ce2ed Sorted Core input constraints before canonical encoding.

Verification:

  • cargo xtask verify
  • markdownlint-cli2 README.md CHANGELOG.md docs/topics/core-ir/README.md docs/topics/core-ir/test-plan.md docs/topics/compiler-spine/README.md docs/topics/compiler-spine/test-plan.md
  • gh pr checks 33 shows Rust stable and Rust MSRV passing; CodeRabbit fails only with insufficient usage credits.
  • GraphQL review-thread check shows all PR-originated threads resolved and no unresolved review threads.

@flyingrobots
flyingrobots merged commit 2fa3dbf into main Jun 24, 2026
2 of 3 checks passed
@flyingrobots
flyingrobots deleted the core-ir/canonical-encoder branch July 14, 2026 23:42
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.

Core IR: canonical encoding rules and reference encoder

1 participant