Phase 4 / Ep 18: Mental Model (Bidirectional Sync Conflict Resolution)

⏱ Est. reading time: 3 min Updated on 4/13/2026

We are about to step into a major pitfall: if an event is modified simultaneously in both your T-Block system and the Google Calendar system, which one takes precedence?

In engineering, this is the classic distributed data consistency (Eventual Consistency) dilemma. Average-tier Large Language Models (LLMs) facing complex business logic branches often short-circuit at this point, churning out infinite loops filled with countless if-else statements.

1. Pulling the Frontline Back to the findings.md Debate Zone

Bad code isn't the result of poor technical skills, but rather unclear business flows. We need to command this geek architect to step away from the keyboard (stop coding) and return to the whiteboard.

"We have entered deep waters. Regarding calendar event sync conflicts, please do not write the evaluation logic directly. You now need to conduct a thorough analysis and deduction of the conflict strategy to be adopted by T-Block. We currently have three main schools of thought: 1. LWW (Last Write Wins based on absolute timestamp); 2. Local Win (T-Block manual edits always take priority); 3. Remote Win (Google is always the source of truth).

As a system minimalist, please analyze these and recommend the best option. Document this as the official arbitration manifesto in docs/findings.md, and include a code processing flow sketch (pseudocode) within it."

2. The Arbitration Report from the Cyber Brain

After undergoing deep computation, the Agent will return its arbitration to you. Typically, a good model will reject a blind LWW approach at this stage, pointing out that: "Timestamps uploaded from mobile calendar edits after reconnecting from an offline state often have an extremely high rate of false positives."

Since T-Block is built upon the Google ecosystem, it will often arrive at an excellent conclusion like this and save it to the disk:

# [Design Decision] Final Arbitration on Conflict Strategy
**Resolution: Adopt Baseline Remote Wins with Local Revision Tags.**
All primary keys and macro-level changes (date changes, time changes) will strictly use the data sent from the Google API side as the main backbone (Source of Truth). However, the detailed Task Description breakdowns generated locally will be stored in a dedicated extended JSON field. During a merge, only the foundational time information will be forcefully overwritten by Google.

3. Forging the Resolution into the Backbone of the Code

Once the human says the word: "Approve".

This resolution takes effect immediately. In the next round, when we initiate the coding requirements and the Agent writes the highly complex aggregation function syncLocalToRemote(), it won't act like a headless fly. It will remain fiercely loyal to "Remote Win" as the ultimate fallback catch and the root logic for Object Merge.

A codebase written this way is clean, bulletproof, and clearly traceable.