From b61ccf2bee58a2132da1a37b15a28284db926416 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 12 Mar 2026 22:40:58 -0400 Subject: [PATCH] pivot --- .github/workflows/sync-docs-discourse.yml | 2 +- docs_sp/tools/discourse_client.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-docs-discourse.yml b/.github/workflows/sync-docs-discourse.yml index 0417b6b713..0be7cffbcc 100644 --- a/.github/workflows/sync-docs-discourse.yml +++ b/.github/workflows/sync-docs-discourse.yml @@ -48,7 +48,7 @@ jobs: # Append sync footer gh_url = f'https://github.com/sunnypilot/sunnypilot/blob/{GITHUB_BRANCH}/docs_sp/{DOC_PATH}' - body = body.rstrip('\n') + f'\n\n---\nThis document is version-controlled. Suggest changes [on GitHub]({gh_url}).\n\n\n' + body = body.rstrip('\n') + f'\n\n---\nThis document is version-controlled. Suggest changes [on GitHub]({gh_url}).\ndocs-sync-id: {DOC_PATH}\n' # Extract title from front matter or first heading title = None diff --git a/docs_sp/tools/discourse_client.py b/docs_sp/tools/discourse_client.py index f9ed6ce2a3..c0a031332d 100644 --- a/docs_sp/tools/discourse_client.py +++ b/docs_sp/tools/discourse_client.py @@ -98,9 +98,11 @@ class DiscourseClient: # ----- Public API ----- def find_topic_by_sync_id(self, sync_id: str) -> dict[str, Any] | None: - """Find an existing topic by its embedded sync ID comment. + """Find an existing topic by its embedded sync ID marker. - Searches for topics containing . + Searches for topics containing the visible sync ID text + ``docs-sync-id: {sync_id}``. The marker must be visible (not an + HTML comment) so that Discourse indexes it. Args: sync_id: The doc path used as sync identifier. @@ -108,7 +110,7 @@ class DiscourseClient: Returns: Topic dict with at least 'id' key, or None if not found. """ - query = f"" + query = f'"docs-sync-id: {sync_id}"' encoded = urllib.parse.urlencode({"q": query}) data = self._get(f"/search.json?{encoded}") if data is None: