Skip to content

fix(storage): preserve divergent session variants#428

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
codex/consolidation-session-collisions
Jul 10, 2026
Merged

fix(storage): preserve divergent session variants#428
ScriptedAlchemy merged 1 commit into
masterfrom
codex/consolidation-session-collisions

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • preserve divergent session projections and raw content as deterministic active variants
  • remap dependent references while keeping equal-content raw representation target-canonical
  • migrate safe pre-merge consolidation ledgers to algorithm v2 and fail closed post-merge

Verification

  • cargo test --lib migrate::consolidate::tests
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a9b4f16

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

@codex review

@ScriptedAlchemy ScriptedAlchemy merged commit 0061289 into master Jul 10, 2026
10 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9b4f16c5e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +799 to +803
FROM source.lcm_external_payloads s
LEFT JOIN consolidation_message_map m
ON m.provider=s.provider AND m.original_id=s.message_id
WHERE NOT EXISTS (
SELECT 1 FROM target_input.lcm_external_payloads t

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip payload rows when their raw row is deduped

When a source raw message collides with the target on provider/message_id but only differs in representation (same content_hash, e.g. source external payload_ref B while the target is inline or uses payload_ref A), raw_content_divergent is 0 so the raw row is intentionally not inserted and consolidation_raw_map points at the target raw row. This block still inserts the source lcm_external_payloads row whenever B is absent from target_input, leaving a payload owner/file in the destination that no lcm_raw_messages row references; the verifier mirrors this union, so it will not catch the orphan. Gate these payload rows on the source raw row actually being preserved/remapped rather than on payload_ref absence alone.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant