Repository navigation
fix(storage): enforce one KG and relation name grammar - #152
Merged
Merged
Conversation
jsam
force-pushed
the
fix/persist-effective-delta
branch
from
October 2, 2026 13:19
2284549 to
6902668
Compare
Names must start with a-z and contain only a-z, 0-9 and '_' (KG <= 128
bytes, relation <= 256). Checked in create_knowledge_graph,
insert_tuples_into, delete_tuples_from and register_schema_in, so every
entry path rejects ':' and the shard key "{kg}:{relation}" stays
unambiguous.
Recovery and drop assign shards to the longest KG name from metadata
instead of split(':'), so legacy names like "user:42" no longer create a
phantom "user" KG, and dropping "user" leaves "user:42" intact. Startup
warns about existing invalid names; troubleshooting docs list drop steps.
Closes #106
Validate names in register_or_update_schema_in and its session variant. Infer legacy colon KGs missing from metadata from the last ':' of the shard key, roll back create_knowledge_graph when the metadata save fails, and drop the unused InvalidRelationName variant.
jsam
force-pushed
the
fix/name-validation
branch
from
October 2, 2026 14:04
217dc18 to
70b9a25
Compare
jsam
added a commit
that referenced
this pull request
Oct 3, 2026
Rebased onto #152: map StorageError::InvalidName to Validation, and expect invalid-name statements as structured statement errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jsam
added a commit
that referenced
this pull request
Oct 3, 2026
Rebased onto #152: map StorageError::InvalidName to Validation, and expect invalid-name statements as structured statement errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jsam
added a commit
that referenced
this pull request
Oct 3, 2026
Rebased onto #152: map StorageError::InvalidName to Validation, and expect invalid-name statements as structured statement errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jsam
added a commit
that referenced
this pull request
Oct 3, 2026
* fix(protocol): report per-statement failures structurally
QueryJob records each failed statement as {index, code, message} in
QueryResult.errors instead of only a message row. A one-statement
program that fails is a WS error frame with a code; a longer program
returns a result whose errors[] names each failed statement, including
when the program ends in a query. Removes is_error_message phrase
matching; ontology commands and .kg drop cleanup read errors.
* fix(ontology-client): read structured statement errors in soft_errors
soft_errors returns the engine's errors[] when present. For engines
without it, message rows must match an exact success shape: the old
prefix allowlist accepted "Relation 'x' not found." and
"Rule 'x' not found." as success. Adds table-driven tests over every
engine message.
* fix(protocol): route every statement failure through statement status
Rule, session-rule, storage and query failures no longer abort the
program: each is recorded in errors[] with a code and later statements
still run. Session-bound /ws rules and facts get code=validation, index
and .kg use errors are classified by cause, and ontology remove/upgrade
tolerate rules that are already gone. SDK and GUI frame types model
errors and code.
* fix(protocol): adapt to the InvalidName storage error from #152
Rebased onto #152: map StorageError::InvalidName to Validation, and expect
invalid-name statements as structured statement errors.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
jsam
added a commit
that referenced
this pull request
Oct 3, 2026
* fix(protocol): report per-statement failures structurally
QueryJob records each failed statement as {index, code, message} in
QueryResult.errors instead of only a message row. A one-statement
program that fails is a WS error frame with a code; a longer program
returns a result whose errors[] names each failed statement, including
when the program ends in a query. Removes is_error_message phrase
matching; ontology commands and .kg drop cleanup read errors.
* fix(ontology-client): read structured statement errors in soft_errors
soft_errors returns the engine's errors[] when present. For engines
without it, message rows must match an exact success shape: the old
prefix allowlist accepted "Relation 'x' not found." and
"Rule 'x' not found." as success. Adds table-driven tests over every
engine message.
* fix(protocol): route every statement failure through statement status
Rule, session-rule, storage and query failures no longer abort the
program: each is recorded in errors[] with a code and later statements
still run. Session-bound /ws rules and facts get code=validation, index
and .kg use errors are classified by cause, and ontology remove/upgrade
tolerate rules that are already gone. SDK and GUI frame types model
errors and code.
* fix(protocol): adapt to the InvalidName storage error from #152
Rebased onto #152: map StorageError::InvalidName to Validation, and expect
invalid-name statements as structured statement errors.
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.
KG names could contain ':', which made shard keys
{kg}:{relation}ambiguous. Droppinguserwipeduser:42, and restarts created phantom KGs.src/naming.rs: names start with a-z and contain only a-z, 0-9 and_(KG up to 128 bytes, relation up to 256). Checked on KG create, insert, delete and every schema registration path.Tests:
tests/name_validation_tests.rscovers rejection, phantom KGs, prefix drop, stale or missing metadata and create rollback. fmt, clippy-D warnings,cargo test --workspace(3412 passed) and snapshot tests (1149 passed) all pass.Closes #106