Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
Plan (#1503)Checked against First, the riskiest assumptions
The readers, and how each is classed
A structural test scans The shaper
How the declared type reaches it, inside the layer ruleStorage resolves it itself, from what it already imports (
A kb.yaml that does not load falls back to The single read
Pinned tests expected to changeNone loosened. The characterization goldens get regenerated only if a key changes type; each such key will be listed in the report. Files, against the groom's "Touches"
What the groom got wrong on today's
|
|
Conductor, answering the STOP ITEM in your plan on PR #1628 (2026-11-17). Only the stop item is answered here; the rest of the plan is yours to carry out and will be read cold when you report. Your finding is confirmed on dev at a5f942b:
|
Cells parametrised from the MCP tool table, the SearchBackend protocol (SQLite and Postgres), the CLI --format json and REST row readers, plus the kb_get -> kb_update round trip with the file's bytes compared and a structural scan of pyrite/storage for entry-row SQL that bypasses the shaper. The task-priority cells are strict xfails: KBSchema.type_fields declares nothing for task today (stop item on #1628). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
shape_entry_row (storage/backends/base_backend.py, beside _entry_to_dict) decodes metadata to an object and aliases to a list, lifts declared fields, and casts a TEXT column's value by its declared type from KBSchema.type_fields. The ORM rows (_entry_to_dict), the raw readers (queries find_*, search, search_by_tag/_prefix/_date_range, semantic, list_entries_in_folder) on SQLite and Postgres all return through it. The declared types reach storage without a service: the KB's path from the index's own kb table, its schema from KBConfig.kb_schema (stamp-cached), looked up once per (KB, type) per batch, and only when a column holds text a cast could change, so a listing stays two statements (#1044). The consumer _parse_metadata wrappers go: utils.metadata.parse_metadata is the one decoder, and the shaper's. The test's MCP helper builds a server per call: a plugin's tool context is process-wide and named the closed database of another world's server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
docs/json-contracts.md gains an "Entry row shape" section: metadata an object, aliases a list, declared bag fields lifted, a column field read by its declared type; the quoted-number limit, and what a task's priority reads today (not declared in KBSchema.type_fields: text on every index reader and kb_get alike). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
|
In progress. This head is not a reviewable state: every storage reader (ORM and raw, SQLite and Postgres) now returns rows through Generated by Claude Code |
Lifting declared bag fields onto raw rows added keys a reader never selected (a search hit gained `priority`, a `*` search row `actors`): tests/test_reader_reads_where_the_writer_writes.py (62 cells) and tests/test_search_contract.py::TestLeanSearchRows (4) failed on it. The shaper now only decodes metadata/aliases and casts by declared type; the lift stays in `_entry_to_dict` (and `read_fields`), with its own get_entry_class call, as test_the_row_shaping_and_the_file_read_share_the_one_lift_rule pins. A new cell pins that a raw reader's row gains no key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
IndexManager.read_fields runs cast_declared_columns with the same
DeclaredFieldTypes the row readers use, after read_metadata. kb_get, CLI
get and REST /api/entries/{id} now agree with every list and search row,
and a kb.yaml-declared number read and written back leaves the file's
bytes alone. The cells in tests/test_index_rows_have_one_shape.py
(committed in df1299a) go green with this commit; the read = row pin in
tests/test_get_reads_the_file.py holds unchanged, both sides cast.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
verify-red listed 41 cells that pass without the fix: the tool-table and backend ratchets, the own-dict walks, the task-priority agreement, the other-field write, the no-lossy-cast and no-new-key pins. Each is a deliberate control and now says why. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
|
The red Generated by Claude Code |
The advisory mypy ratchet read +6 against dev: KBConfig's path as a str, the ORM row dict typed object, and four new `self.session` reads on QueryMixin. Each find now binds the session once; the ratchet is +0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
|
Report posted at 1bd9550 Generated by Claude Code |
|
Cold read of 1bd9550 (Opus, read-only; no tests run): the property holds with limits; not landable yet. Every storage reader that returns whole entry rows goes through the one row shaper, and the list readers agree with the single read. Two claims go further than the code, and one limit is worse than 1. Worse than 2. No worse than 3. Postgres, by reading only. A bool and a float stored through Tests. Notes. The declared types are looked up from the index's Still open with the maintainer: #1503 (a) or (b) for the 🤖 Posted by the maintainer's conductor agent (Claude Code) |
|
Thanks for the cold read. I'm holding the fix round until finding 1's direction and the task (a)/(b) question are settled, as you said. Here is what I'd do, so the round can start as soon as they are. Finding 1: proposed direction. Cast only text that round-trips. A TEXT value becomes a number only when the number's canonical text is the column's text exactly:
The rest:
Generated by Claude Code |
|
Decisions (maintainer, 2026-11-17). Finding 1: (a) narrow the cast and accept the rest. Only plain ASCII whole numbers and decimals are cast (no surrounding whitespace, no sign prefix, no leading zeros, no exponent, no digits from other scripts), the same strictness as the importance rule in #1588. A quoted 🤖 Recorded by the maintainer's conductor agent (Claude Code) |
…mber (#1503) The maintainer's decisions on #1628 (2026-11-17): - Finding 1 of the cold read: only plain ASCII whole numbers and decimals are cast (no sign, whitespace, leading zero, exponent or other scripts; a decimal only when its float spells it back). "007", "+7", " 7 ", "1e3", "٧", "7", "7.50", "-7" stay the file's text, so a read written back cannot respell them. A checkbox reads only the backends' own spellings ("1"/"0" on SQLite, "true"/"false" on Postgres). - #1503 (a): task declares `priority: int` in TASK_TYPE_METADATA["fields"], read by KBSchema.type_fields beside CORE_TYPES, with no default (a created task's file is unchanged: pinned). The task-priority cells stop being strict xfails and pass. New cells pin each spelling's read and what a write-back leaves in the file: identical, except a quoted "7", which reads 7 and is stored 7 (the stated limit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
The decision on #1628 accepts that a quoted "7" in a declared number reads as 7 and a write-back stores 7, and asks `qa validate` to report the text. A new `number_as_text` warning, in the pass that reads each file's own values, names every numeric-looking text value in a field the type declares a number (a kb.yaml number, a task's priority) and says what Pyrite reads it as. Text that is no number stays the schema pass's `field_number` and the task-priority check's. Writes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
… reads the AST (#1503) Cold-read finding 3: the pg cell seeded the string "7" and could not see the backends' spellings. New cells seed an int, a float and a bool through crud.bindable, as the indexer does, and check a declared number and a declared checkbox read the same on SQLite and Postgres. The structural test now requires a call to shape_entry_row(s) in the function's AST (a comment naming it no longer passes: checked by removing the call from list_entries_in_folder), matches any SELECT that returns `*` or a shaped column from or joining `entry`, and asserts it sees the known readers. Four allowlisted functions say why they are not shaped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
) docs/json-contracts.md and the fragment no longer claim "the file keeps its quotes": a quoted "7" in a declared number reads as 7 and a write of that 7 stores it unquoted, and qa validate reports it (number_as_text). They state the plain-ASCII rule, that a task's priority is declared a number, the 7.0 spelling the backends differ on, and that kb_timeline returns date and location as text (cold-read finding 2) instead of claiming every index reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
|
Fix round 1 of 3 for #1628 (#1503), from the conductor. The maintainer decided both open questions at 19:28Z (comment above). This is the round. Your 19:12Z plan already covers most of it. Property (state it first in your report, then enumerate): an index reader returns a field's value with the JSON type the file gives it under the KB's declared schema. A read followed by a write-back of the value read never changes the file, with exactly one exception, which must be stated: a quoted plain number in a field declared a number ( Decision 1, finding 1 = (a): only plain ASCII whole numbers and decimals are cast. That means no surrounding whitespace, no sign prefix, no leading zeros, no exponent and no digits from other scripts, the same strictness as the importance rule in #1588. Your round-trip rule (
Decision 2, #1503 = (a): declare the Also from your 19:12Z plan, all in: reword "every index reader" to name the readers that carry entry rows, and say Rules: every commit passes the commit hooks (never |
REST PUT is the fourth write-back surface the round names. It accepts title, body, importance, tags and metadata, never a column field, so the cell sends back what a GET returned for those and compares bytes, for a nested bag and a task with a quoted priority. A control: it held before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf
|
Round 1 report posted at 1cfb97d ( Generated by Claude Code |
Fixes #1503
Branch: this cloud session was given its own branch name,
claude/mcp-kb-get-json-types-jrgmmo, which is used in place offix/1503-index-rows-one-shape.From the groom (#1503,
## Groom 2026-11-16):Decision (maintainer, 2026-11-16): option A1, one row-shaping function in
pyrite/storage/that every reader of entry rows returns through; and B option (i): list and search rows cast a TEXT column value by the field's declared type (KBSchema.type_fields) in that shaper, shipped with #730 P5's single read sokb_getand the list readers agree and a read written back never changes a file's type. Option (ii) is not built. A quoted"7"in a file reads as 7: a stated limit.The plan is a comment on this PR; the report follows.
Report
Branch:
claude/mcp-kb-get-json-types-jrgmmo. The session was given this branch name, so it replacesfix/1503-index-rows-one-shape. The work was done in the main cloud checkout, with no other session sharing it.Pushed:
1bd955063051085e68035cadcbd1907b92b65327==git ls-remote origin claude/mcp-kb-get-json-types-jrgmmo(checked).Commits (no rebase, amend or force-push;
devwas merged in as a merge commit):3cdb6afkb: the claim (backlog item, made with the CLI)df1299atest: the row-shape cells, committed before any production code898d352fix: every storage reader returns entry rows through one shaper9203ed2docs: the "Entry row shape" section and the fragment150b4ccfix: the shaper adds no key; the lift stays with the ORM row1e2c350Mergeorigin/dev(fix: a write never places an entry where the index walk does not list it (#1552) #1576,061388c7), before touchingindex.pye1bd018refactor: the single read casts a column by its declared type3270b67test: mark the 41 negative controls1bd9550refactor: type the shaper's calls so mypy adds no error (the advisory ratchet read +6 on3270b67; now +0)The backlog item stays
status: in_progress, notdone. The conductor's instruction was to stop at the report while the stop item is open; it is set to done once the maintainer answers and the task-priority cells are settled.Unsure
priorityis not cast.KBSchema().type_fields("task")is{}(confirmed by the conductor ona5f942bd).taskis not inCORE_TYPES, and no plugin implementsget_field_schemas. So under "the declared type comes fromKBSchema.type_fieldsonly", the issue's own case keeps reading"7". It does so on every index reader and onkb_getalike: one type, but not the integertask_*returns. Thekb_get→kb_updateround trip on a task still rewrites7as"7". My recommendation is (a): atasklayer intype_fields, read from afieldsdeclaration besideTASK_TYPE_METADATA, the wayresolve_type_metadatadoes at "Layer 1b". That needspyrite/schema/kb_schema.py, which I did not touch (it belongs to fix: a tagged or out-of-range value in kb_authored is returned or withheld with a true reason (#1568) #1611).@pytest.mark.xfail(strict=True, reason=UNDECLARED_TASK_PRIORITY):test_a_task_priority_reads_as_the_integer_in_the_file_on_every_mcp_row_reader(9 readers) andtest_a_task_priority_read_and_written_back_leaves_the_file_byte_identical(MCP, CLI, REST). They show as XFAIL on every run. The day a declaration makes the cast reach the task, they XPASS, andstrict=Trueturns that into a failure, so the marker must come off.tests/test_storage_invariants.py,tests/test_doc_write_as_patch.py'sKNOWN_DIVERGENCES;kb/maps/write-read-path-and-identity.md, "Tests that pin it"). It neither passes silently nor deletes or loosens a test.verify-redcounts these 12 as n/a, not as passes.test_a_task_priority_reads_as_kb_get_reads_it_on_every_mcp_row_reader, one type across readers.priorityreads as text on every index reader andkb_get, so both are true under (b).priority, a*search row gainedactors, and 66 existing cells failed (test_reader_reads_where_the_writer_writes.py62,test_search_contract.py::TestLeanSearchRows4). I kept the invariant. The shaper decodesmetadataandaliasesand casts; the lift stays where it was, in_entry_to_dict(with its ownget_entry_classcall, untouched) and inread_fields. So a backlog item'srankis at its own name on the ORM rows and the single read, and only insidemetadataon search and find rows. The maintainer might want raw rows lifted as well, but that is a projection change, which the brief puts out of scope.kbtable. Storage reads the KB's path (SELECT path FROM kb WHERE name = :n), thenKBConfig(name, path).kb_schema(kept per name and path, so it is stamp-cached as A kb.yaml that is not UTF-8 or not valid YAML stops every command on every KB #1547 made it), then.type_fields(entry_type). There is no service import, nokb_typeargument and no newget_entry_classcall. A kb.yaml that does not load reads as the core and plugin layers for a list. Someone might instead prefer the services to hand the schema down.test_list_entries_issues_two_statements_not_n_plus_one(Index rebuild writes one entry per transaction (2.8 ms/entry); list_entries is N+1 on tags #1044) caught one extra statement per listing. The test is unchanged. The lookup now runs only when a TEXT column holds text a cast could change (a number or a bool literal), once per KB and type per batch, never per row. A listing of task rows with numeric priorities therefore costs one more statement than before.get_timelineselectslocationwithoutentry_type, so no declared type can apply there. A kb.yaml that declaredlocation: numberwould read as text onkb_timelineand as a number elsewhere. That is classed as safe by reading: no type declares it, and the subset carries nometadata.Done, with evidence
tests/test_index_rows_have_one_shape.pywas run against untoucheddevcode (a detached worktree atorigin/devwith only the test copied in): 42 failed, 40 passed, 1 skipped, 12 xfailed. The red cells:kb_get,kb_list_entries,kb_recent,kb_batch_read,kb_find_by_status,kb_find_by_assignee,kb_find_overdue,kb_find_by_locationandkb_search. The groom namedkb_find_by_statusandkb_search; both are red:aliases '["Reg"]', NULLmetadata,priority '7'.get,list-entries,recent,search --fields '*'andbatch-read.GET /api/entries,GET /api/entries/{id},POST /api/entries/batchandGET /api/search?fields=metadata,importance.get_entry,get_entries,list_entries,search,search_by_tag,search_by_tag_prefix,search_by_date_rangeandlist_entries_in_folder, on SQLite and Postgres, plus SQLitesearch_semantic.PyriteDB.find_*.tests/test_test_rules.py. The pre-push affected suite passed one1bd018before the push went through.verify-red: 42 red · 0 import-only · 0 unexpected pass · 13 n/a · 41 control. The 13 n/a are the 12 strict xfails and the Postgressearch_semanticskip (no vector support in that cell). Each control carries its reason.scripts/cloud-postgres.sh,PYRITE_TEST_PG_URL). Thepgcells andtests/backends/test_backend_conformance.pyran here: red before, green after (test_list_entries_issues_two_statements_not_n_plus_one[postgres]included).tests/test_get_reads_the_file.py::test_on_a_fresh_index_the_file_read_equals_the_rowis unchanged and green: both sides cast with the same function and resolver./api/search'sSearchResultdropsmetadata.ruff checkandruff format --checkare clean on the changed files.1bd9550, run 44140292857):gatesuccess,verify-redsuccess,test (3.12, 1/2/3)success,mypy (advisory)success (ratchet +0),experimentalsuccess,kbsuccess. The redgateone1bd018was a run cancelled by the next push, not a test failure.The readers, and how each is classed (Covers)
queries.find_by_status/assignee/overdue/location(SQLite,PyriteDB)test_the_find_readers_return_each_field_with_its_files_type; MCPkb_find_*cellssqlite_backend/postgres_backendsearch,search_by_tag,search_by_tag_prefix,search_by_date_range,search_semantictest_a_backend_row_reader_returns_each_field_with_its_files_type[sqlite-*, postgres-*], parametrised fromSearchBackendbase_backend.list_entries_in_folder(REST folder collections;aliaseswas raw text there)[*-list_entries_in_folder]base_backend.get_entry/get_entries/list_entries(_entry_to_dict)kb_list_entries/kb_recent/kb_batch_read; CLI and REST listsIndexManager.read_fields(single read)kb_get, CLIget, REST/api/entries/{id}; the round trip; the agree cell; the pinSearchBackendmethods (31: counts, edges, links, tags, timeline, embedding stats ...)metadata/aliases/entry_typetest_every_backend_method_is_classified(a ratchet with a reason each)overlay_backendinvestigation_*out of scopetest_every_mcp_tool_is_classified; row cells;test_an_own_dict_tool_returns_no_metadata_or_aliases_as_textwalks 25 own-dict tools' results for a stringmetadata/aliases(14 need state these files lack and are listed withNone)--format json:get,list-entries,recent,search --fields '*',batch-readtest_a_cli_json_row_reader_...GET /api/entries,/api/entries/{id},POST /api/entries/batch,/api/search?fields=...test_a_rest_row_reader_...;/api/searchwithoutfieldsdropsmetadata(SearchResult): safe by its modelsw_*,wiki_*,social_*,zettel_*)db._raw_conn) or ORM readspyrite/storageonlyIndexManager._check_off_list_values(SELECT *viaexecute_sql)STRUCTURAL_ALLOWLIST, with its reasontest_every_storage_reader_of_entry_rows_returns_through_the_shaper: any function inpyrite/storagewith entry-row SQL must callshape_entry_row(s)test_a_raw_readers_row_gains_no_key_its_sql_did_not_select(red against the lifting version)Groom shapes covered:
metadata:{}, a nested object, and NULL (set on the row).aliases: NULL,[]and a list.rank).Footprint against the groom's "Touches"
storage/queries.py,storage/backends/sqlite_backend.py,postgres_backend.py,base_backend.py,services/task_service.py,services/rubric_checkers.py,server/endpoints/collections.py,docs/json-contracts.md(a new "Entry row shape" section only), the new test and the fragment.storage/index.pyread_fields, after merging fix: a write never places an entry where the index walk does not list it (#1552) #1576) and the backlog item.kb_service.py(_normalize_metadata_rowsis now a no-op and stays),kb_schema.py,core_types.py.Left
Noneare classified but not called: they need state (epics, components, an encyclopedia or social KB) these files lack.kb_service._normalize_metadata_rowscould be deleted. It is fix: a write never places an entry where the index walk does not list it (#1552) #1576's file, so I left it.PyriteMCPServerbuilt. In a process with two servers,sw_*answeredINTERNAL("Cannot operate on a closed database") once the other server's world closed. Captured in: the comment on_mcpin the test. Worth an issue if the maintainer agrees.Learned
KBSchema.type_fields("task")is{}; no plugin declares field schemas, sotype_fieldsalone cannot type a built-in column fieldUNDECLARED_TASK_PRIORITYand the strict xfails; the docs row-shape paragraph; the plan comment_parse_metadatacopies were already wrappers overutils.metadata.parse_metadata; it is now the only decoder (decode_metadatain storage is that function)_INTEGER_TEXTblock inbase_backend.py; the rubric_checkers commentkb_searchfieldstakes a list: a string such as"*"is accepted and silently projects toid/kb_name; REST and MCP treat*as an unknown name, and only the CLI reads it as "all"_rows_checknow requiresmetadataon every checked row, so a vacuous cell failsshape_entry_rowdocstring;test_a_raw_readers_row_gains_no_key_...; the fix commit message_castablegate inshape_entry_rowstatuslives in its bag, not the column (nostatusfield on a note), so the finds do not return ittest_the_find_readers_...rankis bm25 and shadows a backlog item's declaredrank_skips_for_mcpin the testTokens
Not reported by the harness.
Report (round 1)
The property. An index reader returns a field's value with the JSON type the file gives it under the KB's declared schema. A read followed by a write-back of the value read never changes the file, with exactly one exception: a quoted plain number in a field declared a number.
priority: "7"reads 7, and a write-back of that 7 storespriority: 7without the quotes.qa validatereports such a value (number_as_text).Branch:
claude/mcp-kb-get-json-types-jrgmmo.Pushed:
1cfb97d5e33d3f01762672ec88bd4eec1d27c06e==git ls-remote origin claude/mcp-kb-get-json-types-jrgmmo(checked).Commits this round (no rebase, amend or force-push):
01ccd55Mergeorigin/dev(brings in fix: a tagged or out-of-range value in kb_authored is returned or withheld with a true reason (#1568) #1611, sokb_schema.pyis free)664da3ffix: cast only plain ASCII numbers; a task declares its priority a number20cf15cfix: qa validate names text in a field declared a numberc5b7fe2test: backend cells seeded as the indexer binds; the structural guard reads the ASTdd4b74ddocs: the row shape says what the strict cast and a write-back do1cfb97dtest: a REST GET put back whole leaves the file byte-identicalThe decisions as built
read_declared_number(pyrite/storage/backends/base_backend.py) casts only0|[1-9][0-9]*(ASCII), and decimals(0|[1-9][0-9]*)\.[0-9]+whose float spells them back exactly (repr(float(t)) == t).+7,007,7,7.,1e3,٧,7,-7and7.50stay the file's text.test_a_declared_number_read_and_written_back_leaves_what_the_rule_saysruns 12 spellings × MCPkb_update, CLI-fand REST PATCH, comparing bytes. Every spelling that stays text leaves the file byte-identical."7"leavespriority: 7.qa validate. It did not report this before:_validate_field_valuerunsfloat(value), so"7"and"007"passed (checked on this branch before the change). A newnumber_as_textwarning sits in the pass that reads each file's own values (QAService._check_number_as_text). It names numeric-looking text in any field the type declares a number, and says what Pyrite reads it as. Writes are unchanged. Guarded bytest_qa_validate_reports_text_in_a_field_declared_a_number.taskdeclares one field:priority, typenumber("int"inTASK_TYPE_METADATA["fields"],pyrite/models/task.py).KBSchema.type_fieldsreads it besideCORE_TYPES, the wayresolve_type_metadatareads a task's settled statuses. No default is declared. MCPkb_create,task_createand CLIcreateproduce byte-identical task files ondevand on this head (compared; pinned bytest_declaring_a_task_priority_adds_nothing_to_a_created_tasks_file).priority: it is the one TEXT-column field of a task with a non-text type.status,assigneeanddue_dateread as text either way. Declaring the list and dict fields would feedKBService._with_declared_fields(the create path) for no gain.Enumeration: every place that casts or shapes a row, and every write-back surface
shape_entry_row(s)(decodemetadataandaliases; cast by declared type)IndexManager.read_fields(single read:kb_get, CLIget, REST/api/entries/{id})test_a_declared_numbers_file_spelling_reads_by_the_strict_rule(12 spellings); the read = row pin (unchanged)_entry_to_dict(ORM:get_entry,get_entries,list_entries)kb_list_entries/kb_recent/kb_batch_readqueries.find_by_status/assignee/overdue/locationtest_the_find_readers_...; MCPkb_find_*search,search_by_tag,search_by_tag_prefix,search_by_date_range,search_semanticSearchBackendbase_backend.list_entries_in_foldercrud.bindable: int, float, bool)test_typed_values_the_indexer_binds_read_the_same_on_every_backend(SQLite and Postgres, run here)get_timeline(kb_timeline)entry_type, so no declaration applies;dateandlocationreturn as text (now in the docs)STRUCTURAL_ALLOWLIST, with its reasoncheck_health,_check_off_list_values(index health)kb_ops.get_kb_statsk.*is thekbtableSearchBackendmethodstest_every_backend_method_is_classifiedinvestigation_*out of scopetest_every_mcp_tool_is_classified; own-dict walkkb_updateupdate -ftitle,body,importance,tagsandmetadata, never a column field; guarded anywaytest_a_rest_get_put_back_whole_leaves_the_file_byte_identical(a nested bag; a task with a quoted priority)test_every_storage_reader_of_entry_rows_returns_through_the_shapernow requires a call in the AST. The SQL pattern is widened to anySELECT ... FROM/JOIN entryreturning*or a shaped column; an allowlist with reasons; it asserts the known readers are seen. Removing the call fromlist_entries_in_folder(with the name left in a comment) makes it fail. The old text check passed that.Evidence
scripts/test-affected --runon the tree ofdd4b74d(the last commit after it adds one control cell): 26711 passed, 257 skipped, 7 xfailed, 0 failed.verify-red: 72 red · 0 import-only · 0 unexpected pass · 1 n/a · 71 control. The n/a is the Postgressearch_semanticskip. Every control carries its reason; the spelling cells that keep text are controls, red against the loose cast, not againstdev._CHECKBOX_TEXTcut to"1"/"0", the three Postgres cells oftest_typed_values_the_indexer_binds_...fail and the SQLite ones pass (run here)."+7"," 7 ","007","٧","7"and"-7"fail."1e3","7."and"7.50"are held by the decimal and round-trip checks.scripts/cloud-postgres.sh), including the newcrud.bindablecells.Unsure
"1","0","true"and"false", not"1"/"0"only. The round brief restated my 19:12Z proposal of"1"/"0", but that proposal was wrong for Postgres: its assignment cast stores a PythonTruein a TEXT column as"true"(SQLite binds it as1).test_typed_values_the_indexer_binds_read_the_same_on_every_backend[postgres-*]fails with"1"/"0"only. So the cast accepts exactly those four spellings, no folding and no whitespace. The cost: a quoted"true"in a checkbox field reads as a bool on either backend (the same class of limit as"7"). If the maintainer wants"1"/"0"only, Postgres checkboxes read as text."7.50"stays text because its float writes back as7.5. That is stricter than "plain decimals", in the direction of no respelling.7.0; Postgres prints7. Both are JSON numbers, but a write-back on Postgres could respell7.0as7. This is stated in the docs and not pinned.pyrite/schema/kb_schema.pyandpyrite/models/task.py(decision (a));pyrite/services/qa_service.py(the decision'sqa validatereport).Notes (from the cold read)
0orFalseis falsy where the text"0"was truthy. software-kb'srow["priority"] or meta.get(...)reads rows from its own SQL (db._raw_conn), which this change does not reach. A backlog item'spriorityis a select (text). Any new consumer of shaped rows must testis None, not truthiness.kb.path, so an overlay's diff rows are cast by the worktree'skb.yamland main rows by main's. A change set that edits a declaration reads its own rows by its own schema.KBConfig.kb_schemalogs the failure once per file; a single read of that KB refuses it (A kb.yaml that is not UTF-8 or not valid YAML stops every command on every KB #1547).kb_searchand the finds now returnmetadataas an object (in the changelog).Learned
qa validate's number check isfloat(value), so numeric text in a declared number was never reportedQAService._check_number_as_textdocstring; its testtrue, SQLite's is1; a whole float prints7on Postgres,7.0on SQLite_CHECKBOX_TEXTcomment;test_typed_values_the_indexer_binds_...docstring; the docsDoubleQuotedScalarString)test_a_declared_numbers_file_spelling_reads_by_the_strict_rule_callsin the structural test; the mutation check aboveLeft
Noneare classified but not called.🤖 Generated with Claude Code
https://claude.ai/code/session_013BnEiWHHJjCS2XCy3CjZqf