Skip to content

test(connection): int-typed getter coherence for autocommit set via SetOptionInt - #8

Open
fornwall wants to merge 1 commit into
mainfrom
test/option-int-coherence
Open

test(connection): int-typed getter coherence for autocommit set via SetOptionInt#8
fornwall wants to merge 1 commit into
mainfrom
test/option-int-coherence

Conversation

@fornwall

Copy link
Copy Markdown
Owner

Split out of #4 (one PR per test). Adds one generic, driver-agnostic test for a gap found while reviewing an ADBC driver (the adbc-spanner Rust driver) against this suite; candidate for upstreaming to adbc-drivers/validation later.

TestConnection.test_option_autocommit_int_coherence (gated on connection_transactions)

Sets adbc.connection.autocommit through SetOptionInt (a plain Python int via set_options); if the driver accepts that set, requires GetOptionInt on the same key to succeed and agree, and the string getter to agree too. Drivers that reject the integer-typed set are skipped, not failed. Restores autocommit afterwards (same pattern as test_transaction_toggle, which covers the bool-as-string round-trip; this test is specifically the int-typed accessor coherence).

  • Origin finding: adbc-spanner REVIEW.md COR-4 (boolean options: set-as-int succeeds, get-as-int fails).
  • Spec reference: AdbcConnectionGetOptionInt doc comment in adbc.h: "For standard options, drivers must always support getting the option value (if they support getting option values at all) via the type specified in the option. (For example, an option set via SetOptionDouble must be retrievable via GetOptionDouble.)" The skip-on-rejected-set keeps the test within that text: it only asserts the getter once the driver has itself accepted the int-typed set.

Results on real drivers

  • adbc-spanner (current main): FAIL — verified by an actual emulator run via its foundry harness: the int-typed set is accepted, then get_option_int errors with INVALID_ARGUMENT: option adbc.connection.autocommit value "true" is not an integer.
  • adbc-driver-sqlite 1.11.0 (released PyPI wheel): SKIP — verified with a throwaway quirks harness: the driver rejects the integer-typed set, so the test skips as designed (driver does not accept an integer-typed autocommit).

Framework checks

uv run pytest tests/ (210 passed, 1 skipped), uv run ty check (clean), pre-commit run --all-files (all hooks pass) — all on this branch independently.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LGf8PVEe2tYkw8Q6Pd95tq

…etOptionInt

adbc.h (AdbcConnectionGetOptionInt): 'For standard options, drivers
must always support getting the option value (if they support getting
option values at all) via the type specified in the option. (For
example, an option set via SetOptionDouble must be retrievable via
GetOptionDouble.)'

test_option_autocommit_int_coherence sets adbc.connection.autocommit
through SetOptionInt (a plain Python int via set_options) and, when the
driver accepts that set, requires GetOptionInt to succeed and agree
(and the string getter to agree as well). Drivers that reject the
integer-typed set are skipped, not failed. Gated on
connection_transactions since the test toggles autocommit off; restores
autocommit afterwards like test_transaction_toggle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGf8PVEe2tYkw8Q6Pd95tq
Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
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.

1 participant