Repository navigation
fix(kanban): store a comment body as text, whatever the caller passes - #118546
Open
yoyodine-industries wants to merge 76 commits into
Open
yoyodine-industries wants to merge 76 commits into
yoyodine-industries wants to merge 76 commits into
Conversation
`add_comment` is the only writer of `task_comments`, and every reader of both
columns is `str`-based. `sqlite3` binds `bytes` as BLOB, so a caller that passes
bytes got one of two failures:
- a BLOB body comes back as `bytes` from a raw cursor no matter which
`text_factory` is installed, so the first `str` operation to touch the row
raised `TypeError: cannot use a string pattern on a bytes-like object`;
- the write itself crashed before it got that far, because the `commented`
event payload embeds the author and `json.dumps` refuses bytes
(`TypeError: Object of type bytes is not JSON serializable`).
Both are the same missing contract: the column is TEXT. Normalising at the one
writer keeps it one type, instead of each reader tolerating whatever the last
caller passed. `_lossy_text` already covers rows written before this.
Authored with AI assistance (Hermes Agent); diff verified manually.
…body-text-contract
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add_commentis the only writer oftask_comments, and every reader of the column isstr-based — butsqlite3bindsbytesas BLOB. A caller that passes bytes currently gets one of two failures:bytesfrom a raw cursor no matter whichtext_factoryis installed, so the firststroperation to touch that row raisesTypeError: cannot use a string pattern on a bytes-like object.commentedevent payload embeds the author andjson.dumpsrefuses bytes (TypeError: Object of type bytes is not JSON serializable).Both are the same missing contract: the column is TEXT. This normalises
bodyandauthoronce, at the single writer, so the column holds one type instead of every reader tolerating whatever the last caller passed. The reader side is already covered onmainby_lossy_text(installed as every board connection'stext_factoryand applied in thefrom_rowconstructors) — this closes the other end.Evidence
tests/hermes_cli/test_kanban_db.py::test_add_comment_stores_a_bytes_body_as_textmain@ 7b3c7ae:TypeError: Object of type bytes is not JSON serializable.The one failure,
test_infrastructure_spawn_refusal_never_charges_the_card, fails identically on the base commit with this change stashed — pre-existing onmain, unrelated to this diff.Authored with AI assistance (Hermes Agent); diff verified manually.
Related Issue
Related Issue: none
Checklist
Code
fix(scope):,feat(scope):, etc.)scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py→ 55 passed, 1 failed (1 skipped; the failure is pre-existing on the base commit). The fullpytest tests/ -qwas not run on this host.python scripts/checkpasses (the blocking lint and code-health checks CI runs)test_add_comment_stores_a_bytes_body_as_text.Documentation & Housekeeping
docs/, docstrings) — N/A: the PR body records no documentation update.cli-config.yaml.exampleif I added/changed config keys — N/A: the PR body records nocli-config.yaml.examplechange.CONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A: the PR body records noCONTRIBUTING.mdorAGENTS.mdchange.