Skip to content

notion: a search from 2025-09-03 on lists each database's data source, as real does - #788

Merged
nuriyoo merged 3 commits into
brekkylab:mainfrom
mangeshraut712:cursor/notion-search-data-source-f391
Oct 18, 2026
Merged

nuriyoo merged 3 commits into
brekkylab:mainfrom
mangeshraut712:cursor/notion-search-data-source-f391

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

What changed

An unfiltered POST /v1/search from Notion-Version 2025-09-03 on lists each database as its data source, the object GET /v1/data_sources/{id} already returns, and lists no database object. 2022-06-28 still lists databases. A database object filter is unchanged, because that filter under the newer versions is not in the measurement. Closes #722.

Why this is what the real API does

Measured against api.notion.com on 2026-10-14, recorded in #722: POST /v1/search with {} returns page and database under 2022-06-28, and page and data_source under 2025-09-03 and 2026-03-11. Each data source is that database's own, in the shape GET /v1/data_sources/{id} answers less its request_id. A {"filter":{"property":"object","value":"data_source"}} search already listed data sources; an unfiltered search on those versions now uses that same object.

Verification

  • Tests — uv sync --all-extras --locked, then uv pip install --no-deps "llama-index-readers-hubspot<0.6", then uv run --no-sync pytest -rs: 10326 passed, 1 skipped, 5 warnings in 113.88s. The skip is tests/test_mcp.py:154: Docker not available. test_notion_unfiltered_search_lists_a_database_in_the_versions_shape failed on 2025-09-03 and 2026-03-11 before this change and passes after it; 2022-06-28 passed before and after.

  • Optional surfaces that ran rather than skipped — official SDK, llama-index, MCP (except the Docker case), mirage, and fsspec extras are installed, and those tests ran.

  • Lint — ruff check . printed All checks passed!. ruff format --check . printed 159 files already formatted. ruff check --preview --select PLW1514 . printed All checks passed!. python scripts/prose_check.py upstream/main exited 0. backlot diff --source notion printed 56 divergence(s) · 56 acknowledged · 0 new, so the Notion baseline is unchanged.

  • A test fails without this change

  • A new endpoint serving corpus content is ACL-scoped, proved for both an admin and a scoped token — no new endpoint; search still returns only documents the caller can see

  • Comments state what was measured, not the history of the fix

Open in Web Open in Cursor 

Co-authored-by: Mangesh Raut <mangeshraut712@users.noreply.github.com>
@nuriyoo nuriyoo added the fidelity The vendor API defines the right answer; closing this needs a measurement against it label Oct 17, 2026

@nuriyoo nuriyoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this; the unfiltered search now lists each database's data source from 2025-09-03 on, and the data source it lists is the one GET /v1/data_sources/{id} answers. I measured the searches again on 2026-10-17 (api.notion.com, an integration's workspace of three databases and ten pages) and every search this branch changes lists the objects real lists. The suggestions are a comment that also records a query and the shape, and the new test as rows of the table above it.

Two neighbours the body can name rather than call unmeasured. Under 2025-09-03 and 2026-03-11 real refuses a database filter with a 400 validation_error (body.filter.value should be `"page"` or `"data_source"`, instead was `"database"`.), which is #375. And every search from 2025-09-03 on ends with "type":"page_or_data_source", which is #374.

On the suggestion tree the whole suite passes (10326, 2 skipped: Docker and the HubSpot reader), and 12 of the 15 mutations generated from the diff fail a test. The three left: swapping the two operands of render_data_source, which gives the same value; dropping want in (None, "data_source"), which only changes the database filter under 2025-09-03, a request real refuses; and query.strip(), on a line this PR does not touch.

Comment thread backlot/routers/notion.py Resolved
Comment thread tests/test_notion.py Resolved
…s own GET

The comment on `search` records that the `data_source` filter, an
unfiltered search and a `query` list each database as a database before
2025-09-03 and as its data source from it, in the shape the object's own
`GET` answers less `request_id`, with the 2026-10-17 measurement. The
new test's rows join the table above it, with a `query` row, and every
row's object is compared with its own `GET`; the four-row filter test
they replace goes.

@nuriyoo nuriyoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @mangeshraut712. The unfiltered search now lists each database's data source from 2025-09-03 on, and the object it lists is the one GET /v1/data_sources/{id} answers.

I finished it with a maintainer commit (b8a0a2f) from the review: the comment on search records the query case and the shape with the 2026-10-17 measurement, and the search rows are one table that checks every listed object against its own GET. The Notion tests pass on the branch updated with main, and CI is green.

@nuriyoo
nuriyoo merged commit b8a35b6 into brekkylab:main Oct 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fidelity The vendor API defines the right answer; closing this needs a measurement against it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

notion: a search from 2025-09-03 on lists a database as a database, where real lists its data source

2 participants