Skip to content

Read stored merge rewrites in model field order in TypeScript - #527

Closed
saurav-shakya wants to merge 3 commits into
hydra-db:mainfrom
saurav-shakya:fix/merge-rewrite-key-order
Closed

saurav-shakya wants to merge 3 commits into
hydra-db:mainfrom
saurav-shakya:fix/merge-rewrite-key-order

Conversation

@saurav-shakya

@saurav-shakya saurav-shakya commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TypeScript now rebuilds each stored merge rewrite, and each evidence record in it, in the model's field order instead of spreading the sorted stored JSON. entity merges, entity_merges, and the graph.diff merge lists print the same JSON as Python.

Implementation details

Decisions

  • decodeMerge builds each MergeRewrite field by field and reads its evidence with the existing decodeEvidence, which already returns Evidence field order.
  • Python already reads in field order, so only TypeScript changes.

Validation

  • typescript/test/resolution.test.ts: a merge that drops a self-loop relation with evidence, then checks the key order of the stored rewrite and of its evidence record. It fails on main.
  • Conformance: merge_key_order compares the keys of each rewrite and its evidence across both SDKs, so a key order change is caught even though objects compare equal. It fails against main's TypeScript.
  • scripts/precheck.py --base origin/main passes; full Python and TypeScript suites pass on Kuzu.

Limits

None.

Linked issue

Closes #525

AI Assistance

Model Effort
Claude Opus 5.5 High

Checklist

  • Implements an issue a maintainer has /approved.
  • Small and scoped to that issue.
  • New errors have a code and hint, the same on API, CLI, and MCP in both SDKs (see AGENTS.md).
  • Breaking changes described below, or none.

Breaking changes

None.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 19:58

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

Copy link
Copy Markdown

This is PR 1 of 10 you may keep open at a time.

@github-actions

Copy link
Copy Markdown

This PR has no linked approved issue. Open an issue, get it discussed and /approved by a maintainer, then link it here with Closes #N. Closing for now; reopen once linked. (Fastest help: the #pr-discussion channel on Discord.)

Maintainers: reopen this PR to override the gate (it gets the gate-override label).

@github-actions github-actions Bot closed this Nov 26, 2026
@github-actions

Copy link
Copy Markdown

This PR has no linked approved issue. Open an issue, get it discussed and /approved by a maintainer, then link it here with Closes #N. Closing for now; reopen once linked. (Fastest help: the #pr-discussion channel on Discord.)

Maintainers: reopen this PR to override the gate (it gets the gate-override label).

@saurav-shakya

Copy link
Copy Markdown
Contributor Author

@arrry-hydraDB this one

@github-actions

Copy link
Copy Markdown

This PR has no linked approved issue. Open an issue, get it discussed and /approved by a maintainer, then link it here with Closes #N. Closing for now; reopen once linked. (Fastest help: the #pr-discussion channel on Discord.)

Maintainers: reopen this PR to override the gate (it gets the gate-override label).

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.

TypeScript returns stored merge rewrites with their keys in alphabetical order, so entity merges and graph.diff output differ from Python

2 participants