Skip to content

fix(lakebase): follow next_page_token when listing Postgres projects - #161

Closed
karen-amaya wants to merge 1 commit into
databrickslabs:masterfrom
karen-amaya:fix/lakebase-postgres-projects-pagination
Closed

fix(lakebase): follow next_page_token when listing Postgres projects#161
karen-amaya wants to merge 1 commit into
databrickslabs:masterfrom
karen-amaya:fix/lakebase-postgres-projects-pagination

Conversation

@karen-amaya

Copy link
Copy Markdown

Summary

_lookup_via_postgres_api calls GET /api/2.0/postgres/projects once without following next_page_token. That endpoint paginates at 10 projects/page, so in workspaces with more than 10 Postgres projects, an project past page 1 is invisible to this lookup — causing the misleading error "No Lakebase Autoscaling endpoint matched... legacy Provisioned instances are not supported", even with a valid, correctly-permissioned project.

Confirmed in production (2026-09-04): the project was on page 2 of 19. Fix: loop over next_page_token until exhausted.

Linked Issue / milestone

Closes #160

Plan

N/A — single-file fix, no formal plan doc for this one.

Type of change

  • feat — new feature
  • fix — bug fix
  • docs — documentation only
  • refactor — no behaviour change
  • test — tests only
  • perf — perf improvement
  • ci / build / chore — tooling

Author checklist

  • Conventional Commit PR title (<type>(<scope>): <subject>).
  • changelogs/<today>.log updated with title + context + numbered changes + files + test result.
  • Tests added or modified for every behaviour change.
  • uv run pytest tests/<scope>/ green locally.
  • pre-commit run --all-files clean (or skipped hooks documented).
  • If src/agents/** or any MLflow-traced LLM path changed:
    • SPEC.md present in .planning/<slug>/.
    • tests/eval/datasets/<agent>/dataset.jsonl has ≥20 examples (new) or ≥10 (change).
    • MLflow eval run URI in PR body below.
    • Judge score ≥ baseline + delta, or explicit waiver here.
  • If src/mcp-server/** changed: uv run pytest tests/mcp/ -m mcp green.
  • No gsd-* references re-introduced.

MLflow eval run

Test plan

  • uv run pytest tests/ -m "not e2e and not property and not eval" --cov-fail-under=90
  • Per-package coverage thresholds (scripts/check_coverage.py) green for touched packages.
  • If new MCP tool: uv run pytest tests/mcp/integration/test_tool_schemas.py includes it.

Reviewer hint

See docs/PR_REVIEW_CHECKLIST.md. Numbered items map 1:1 to comments — #3: missing OntoBricksError subclass for new condition is more useful than "fix error handling".

@karen-amaya
karen-amaya requested a review from a team as a code owner September 4, 2026 18:56
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@benoitcayladbx

Copy link
Copy Markdown
Collaborator

Thanks for the diagnosis and the patch — the next_page_token loop in _lookup_via_postgres_api is the right idea, and the production note (project on page 2 of 19) is exactly the failure mode.

This PR is superseded. The same bug is already fixed on the maintained branches (not on master, which is why GitHub still shows #160 open):

Please close this PR rather than merging it onto master. The landed fix is a bit broader than this diff:

  1. Shared helperLakebaseProjectService.list_projects follows every next_page_token and sets page_size=100 (API max). This PR keeps the default ~10/page, so a 19-project workspace still needs two round-trips; fine, but we wanted one shared loop.
  2. Same one-shot GET in two other callers — Settings (graph_engine_lakebase_projects_result) and provisioning (LakebaseProvisioner._resolve_project_path) had the identical truncation. Auth-only pagination would still leave the dropdown and provisioner broken in large workspaces.
  3. Misleading error — the “legacy Provisioned instances are not supported” copy is unchanged here. After a full walk with no host match, the landed code reports that no listed Autoscaling endpoint matched PGHOST.
  4. Tests / changelog — no regression for a page-2 host, and the author checklist changelog/tests boxes are still unchecked.

Happy to take a follow-up if anything in the landed helper doesn’t cover your workspace. Closing #160 against the develop / 0.9.0 commits.

@benoitcayladbx benoitcayladbx self-assigned this Sep 10, 2026
@benoitcayladbx benoitcayladbx added bug Something isn't working status: Solved Great news the issue is now solved or implemented ! labels Sep 10, 2026
@benoitcayladbx benoitcayladbx added this to the v0.8.0 milestone Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working status: Solved Great news the issue is now solved or implemented !

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Lakebase auth: Postgres project lookup misses projects beyond page 1 (unfollowed pagination)

3 participants