Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patterns impose resource limits #6057

Merged
merged 5 commits into from
Sep 7, 2022
Merged

Conversation

erights
Copy link
Member

@erights erights commented Aug 26, 2022

For various type-oriented patterns like M.array(), where the pattern itself does not naturally imply a length limit,

  • add an optional limits argument to the pattern, where the limits argument is a record of optional named limits
  • provide generous default limits that applies if no explicit limits are provided.

The limits are expressed as numbers, not bigints. Unlimited size can thus still be expressed with a limit value of Infinity.

The limits are
* decimalDigitsLimit, for M.bigint, M.nat, and the cardinality of M.bag and M.bagOf
* stringLengthLimit, for M.string
* symbolNameLengthLimit, for M.symbol
* numPropertiesLimit, for M.record and M.recordOf
* propertyNameLengthLimit, for M.record and M.recordOf
* arrayLengthLimit, for M.array and M.arrayOf
* numSetElementsLimit, for M.set and M.setOf
* numUniqueBagElementsLimit:, for M.bag and M.bagOf
* numMapEntriesLimit, for M.map and M.mapOf

See
#5955 (fixes it?)
#5956
#5954
#6098
#6060
#6061
#6062
#5956

@erights erights self-assigned this Aug 26, 2022
@erights erights mentioned this pull request Aug 26, 2022
@erights erights force-pushed the markm-far-classes branch 2 times, most recently from 1e96f9b to e582783 Compare August 27, 2022 03:12
@erights erights force-pushed the markm-size-limits-take2 branch 4 times, most recently from 8b8a988 to 28d59b2 Compare August 29, 2022 01:38
@erights erights marked this pull request as ready for review August 29, 2022 01:44
@erights erights marked this pull request as draft August 29, 2022 01:46
@erights erights marked this pull request as ready for review August 29, 2022 01:46
Base automatically changed from markm-far-classes to master September 3, 2022 22:48
@erights erights force-pushed the markm-size-limits-take2 branch 2 times, most recently from 18ce081 to ec00bae Compare September 4, 2022 06:40
@erights erights changed the title WIP: patterns impose resource limits fix: patterns impose resource limits Sep 4, 2022
packages/store/test/test-pattern-limits.js Outdated Show resolved Hide resolved
packages/store/test/test-pattern-limits.js Outdated Show resolved Hide resolved
packages/store/test/test-pattern-limits.js Outdated Show resolved Hide resolved
@erights erights marked this pull request as ready for review September 4, 2022 19:42
@erights
Copy link
Member Author

erights commented Sep 4, 2022

This is now ready for review!

Copy link
Member

@dtribble dtribble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Several comments about perf improvements and test improvements. I could not spot any issues.

Oh and some questions and suggestions around the initial values.

packages/store/src/patterns/patternMatchers.js Outdated Show resolved Hide resolved
packages/store/src/patterns/patternMatchers.js Outdated Show resolved Hide resolved
packages/store/src/patterns/patternMatchers.js Outdated Show resolved Hide resolved
packages/store/test/test-pattern-limits.js Outdated Show resolved Hide resolved
@erights erights added the automerge:squash Automatically squash merge label Sep 7, 2022
@mergify mergify bot merged commit 548c053 into master Sep 7, 2022
@mergify mergify bot deleted the markm-size-limits-take2 branch September 7, 2022 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants