Repository navigation
decision.record accepts a scenario written without Latin letters - #238
Merged
Merged
Conversation
zlareb1
force-pushed
the
fix/record-key-non-latin
branch
2 times, most recently
from
November 4, 2026 00:07
894e21e to
0ef5104
Compare
An identity value with no a-z, 0-9 characters (Cyrillic, CJK, Arabic) canonicalised to "", so canonical_record_key raised and decision.record answered 500. Such a value now keys on its letters, digits and marks in any script after NFKC and casefold. A value with an a-z, 0-9 form keeps it, so no stored key changes. A value of punctuation alone still has no key and is now 400 MISSING_IDENTITY_FIELD in decision.record and memory.record.write. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The fallback started from the mark-stripped text, so every combining mark with a nonzero class was gone and words that differ only in one collided: かぎ and かき, ไม่ and ไม้, क्या and कया. It now starts from the raw value, NFKC and casefold, and keeps every letter, digit and combining mark. The a-z, 0-9 path is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The docs now say that any a-z or 0-9 after compatibility decomposition wins, and that a name-like field drops combining marks. The record-write test uses values that reach the non-Latin form, and a marks-only value is a 400. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…imit A name-like field drops accents and other combining marks and is refused only for separators alone; any other field is refused for punctuation or marks alone. A test pins that "30 дней" and "30 часов" share a key. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
No letter or digit means punctuation, symbols or marks alone; a name-like value is refused only for separators or combining marks alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
fix/record-key-non-latin
branch
from
November 4, 2026 01:16
76c2af1 to
ccf23cf
Compare
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
decision.recordandmemory.record.writeaccept an identity value written only in a non-Latin script (Cyrillic, CJK, Arabic) instead of answering 500, and a non-name identity value of punctuation, symbols or marks alone is refused with 400MISSING_IDENTITY_FIELD.Why
A record's derived key canonicalises each non-name identity value to its
a-z0-9characters after NFKD, mark stripping and casefold (server/memory/domain/record_identity.py::canonical_value). A scenario with no Latin letter or digit, such asСрок хранения журналов, canonicalises to"",canonical_record_keyraisesValueError: identity field 'scenario' is empty, and nothing maps it:decision.recordanswered 500INTERNAL_ERROR.memory.record.writefailed the same way for any non-name identity field of that shape, andloom decisions extractdropped such candidates with "no letters or digits a-z, 0-9 to build a key from".The fix: when that
a-z0-9form is empty, the value keys on every letter, digit and combining mark of the raw value, after NFKC and casefold. The fallback starts from the raw value, not the mark-stripped text, because in these scripts a mark tells words apart: Indic vowel signs and viramas (क्या/कया), Thai tone marks (ไม่/ไม้), the Japanese voicing mark (かぎ/かき), Arabic and Hebrew points. So a word written with and without its Arabic vowel points gets two keys. Every key that exists today came from a non-emptya-z0-9form, which still wins, so no stored key changes and nothing needs a backfill.A value with no letter or digit in any script (
?! …) still has no key, and is now a 4xx:decision.recordchecks the category and scenario before any write and answers 400MISSING_IDENTITY_FIELDwith the empty fields, the codememory.record.writealready uses for an identity field without a value.memory.record.writecounts an identity value that canonicalises to""(whitespace, or a non-name identity value of punctuation, symbols or marks alone) as missing, so it gets the same 400 instead of theValueError.Name-like fields (
name,title,label,*_name,*_title,*_label) keep their rule: it already keeps letters in any script, drops accents and the other combining marks (the Japanese voicing mark, the virama, Thai tone marks; Indic vowel signs stay), and is refused only when nothing is left once separators, combining marks, a leading article and a possessive are dropped.Known limit, left as is because changing it would re-key stored records: a value with any a-z or 0-9 after compatibility decomposition (
30 дней,2024年度,№,℃) keys on those characters alone, so two values that differ only in their other characters share one key (30 днейand30 часов; a unit test pins this). A name-like field drops the Japanese voicing mark, soかぎandかきshare a name key. The typed-records section ofdocs/features/memory/writing.mdnow states the rule and this limit.Scope and risk
decision.recordandmemory.record.write, the extractor's drop reason, and three docs files (two pages plus the generated errors reference).invoice:bef11f75f1b36a62) and one decision key was checked by hand before and after.Compatibility, rollout and rollback
decision.recordanswers 400MISSING_IDENTITY_FIELD(fields: the empty ones) where it answered 500;memory.record.writeanswers its existing 400 for a non-name identity value of punctuation, symbols or marks alone. A non-Latin identity value now records.Tests
main,decision.recordwith a Cyrillic category and scenario answered500 INTERNAL_ERROR; the new unit tests fail onmain.tests/unit/test_record_identity.py: Cyrillic, CJK, Arabic and Devanagari values get distinct keys,かぎ/かき,ไม่/ไม้,क्या/कयाand pointed/unpointed Arabic differ, the same text twice gives the same key, case and punctuation do not count, the pinned ASCII key is unchanged,30 днейand30 часовshare a key (the documented limit), punctuation, symbols (€$) or marks alone is empty;memory.record.writewith an identity value of punctuation, symbols, whitespace or marks alone (a lone combining mark, a loneा) is 400MISSING_IDENTITY_FIELD, and٣٤٥andсчётrecord under two keys.tests/unit/test_decision_ops.py: a Cyrillic decision records under one key for its record and memory row; a scenario with no letter or digit (?! …) is 400 before any write.tests/unit/test_decision_extract.py: the drop case is now a scenario with no letter or digit (?! …), with the new reason.tests/integration/test_decision_record_source.py(new test, against a local server): a Cyrillic decision records, a case and punctuation variant supersedes it, another scenario gets another key, and?! …raisesMISSING_IDENTITY_FIELD. That file,test_memory_for_file_decisions.pyandtest_memory_records_roundtrip.pypass.make format lint typecheck,tests/unit/test_public_copy.py,tests/unit/test_doc_links.py, and the full unit suite on head 0ef5104, rebased on the latestmain(26355 passed, 20 skipped, 1 xfailed). The diff since is a code comment and one added unit assertion;tests/unit/test_record_identity.pypasses on the final head.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked: every caller of
canonical_record_key, the pinned key value, the 500 reproduced onmainand gone on this branch.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code