Skip to content

fix(conformance): reject Symbol-keyed object properties in the interop cross-check (LAB-8754) - #191

Merged
27Bslash6 merged 1 commit into
mainfrom
lab-8754-symbol-keys
Oct 10, 2026
Merged

27Bslash6 merged 1 commit into
mainfrom
lab-8754-symbol-keys

Conversation

@27Bslash6

Copy link
Copy Markdown
Contributor

What

tools/interop-crosscheck.mjs listed a plain object's keys with Object.keys, which skips Symbol keys. So [{ [Symbol('k')]: 1n, a: 2n }] encoded to 9181a16102, the same bytes as [{ a: 2n }], and [{ [Symbol('k')]: 1n }] encoded as an empty map. IOP-8 says a value outside the data model must be rejected, never skipped, and IOP-13 says a non-string map key is an error.

  • The plain-object branch of encodeCanonical now throws OutOfModelError when the object has an own enumerable Symbol-keyed property, before it encodes any key. propertyIsEnumerable is called through Object.prototype, because a null-prototype object has no such method. A non-enumerable Symbol key is ignored, as a non-enumerable string key already is.
  • New nonStringKeySelftest, the counterpart of the Python reference's _non_string_key_selftest: rejection at the top level, on a null-prototype object, in a nested map, in a list and in a set element, plus two controls (a non-enumerable Symbol key encodes to 9181a16102; [{ "1": "a" }] encodes to 9181a131a161).
  • The comment above outOfModelSelftest no longer says a JavaScript non-string map key needs a Map.
  • conformance/requirements.json: IOP-13 cites the new self-test, and its gap note no longer says JavaScript objects have string keys only. conformance/coverage.md regenerated with tools/conformance.py report.

No spec text, vector or reference-implementation change. Portable JSON cannot carry a Symbol key, so a self-test is the only way to pin this.

Verification

  • node tools/interop-crosscheck.mjs prints the same line as main: OK: 44 key, 6 value, 6 reader accept, 1 reader reject, 1 AAD, 1 encryption, 34 error vectors verified independently.
  • With the guard removed, the cross-check exits 1 with five FAIL nonStringKeySelftest (...) lines. With the enumerable filter removed, it exits 1 on the non-enumerable control.
  • python3 tools/conformance.py check OK; python3 tools/test_conformance.py: all 284 cases pass. IOP-13 stays partial (gap) for all three SDKs.

Closes LAB-8754

…p cross-check

The cross-check listed a plain object's keys with Object.keys, which skips
Symbol keys, so an object with an enumerable Symbol key encoded as if the key
were absent. IOP-8 forbids silently skipping a value and IOP-13 requires a
non-string key to be rejected. The plain-object branch now rejects an own
enumerable Symbol key, and nonStringKeySelftest pins it. IOP-13's gap note no
longer claims JavaScript objects carry string keys only.
@kodus-27b

kodus-27b Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: cachekit-io/protocol/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 146a886e-36bb-453f-ba33-de0e889fa99a

📥 Commits

Reviewing files that changed from the base of the PR and between 6b3fb94 and 4e76677.


📒 Files selected for processing (4)
  • changelog.d/20261010_lab-8754.md
  • conformance/coverage.md
  • conformance/requirements.json
  • tools/interop-crosscheck.mjs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



Summary by CodeRabbit

  • Bug Fixes
    • The interoperability cross-check now rejects plain objects with own enumerable Symbol-keyed properties, including when they appear inside nested data. Non-enumerable Symbol keys remain ignored.
  • Documentation
    • Updated the IOP-13 requirements and conformance notes to clarify Symbol-key handling and the distinction between plain-object keys and Map inputs.
    • Published conformance vectors remain unchanged.

Walkthrough

The interop cross-check now rejects plain objects with own enumerable Symbol keys. A new self-test covers top-level and nested keys, as well as non-enumerable Symbols. The IOP-13 records and changelog describe the updated checks; published vectors are reported unchanged.

Changes

Symbol-key validation

Layer / File(s) Summary
Encoder validation and conformance coverage
tools/interop-crosscheck.mjs, conformance/requirements.json, conformance/coverage.md, changelog.d/20261010_lab-8754.md
The encoder rejects own enumerable Symbol keys. The new self-test checks top-level and nested cases, including null-prototype objects, and confirms that non-enumerable Symbols are not rejected. The conformance records and changelog describe these checks and the handling of Map inputs.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 4e766

The changelog links work after collection into CHANGELOG.md, and no merge-blocking issue remains.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: rejecting Symbol-keyed object properties in the interop cross-check.
Description check Passed The description directly explains the defect, implementation, self-tests, conformance updates, and verification results. It is fully related to the changeset.
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (3 skipped: 3 u…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • 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.

@27Bslash6
27Bslash6 merged commit 4369984 into main Oct 10, 2026
5 checks passed
@27Bslash6
27Bslash6 deleted the lab-8754-symbol-keys branch October 10, 2026 02: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