Skip to content

docs(query): make the query snippets run as written - #225

Merged
ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:bob/docs-query-snippets-run-as-written
Nov 24, 2026
Merged

ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:bob/docs-query-snippets-run-as-written

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

The query-language page's snippets don't run as written against the current release. Checked on v0.14.3 (aw-server-rust 0.14.3 and the bundled Python aw-server) by POSTing each javascript block on the page to /api/0/query/.

Before

  • "Query Language Basics" and "Complete Example" use // comments. Both servers reject them with a 400: aw-server-rust gives ParsingError(... Slash ...) and Python gives QueryParseException: Syntax error: // ....
    The Python server accepts no comments at all (# fails too), and aw-server-rust accepts only #. So this PR drops the comments and moves their intent into the prose.
  • __CATEGORIES__ is listed as something "the web UI provides", next to find_bucket. Through /api/0/query/ (the endpoint aw-client.query calls) it is undefined on both servers (VariableNotDefined("__CATEGORIES__")), because only the web UI Query page substitutes it. find_bucket is a server-side function and works through the API.
  • The "Query examples" link points to queries.test.node.js.snap, which returns 404. The file is now queriesSnapshot.test.node.ts.snap.

After, with each block run against both servers (seeded window/afk buckets):

block aw-server-rust Python aw-server
Basics 200, events grouped 200, events grouped
Magic-variable example 400 via API, as the text now says (web UI only) same
Minimal / hierarchy 200 200
Complete example 400 via API, as the text now says (web UI only) same

Found during a docs-vs-reality pass over install, API, query and sync pages.

- drop // comments: both servers reject them with a 400 parse error
  (Python accepts no comments, aw-server-rust only #)
- __CATEGORIES__ is substituted only by the web UI Query page; via
  /api/0/query/ it is an undefined variable. find_bucket is a server
  function, not a web UI magic variable
- fix the dead query-snapshot link (renamed to
  queriesSnapshot.test.node.ts.snap)

Git-Session-Id: bed1476c-0b54-4dde-9c03-8080d9dde1e7
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Review guide (auto-posted)

Structured warm-up for reviewers — what changed, what to run, where to look.

Key files

  • src/examples/working-with-data.rst (+16/-24, Δ40)

Suggested verification

  • Run the repo's usual CI-equivalent checks locally

Known risks / watch points

  • No automatic high-risk tags; use file list + diff for judgment.

Suggested review focus

  • Confirm behavior matches the PR description acceptance criteria.
  • Skim the largest diffs first (listed above).
  • If CI is green, spot-check the highest-risk paths called out here.

Generated by scripts/github/pr-warmup-review-guide.py for #225.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The changes affect only how readers use the query documentation.

Safe to merge, with a small documentation fix recommended for the Basics example.

Findings

  1. P2 Example uses sample bucket IDs ▶

Summary

This PR removes unsupported comments from the query examples, explains where __CATEGORIES__ works, and updates the query snapshot link.

  • The query examples explain their steps without comments the servers reject.
  • Category examples show which query route supplies __CATEGORIES__.
  • The query examples link points to the current snapshot file.

Reviews (1) · Last reviewed commit: "docs(query): make the query snippets run..." · Reviewed by Greptile

Comment thread src/examples/working-with-data.rst Resolved
Git-Session-Id: bed1476c-0b54-4dde-9c03-8080d9dde1e7
@ErikBjare

Copy link
Copy Markdown
Member

@TimeToBuildBob review

@TimeToBuildBob

TimeToBuildBob commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

This PR edits src/examples/working-with-data.rst: removes // comments from the Basics and Complete Example query blocks, adds a note about comment restrictions (Python rejects all comments, Rust accepts #), clarifies that CATEGORIES is only substituted by the web UI's Query page, and updates the query-snapshot link to queriesSnapshot.test.node.ts.snap.

Safe to merge — no P0/P1 findings

Confidence 5/5

✅ No findings. The diff looks correct to me on this pass.

Files changed (1) — the diff as I read it
  • src/examples/working-with-data.rst — Removes // comments from query snippets, adds a note on comment parsing and CATEGORIES substitution, and updates the snapshot file link.

Reviewed 81fde232e385 · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 63s · about this reviewer

Maintainer commands

@TimeToBuildBob review (own line) — fresh review · @TimeToBuildBob fix — a worker acts on the findings. Once per comment; 👀 = received.

@ErikBjare
ErikBjare merged commit 5eb9f4d into ActivityWatch:master Nov 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants