Skip to content

test: measure query result limits after JSON escaping #598

Open

Description

@yeongseon

Source-observed limit mismatch

server._render_rows uses sum(len(str(value)) ...) to account for CUBRID_MCP_MAX_CHARS. A string that contains control characters, quotation marks or backslashes can become much longer when JSON encoded (e.g. a single \n control character becomes the two-character \\n escape in JSON). The returned MCP payload can therefore exceed the advertised character budget even when the raw Python values pass it. A very wide first row is already allowed a small per-column overshoot by an existing documented exception; do not confuse those two cases.

Source review only; this issue does not claim an observed production context-limit incident.

Bounded task

  • Add focused offline tests for strings with \n, \t, quotes, slashes/backslashes and non-ASCII data, checking encoded JSON output against CUBRID_MCP_MAX_CHARS semantics as described in docs.
  • Define and document which layer the limit covers (cell contents, escaped serialized values, or complete response envelope). If keeping the existing raw-value budget, clarify that exact distinction in README/TOOLS rather than claiming a strict wire-payload bound.
  • If enforcing serialized-value budgeting, preserve full valid JSON rows, explicit truncated, and existing first-row behavior without unintended semantic changes to numeric/binary values.

Acceptance

  • Tests show whether escaped output is within the defined budget or a precisely documented allowance, without emitting broken JSON strings.
  • Result counts and truncation indicators remain correct for short/empty/wide data.
  • Existing tests/test_server.py edge cases stay green; no SQL, permissions or database-driver changes.

Separate from the existing #578 (large-table COUNT cost) and the proposed non-finite-number handling; this issue concerns output-size accounting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageNot yet looked at by a maintainertestingTest coverage or test fixes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions