Skip to content

fix: skip redundant computations in the schema subset checker - #110

Merged
l1shen merged 1 commit into
oomol-lab:mainfrom
yanjizhong:fix/schema-checker-redundant-computation
Sep 7, 2026
Merged

fix: skip redundant computations in the schema subset checker#110
l1shen merged 1 commit into
oomol-lab:mainfrom
yanjizhong:fix/schema-checker-redundant-computation

Conversation

@yanjizhong

Copy link
Copy Markdown
Contributor

Summary

Fixes two redundant recomputations in the JSON Schema subset checker: cached falsy results never hit the cache, and calculateObject computes each optional key expression twice.

Changes

  • checker/cache.ts: getWithCache now checks result === undefined instead of !result, so cached falsy results (false and ExpressionNone) are reused. checker/equals.ts already used this form.
  • checker/object.ts: the optional-key loop pushes the already computed expression instead of calling calculateKey a second time, matching the adjacent additionalProperties block.

Motivation

  • With !result, every deep-equality miss (false) and every ExpressionNone schema comparison bypassed the cache and was recomputed on each lookup.
  • The optional-key loop called the recursive calculateKey twice per key purely to obtain the same value.

Testing

  • bun run check and bun run test in packages/open-flow. Both changes are behavior-preserving; the existing schema-compare suites cover the affected paths.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 13 days. After that, they cost $0.25 per reviewed file.

Or wait 59 minutes for your next included review.

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: CHILL

Plan: Team

Run ID: 0e6ec4e0-11ab-46aa-ada7-452ed3b78254

📥 Commits

Reviewing files that changed from the base of the PR and between 6f1e960 and d8a91c3.

📒 Files selected for processing (2)
  • packages/open-flow/src/json-schema-subset/checker/cache.ts
  • packages/open-flow/src/json-schema-subset/checker/object.ts

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

@l1shen
l1shen merged commit cdc9673 into oomol-lab:main Sep 7, 2026
8 checks passed
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