fix(store,chunkcodec): add relation entity support to cloud sync pipeline#329
fix(store,chunkcodec): add relation entity support to cloud sync pipeline#329parraletz wants to merge 6 commits into
Conversation
…ir pipeline - Add SyncEntityRelation to supported legacy entities in evaluateCloudUpgradeLegacyMutationTx. - Implement full case SyncEntityRelation with decode, field inference from memory_relations, missing-field validation, and repairable/canonicalization logic. - Add unit test for relation legacy mutation repair from authoritative local state. This fixes cloud sync being blocked by upgrade_blocked_legacy_mutation_manual: unsupported legacy mutation "relation"/"upsert" when relation mutations are pending for a project.
…alizer - Add SyncEntityRelation to validateSupportedMutation. - Add mutationRelationPayload struct matching syncRelationPayload wire format. - Add case SyncEntityRelation in normalizeMutationPayload with decode, required-field validation (source_id, target_id, relation, judgment_status, created_at, updated_at), and project canonicalization. - Add unit tests for relation upsert (project rewrite), missing required fields rejection, and relation delete. This fixes the client-side chunk export failing with canonicalize cloud chunk: unsupported mutation "relation"/"upsert".
|
The fix for cloud sync being blocked by relation mutations is ready for review in PR #329. It links the approved issue #313 and includes regression coverage for both the legacy mutation evaluator and the chunk codec canonicalizer. Manual end-to-end verification was also completed successfully. Could you please add the |
There was a problem hiding this comment.
Pull request overview
This PR fixes cloud sync being blocked by legacy relation mutations by adding SyncEntityRelation support to both the legacy-mutation upgrade evaluator (preflight/repair) and the cloud chunk canonicalizer, along with unit tests covering the new paths.
Changes:
- Extend legacy cloud-upgrade mutation evaluation/repair logic to handle
relationupserts/deletes. - Extend chunk canonicalization/validation to accept and normalize
relationmutations (including project rewrite). - Add focused unit tests for relation mutation repair and chunk canonicalization behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/store/store.go | Adds relation to supported legacy entities and implements relation payload decode/repair/validation in the upgrade evaluator. |
| internal/store/store_test.go | Adds a regression test ensuring malformed legacy relation payloads can be repaired from local state. |
| internal/cloud/chunkcodec/chunkcodec.go | Adds relation to supported mutations and normalizes relation payloads (required fields + project canonicalization). |
| internal/cloud/chunkcodec/chunkcodec_test.go | Adds tests for relation upsert (project rewrite), missing required fields rejection, and relation delete. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use mutation.Project as authoritative fallback for body.Project instead of local.Project (memory_relations has no project column). - Remove ifnull(..., "") wrappers from nullable columns (marked_by_actor, marked_by_kind, marked_by_model, session_id) in the memory_relations query so NULL stays nil in *string pointers instead of becoming non-nil empty strings.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Probé contra una DB con el bug real (3 mutations relation/upsert atascadas bloqueando sync). Cliente, OK:
Server, me trabé:
O sea, el fix funciona end-to-end siempre que cliente + server cloud estén ambos en el binario con el PR. Si solo se sube el cliente, los push con relation/upsert vuelven con 400. Sugerencia: dejar nota en release sobre upgrade simultáneo cliente+server. O que el server haga back-compat durante una versión intermedia (acepte y haga skip de relation mutations, en vez de 400). Bonus, el handler de error con sugerencias de recovery está muy útil: |
…nc relation mutation conflicts - Combines main with relation mutation support from branch - Validates relation mutations with required fields (MarkedByActor, MarkedByKind, CreatedAt, UpdatedAt) - Ensures relation entity only supports Upsert operation - Updates tests to match combined validation logic
0e73891 to
5f89cb0
Compare
|
The merge with main is complete and all tests pass. However, the automated PR validation workflow requires a type:* label for the PR to be mergeable. Could you please add the type:bug label to this PR? This is needed for the GitHub Actions workflow check-type-label to pass. Thanks! |
Linked Issue
Closes #313
PR Type
type:buglabel to be merged.Add the
type:buglabel from the PR labels sidebar or run:gh pr edit 329 --add-label 'type:bug'type:bug— Bug fixSummary
...