fix: port upstream correctness fixes (#1164, #1214, #1215, #1243, #1314)#5
Merged
Merged
Conversation
Sync the Rust port with upstream milla-jovovich/mempalace HEAD (68319dc), porting five high-priority correctness fixes since the previous sync point 94f1689. * #1243 — diary tools lowercase agent_name so reads are case-insensitive * #1214 — KG.add_triple rejects inverted intervals (valid_to < valid_from) * #1215 — EntityRegistry.save uses atomic write (tmp + fsync + rename + parent dir fsync on Unix) * #1164 — ISO-8601 validation at MCP boundary for as_of, valid_from, valid_to, and ended * #1314 — tool_kg_add forwards valid_to and source_file; tool_kg_invalidate resolves omitted ended to today Also adds .devin/skills/sync-upstream-mempalace/SKILL.md documenting the sync procedure for future sessions, and updates port.txt with the new sync ledger entry and remaining gaps.
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.
Summary
Sync the Rust port with upstream
milla-jovovich/mempalaceHEAD (68319dc). The previous sync ledger point recorded inport.txtwas94f1689, so this PR scans the 335 intervening commits and ports five high-priority correctness fixes that affect data integrity or KG query results.Each fix carries the upstream issue number in a Rust code comment + a regression test mirroring the upstream test name, so the next sync session can grep for them.
Ported
e9222b4)tool_diary_write/tool_diary_readlowercaseagent_nameso reads are case-insensitive. Writing asClaudeand reading asclaudeno longer silently returns zero rows.0b8c2c1)add_triplerejects inverted intervals (valid_to < valid_from) at write time — they would otherwise be invisible to every query and corrupt the store silently.4f36145+2e441d1)save()now writes to a sibling.tmp, fsyncs,renames over the target, and (on Unix) fsyncs the parent directory for ext4-class durability across power loss.4d98b05)config::sanitize_iso_temporalvalidates ISO-8601 dates / canonical UTC datetimes foras_of,valid_from,valid_to,ended. Malformed dates now produce a clear MCP error instead of silently returning empty result sets.e4e25ed)tool_kg_addforwardsvalid_toandsource_file(so historical facts can be backfilled in one call);tool_kg_invalidateresolves an omittedendedto today's date in the response instead of the literal sentinel"today".Not in scope (explicitly deferred, recorded in
port.txt)source_drawer_idprovenance — requiresALTER TABLE triplesmigration; tracked for a follow-up PR.1d3eecbfeat(sync), Pythonmempalace/sync.py) — larger feature, own PR.--llm-*CLI flags — carried forward from the previous ledger.Sync infrastructure
.devin/skills/sync-upstream-mempalace/SKILL.mddocumenting the upstream-sync procedure (clone, diff against ledger commit, triage priorities, port checklist, gating commands) so future sessions can replay this loop deterministically.port.txtwith a new "Sync update — upstream HEAD68319dc" entry listing what was ported and the updated remaining gaps.Review & Testing Checklist for Human
Claude) will continue to be readable, but only when read with the lowercased name; reading them with the original mixed-case form will now match too because the comparison is case-insensitive. New writes are stored lowercased.mempalace_kg_addthatvalid_from=2026-12-31 valid_to=2026-01-01is rejected, and that point-in-time facts (valid_from == valid_to) and open intervals (only one bound) still succeed.EntityRegistry.savedurability on your filesystem. On macOS / non-ext4 platforms the parent-dir fsync is a no-op (errors are swallowed), which matches the Python implementation's behavior; on ext4 it is the durability guarantee.port.txtentry to confirm the sync procedure and ledger match how you want future sync sessions to work.Test plan to verify end-to-end:
rustup update stable && cargo build --workspacecargo test --workspace— expect424 passed; 0 failedtotal (17 new regression tests added in this PR).cargo clippy --workspace --all-targets -- -D warnings— expect clean.mempalace_kg_querywithas_of="not-a-date"should return an MCP error.mempalace_kg_invalidatewithoutendedshould return a realYYYY-MM-DDvalue in the response, not the string"today".Notes
The five fixes touch four files; each fix is locally scoped so the diff stays small. No new dependencies. No schema changes. The new
sanitize_iso_temporallives next to existingConfig::*helpers incrates/core/src/config.rsso it's discoverable by other MCP tools that need date validation in the future.