mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
* fix(dynamodb): tokenize UpdateExpression whitespace-insensitively Clause dispatch keyed on the literal "SET " prefix (keyword plus a single space) in both the request pre-validation and the parser, so a newline or tab after a clause keyword was rejected with 'Syntax error; token: "SET"'. Real AWS tokenizes UpdateExpression whitespace-insensitively; collapse whitespace runs before matching keywords. Fixes #1640 * test(dynamodb): make createAndSeed tolerate a pre-existing table CreateTable was asserted to return 200, so re-running the whitespace tests against a persisted store failed on the second run when the table already existed. Accept 200 or 400 (ResourceInUseException) for the create; PutItem still overwrites, keeping the seed deterministic. * test(dynamodb): cover ADD/DELETE, multiline RHS and 3-clause chains Extends the UpdateExpression whitespace regression suite along the axes most likely to hide a follow-on regression: - ADD and DELETE with a newline after the keyword. Both reach their own clause parsers via a separate startsWith dispatch, independent of the SET path. - A multiline function and arithmetic right-hand side: list_append(#l,\n:more) and if_not_exists(#c, :zero)\n+ :inc, so the depth-aware comma scan and the arithmetic operator scan are exercised on a wrapped expression. - A chain of three clauses separated by newlines, so the clause-boundary scan runs repeatedly rather than once. All three newlines sit after the clause keyword. A newline only before a keyword already parsed on main, because indexOfKeyword's boundary check accepts any whitespace, while the keyword itself is matched with a literal trailing space. Verified red on main (2x 'Syntax error; token: "SET"', 1x '"ADD"') and green with the fix. * refactor(dynamodb): reserved-word check on the normalized expression DynamoDbReservedWords.check ran on the raw UpdateExpression while clause dispatch ran on the whitespace-normalized one. Its function-call lookahead in extractBareIdentifiers skips only literal spaces, so a raw "if_not_exists\n(...)" was read there as a bare identifier rather than a function name. Harmless today since those names are not reserved, but running the check on the normalized string keeps both entry points consistent.