Skip to content

[self-care:calesi-design-principles] Reject mismatched SQLite keyset continuation keys - #20320

Merged
mnkiefer merged 1 commit into
mainfrom
self-care/calesi-sqlite-keyset-keys-5271c1b0275db2be
Nov 7, 2026
Merged

mnkiefer merged 1 commit into
mainfrom
self-care/calesi-sqlite-keyset-keys-5271c1b0275db2be

Conversation

@mnkiefer

@mnkiefer mnkiefer commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

SQLite's local reader accepted keyset continuation pages whose key names differ from the resolved page plan. PostgreSQL rejects them as stale. This patch makes SQLite reject them too, and adds a shared conformance case that covers both backends.

Action: Dashboard server maintainer should review the change and accept it if TestReadContract passes for both PostgreSQL and SQLite. The fix is proposed only; it is not deployed or accepted.

Finding

  • Principle: interchangeable implementations (Calesi check 4).
  • Frozen SHA: 83f12ba71108396f1b752fe01e64a5e15c4b20fb.
  • Contract: server/internal/dashboardstore/store.go, KeysetPage and Reader.
  • Consumer: server/internal/server/server.go:1780-1805 builds the KeysetPage.
  • PostgreSQL adapter: server/internal/postgresx/sql_plan.go:58-79 checks the boundary, comparator, key count and each key name.
  • SQLite adapter: server/internal/sqlitex/query.go:50-60 checked only the boundary and comparator.
  • Impact: a continuation with swapped or wrong keys was accepted by SQLite but rejected by PostgreSQL.
  • Counter-evidence: server.go validates the cursor before calling the store. A direct Reader caller still saw the divergence.
  • Intentional limitations preserved: SQLite still rejects resource-limit overrides and repository scoping explicitly.
Validation
  • Before the fix, with the new conformance case: TestReadContract/sqlite/keyset-continuation-keys failed with "mismatched continuation keys were accepted".
  • After the fix, go test -race ./internal/dashboardstore ./internal/sqlitex passed against an isolated local PostgreSQL 18.
  • go vet ./..., gofmt, golangci-lint fmt --diff, golangci-lint run on the touched packages, and git diff --check were clean.
  • ./internal/server has failures that predate this change. TestWorkflowListContractUsesPostgres fails identically on the unchanged baseline with a missing runs partition. The role-privilege tests need a numeric-loopback admin, which my Unix-socket local database did not provide. I did not run the full ./... suite.
  • golangci-lint run ./... was run only on the two touched packages, not the whole module.

Control Plane

cao: githubnext/gh-cao, correlation: 42311677914-3489

gh-aw-workflow-id: self-care-calesi-design-principles

Generated by SelfCare / Calesi Principles · copilot · auto · ~66 AIC · ⌖ ~1 AIC · ⊞ 16.1K · ◷

  • expires on Nov 13, 2026, 11:49 PM UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mnkiefer
mnkiefer marked this pull request as ready for review November 6, 2026 23:52
@mnkiefer
mnkiefer requested a review from pelikhan as a code owner November 6, 2026 23:52
@mnkiefer
mnkiefer merged commit 73e9871 into main Nov 7, 2026
30 checks passed
@mnkiefer
mnkiefer deleted the self-care/calesi-sqlite-keyset-keys-5271c1b0275db2be branch November 7, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant