Skip to content

fix(expressions): characters outside ASCII are syntax errors, not panics - #65

Merged
kalaspuff merged 2 commits into
fixes-stack/04-deep-nestingfrom
fixes-stack/05-non-ascii-expressions
Oct 30, 2026
Merged

kalaspuff merged 2 commits into
fixes-stack/04-deep-nestingfrom
fixes-stack/05-non-ascii-expressions

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A character outside ASCII anywhere in an expression panicked the expression lexer. It reported an unexpected character with a span of one byte, and building the error message then sliced into the middle of a multi-byte character. Inputs that triggered it: größe > :v, a non-breaking space pasted into a = :v, SET a = :v, ü = :v, or the projection a, ñ.

  • The in-memory backend raised DynamoxyError: internal error: a dynamoxy task panicked instead of a ValidationException.
  • dynamoxy._core._apply_update() (which dynamoxy uses to refresh instances) and _core._check_expressions() raised pyo3_runtime.PanicException, a BaseException that except Exception does not catch.
  • AWS clients failed the same way before sending an UpdateItem, because the core parses update expressions to decide whether a retry is safe. The request never reached DynamoDB, which would have answered with an error of its own.

The span now covers the whole character, so these expressions are syntax errors with DynamoDB's message (Invalid ConditionExpression: Syntax error; token: "ö", near: "größe"). An AWS client that cannot parse an update expression sends it to DynamoDB, and does not resend it after an attempt that may have been applied.

Verified with a new Rust test (conditions, updates and projections with characters outside ASCII), a Python test that failed with the PanicException before the fix (_check_expressions, _apply_update, and an UpdateItem on the in-memory backend), and the whole Rust and Python suites, clippy, ruff, pyrefly and the consistency checks.

Checklist

  • Tests cover the change (Rust unit test, Python unit test through the in-memory backend)
  • Docs updated (changelog)
  • make check passes locally (lint, types, clippy, consistency, Rust and Python tests)
  • Breaking change? No

fctl session


Note

Low risk. It changes one error path in the expression lexer, which only runs for expressions that were already invalid, and adds tests.

What it does. The expression lexer reported an unexpected character as one byte wide, so a character outside ASCII (größe > :v, or a non-breaking space) made the error message slice into the middle of it and panic. The span now covers the whole character, so such expressions give a normal ValidationException syntax error instead of an internal error or a PanicException, and AWS clients no longer fail while parsing UpdateItem expressions for the retry check. Tests in Rust and Python and a changelog entry are included.

fctl review's first look at db41758 · 4 files, +53 −1 · Review agent settings

@kalaspuff
kalaspuff added this pull request to stack #66 October 30, 2026 21:17
The expression lexer reported an unexpected character with a span of
one byte, so a character outside ASCII (`größe > :v`, or a non-breaking
space pasted into `a = :v`) made the error message slice into the
middle of it and panic. In-memory calls raised an internal error, and
`_core._apply_update()` and `_core._check_expressions()` raised a
PanicException, which `except Exception` does not catch. AWS clients
failed the same way before sending UpdateItem, whose expression the core
parses to decide whether a retry is safe.

The span now covers the whole character: such expressions are syntax
errors (ValidationException), and AWS clients send them to DynamoDB.

Co-authored-by: Carl Oscar Aaro <[email protected]>
@kalaspuff
kalaspuff force-pushed the fixes-stack/05-non-ascii-expressions branch from 2935030 to d22860f Compare October 30, 2026 21:17
@kalaspuff
kalaspuff merged commit cfd1be5 into main Oct 30, 2026
22 checks passed
@kalaspuff
kalaspuff deleted the fixes-stack/05-non-ascii-expressions branch October 30, 2026 21:28
This was referenced Oct 30, 2026
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.

1 participant