Commit 726e74f
Truncate FailureResponse.message before appending addr suffix in _failure_text
``OperationalError._MAX_DISPLAY_MESSAGE`` (1024 codepoints)
caps the display ``message`` field. ``DqliteProtocol._failure_text``
appended the peer-address suffix AFTER the server message.
For server messages >1 KiB (ORM-generated SQL with many bound
parameters, large constraint-violation diagnostics, etc.), the
suffix landed in the truncated tail — operators tailing logs
via ``logger.error("%s", exc)`` saw the truncated server text
but lost the ``" to <peer>"`` attribution that makes
multi-node diagnosis tractable.
Apply the per-node ``_truncate_error`` cap (200 codepoints,
already used in cluster aggregate-error rendering) to
``response.message`` BEFORE appending the addr suffix. The
``_MAX_DISPLAY_MESSAGE`` cap in ``OperationalError`` stays
in place as a defense-in-depth net for any caller that
constructs from raw text outside this helper, but the common
case now arrives pre-truncated with the suffix preserved.
Pairs with the X2 ``raw_message`` kwarg fix: the verbatim
server text continues to flow through ``e.raw_message`` so
forensic / log-aggregator views still have the un-truncated
copy.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5b67aa1 commit 726e74f
2 files changed
Lines changed: 44 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
749 | 749 | | |
750 | 750 | | |
751 | 751 | | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
752 | 762 | | |
753 | | - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
754 | 767 | | |
755 | 768 | | |
756 | 769 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments