Skip to content

Commit 5f75196

Browse files
committed
fix(sync): expose viewSectionIds to the local API and exclude it from MCP writes (#1090)
1 parent a79955b commit 5f75196

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

apps/desktop/src-tauri/src/local_api.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,10 @@ fn sanitize_task_patch_map(patch: &mut Map<String, Value>) -> Result<(), String>
26552655
"attachments" => value.is_null() || valid_attachments(value),
26562656
"relativeStartOffset" => value.is_null() || valid_relative_start_offset(value),
26572657
"recurrence" => value.is_null() || valid_recurrence(value),
2658+
// Presentational grouping per view (#1090). Keys are view scopes and
2659+
// values are section ids from the settings catalogue; this engine
2660+
// never resolves them, so it only checks the shape.
2661+
"viewSectionIds" => value.is_null() || valid_view_section_ids(value),
26582662
_ => return Err(format!("Unsupported task field: {key}")),
26592663
};
26602664
if !valid {
@@ -2664,6 +2668,13 @@ fn sanitize_task_patch_map(patch: &mut Map<String, Value>) -> Result<(), String>
26642668
Ok(())
26652669
}
26662670

2671+
fn valid_view_section_ids(value: &Value) -> bool {
2672+
let Some(map) = value.as_object() else {
2673+
return false;
2674+
};
2675+
map.values().all(|entry| entry.as_str().is_some_and(|id| !id.trim().is_empty()))
2676+
}
2677+
26672678
fn js_string_length(value: &str) -> usize {
26682679
value.encode_utf16().count()
26692680
}

apps/mcp-server/src/task-write-field-exclusions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ export const TASK_WRITE_FIELD_EXCLUSIONS: Readonly<Partial<Record<keyof Task, st
1515
+ 'file bytes this text interface cannot supply.',
1616
orderNum: 'Legacy alias of `order` (same SQLite column) — this surface exposes only '
1717
+ '`order` to avoid two keys writing one value.',
18+
viewSectionIds: 'Presentational per-view grouping whose section ids live in a settings '
19+
+ 'catalogue this surface cannot enumerate or create, so a raw id map would be '
20+
+ 'unusable from a tool call (#1090).',
1821
};

0 commit comments

Comments
 (0)