fix(socket): persist outbound edges from locked blocks#3404
fix(socket): persist outbound edges from locked blocks#3404waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR fixes a server-side bug where outbound edges from locked blocks were being incorrectly blocked from persisting, by removing the source block protection check from all four edge operation paths in
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Edge Operation Request] --> B{Operation Type}
B -->|ADD| C[Fetch source + target blocks]
B -->|REMOVE| D[Fetch source + target blocks]
B -->|BATCH_ADD| E[Fetch all connected blocks]
B -->|BATCH_REMOVE| F[Fetch all connected blocks]
C --> G{Is target block protected?}
D --> H{Is target block protected?}
E --> I{Filter: any target protected?}
F --> J{Filter: any target protected?}
G -->|Yes| K[Skip — log warning]
G -->|No| L[Insert edge to DB]
H -->|Yes| M[Skip — log warning]
H -->|No| N[Delete edge from DB]
I -->|All protected| O[Skip all — log warning]
I -->|Some safe| P[Insert safe edges to DB]
J -->|All protected| Q[Skip all — log warning]
J -->|Some safe| R[Delete safe edges from DB]
style K fill:#f99,stroke:#c00
style M fill:#f99,stroke:#c00
style O fill:#f99,stroke:#c00
style Q fill:#f99,stroke:#c00
style L fill:#9f9,stroke:#090
style N fill:#9f9,stroke:#090
style P fill:#9f9,stroke:#090
style R fill:#9f9,stroke:#090
Last reviewed commit: 5a2b2ea |
Additional Comments (1)
The EDGE_REMOVE operation still checks both This is the same class of bug just fixed in the EDGE_ADD case. The fix should be applied here as well: |
2281275 to
c42e456
Compare
|
@greptile |
|
@cursor review |
Additional Comments (1)
The This means outbound edges from locked blocks will be silently skipped when added/removed via batch operations, even though the same operations work correctly via single-edge paths. Both filters should only check the target block: // BATCH_REMOVE_EDGES — should be:
const safeEdgeIds = edgesToRemove
.filter((e: EdgeToRemove) => !isBlockProtected(e.targetBlockId))
.map((e: EdgeToRemove) => e.id)
// BATCH_ADD_EDGES — should be:
const safeEdges = (edges as Array<Record<string, unknown>>).filter(
(e) => !isBlockProtected(e.target as string)
) |
|
@greptile |
|
@cursor review |
Additional Comments (2)
Since the source block's protection is no longer checked, fetching it from the database is unnecessary. The
After removing source block protection checks, The same applies to the |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Summary
Type of Change
Testing
Tested manually
Checklist