-
Notifications
You must be signed in to change notification settings - Fork 11
Unified traversal #CT-997 #2198
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
base: main
Are you sure you want to change the base?
Conversation
Added the better performance test in this branch
…ion instead of using the ObjectStorageManager classes.
…jects from validateAndTransform are not simply JSONValue objects. - Combined the annotateObject and createObject hooks. - Changed the cycle detector, so that we put in an object immediately, then populate it later. This makes it so we can walk into a object/array with a link to itself, and point the resulting object at itself, adding the special fields when we return. - Fix typo in Replica log message (already exists) - Addd TransformObjectCreator which implements the callbacks needed for SchemaObjectTraverser with the validateAndTransform functionality. - Added new validateAndTransform implementation, temporarily switching between them.
…on existence of properties field.
- Convert SchemaQuery SchemaPathSelectors to have the "value" prefix before passing them to traverse code. Do the same for the selectors created for validateAndTransform. - Changed factValue passed to getAtPath to not narrow to value
…stead of just when undefined), since that was the previous behavior Tidy up the link value path in validateAndTransform
…ll use a cell, and not a query result proxy.
Added applyDefault helper function to SchemaObjectTraverser Added test for top level default
Partial pass at type cleanup (still bad) Added temporary console logs Added cell test for defaults Added check for non-empty fact address path in loadFactsForDoc.
…ls (or spell or TYPE links). These should not be included for client traversal, and will break unit tests if we do, because we end up having a read assertion for a recipe that wasn't written.
…ink with the schema in our parent context. Use the id/type/path from the data. For server traversal, I should switch over to this as well, but I'm going to wait until more things work.
Move schema combination logic into traversePointerWithSchema
Added missing boolean handling to traverseWithSchemaContext
Fix typo in cache.ts error message Cleaned up some tests to be more correct
Code for array post-processing to follow first link (disabled) Changed navigate-to.ts to handle getting a proxy object instead of a cell (need to track this down)
…ating a proxy object instead of a cell. This removes the need for the workaround in navigate-to.ts.
…ments in an array. This needed to be done in traverse, since it should happen before we walk into the object.
…ng optional unused seen parameter to new version for now.
| * | ||
| * When properties are not specified in the schema, and additionalProperties | ||
| * is not specified, we have the standard JSONSchema behavior, where this is | ||
| * equivalent to additionalProperties of true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we actually see this at this point or would have this been collapsed to a true schema earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still see this. I don't think @mathpirate 's transformer code ever generates this style of schema, but you can specify it manually still.
… an error, since these won't be re-run
…e the object isn't a cell (this was just an error). There's some type issues here, but I'm deferring that. When creating an event stream, if the schema is false (which it often is if the event isn't used), create a simple object schema. Otherwise, we don't run the event handlers.
…ect for JSONSchema, but seems like a good compromise to get the bits we want.
… often not present, and we do stricter validation now. Change the counter fallback test, so it doesn't rely on having undefined in the array. Uses null instead to test the same general thing. If the schema to be used for an event stream is undefined or false, change it to true instead. This is a temporary workaround until I track down why I'm not seeing that triggered.
JSONSchema doesn't allow NaN as a number (since JSON doesn't). I could alter traverse to allow this, but I'm just going to alter the test instead, since neither is ideal.
Changes the way we do traversal so the same system can be used by both the
cell.get()implementation and the query implementation that determines which linked docs we need.The
cell.get()system, orvalidateAndTransformdoesn't follow asCell links, just creating the cell objects that will let us access those in the future.The
querysystem does follow those links to determine what we need to have available.To unify tracking, the query system was re-written to use the transaction interface we use for reactivity instead of directly accessing storage.
There's a lot more link magic that needed to go on for the
validateAndTransform, and to make this all work, I split the code into aSchemaObjectTraverserportion that knows how to walk objects with rules like the schema, and anIObjectCreatorportion that knows how to create the objects.validateAndTransform, thatIObjectCreatordoes all the magic of creating new cells.querySchema, thatIObjectCreatordoes very little, mostly just passing along information about whether the data matched the schema pattern.Things I intend to address later:
JSONValue | undefineddepending on the mode.IAttribution.Summary by cubic
Unifies traversal and validation to run on storage transactions and normalizes selectors to start at "value", improving consistency, default handling, and link behavior. Addresses CT-997 by removing tight coupling to manager classes, stabilizing array/link semantics, and preventing actions from running with invalid arguments.
Refactors
Migration
Written for commit b951078. Summary will update automatically on new commits.