Skip to content

feat(spiraldb): sources that are given one connector use its client (ITL-1457) - #555

Closed
eywalker wants to merge 4 commits into
mainfrom
eywalker/itl-1457-spiraldb-sources-repeat-service-calls-x
Closed

eywalker wants to merge 4 commits into
mainfrom
eywalker/itl-1457-spiraldb-sources-repeat-service-calls-x

Conversation

@eywalker

@eywalker eywalker commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Decision to make (not yet approved by the developer): a new public argument. This PR adds SpiralDBTableSource(..., connector=<SpiralDBConnector>), keyword-only, and nothing else public. The name, and whether to have it at all, are open. Draft until then.

Part of ITL-1457. Independent of the drafts #553 and #554, and replaces what they tried.

What it does. Sources of one project and dataset that are given one connector use its SDK client: they sign in once. Only the client is shared: each source reads the dataset's schema table and makes every other call as a source that makes its own connector does. Without the argument nothing changes.

What it does not do. Nothing is global, guessed, kept or parallel. Every read and check makes main's calls in main's order in the calling thread: open by name, schema(), the schema table's current version, then the count and the scan, on a table opened for it. No identity, hash, config or stored path holds the connector; a saved source makes its own. Nothing about the sign-in is read.

Rules. The connector must be of the source's project, dataset and service address (ValueError), a SpiralDBConnector (TypeError), open and of this process (RuntimeError). The source holds its own reference: closing the connector, the source or another source affects no other, and the last one releases the client. What one source counted is not taken as counted by another.

What differs for a caller who passes one (stated in the docs, or tested as named):

  • The sources read as whoever the connector signed in as, also after the environment or saved login changed.
  • Second decision settled (coordinator, on the developer's behalf): reuse may save calls, never an access check. Since 43005fa a source given a connector has its own schema-table state, so a connector that already read a version skips no call and no refusal of it (test_a_warm_connector_skips_no_check_of_the_schema_table: a 403 or a 500 on the snapshot's schema() or scan is raised by a fresh source and by one on a warm connector, at construction, with the same text and notes).
  • The sources share one client, so a client that stays broken affects them all, as it does where() copies.

Tests (tests/test_core/sources/test_spiraldb_given_connector.py) compare a source given a connector that others use with one that makes its own: outcome, error text and notes, warnings and their lines, and the ordered SDK calls, over 12 changes between reads x 8 reads x plain/where/chained where x 2 arrangements; 5 sets of options; asof; and a failure at each of 6 calls, with and without a withdrawn schema table.

Review finding Test
#553-1 a read passes a refusal main sees test_a_schema_table_changed_during_the_call_before_it_is_refused_by_that_read, test_a_table_changed_between_reads
#553-2 a client of another account test_an_account_is_never_guessed
#553-3 a check pins an older version test_checks_look_at_one_source_after_another
#553-4 a ready error waits for another call test_a_failing_call (equal calls: none is made after the failing one)
#553-5 a subclass's lookup in a worker test_checks_look_at_one_source_after_another (thread-bound lookup)
#553 cold reads of the schema table duplicate unchanged from main: test_threads_that_meet_a_new_version_all_refuse_or_all_read (no promise of one read)
#553 partial thread start repeats checks no threads are started
#554-1 a warm read skips schema() test_a_failing_call[schema-...], test_each_read_looks_at_everything_again
#554-2 a racing check, two opens by id test_a_read_that_races_a_check_reads_its_own_version, test_an_older_version
#554-3 a scan through another client test_an_account_reads_nothing_through_another
#554-4 an old handle fails in mid-read test_rows_given_before_a_failing_batch_are_the_same, test_a_failing_call[later batch-...]
#554 a connector subclass's signature test_a_connector_subclass_keeps_its_own_methods
#554 a preview keeps a failed handle test_a_preview_whose_count_fails_leaves_nothing_behind
#555-1 one address read, another saved (fixed: the connector copies its overrides, and to_config() returns a copy) test_the_address_that_is_read_is_the_one_checked_and_saved
#555-2 a repeated schema-table failure is not seen fixed in 43005fa: test_a_warm_connector_skips_no_check_of_the_schema_table
555-r1 P2 the docs promised one schema-table read per version, but concurrent sources each read it wording narrowed in 43005fa (docstring, docs, changelog): only the client is shared

Also: closed (test_closing_one_...), forked with locks held, threads, asyncio and cancellation, expired sign-in (test_a_failing_call, with recovery), two accounts, saved configs, jobs sync and async. All on the fake; no real credential expiry is tested.

No golden value moves.

🤖 Generated with Claude Code

…ITL-1457)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/orcapod/core/sources/spiraldb_table_source.py 98.14% <100.00%> (+0.33%) ⬆️
src/orcapod/databases/spiraldb_connector.py 96.90% <100.00%> (+0.05%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

eywalker and others added 3 commits November 24, 2026 21:09
…L-1457)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lf (ITL-1457)

Only the SDK client is shared now. A source given a connector gets its own
schema-table state, so it makes every call and check a source that makes its
own connector makes: a connector that already read a version of the schema
table no longer skips that version's schema() and scan, and a refusal of
either (a 403 on the same snapshot) is raised at construction as without a
connector. The docs, the docstring and the changelog no longer promise one
read per version across sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eywalker

Copy link
Copy Markdown
Contributor Author

Closing: replaced by #682, which shares the SDK client without a new public argument. Every source of one address and sign-in in a process uses one client, so the connector= decision this PR raised is no longer needed. As decided here, reuse saves calls but never an access check: in #682 each lookup still opens the table and the schema table through the source's client. A damaged schema table is still refused on every build.

Posted by a Claude Code agent on behalf of @eywalker.

@eywalker eywalker closed this Nov 30, 2026
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