Repository navigation
fix: build every schema right after login, so none needs dj.conn later - #59
Merged
Merged
Conversation
vrrigs
force-pushed
the
t3/load-schemas-after-login
branch
from
December 1, 2026 20:53
0cac3d4 to
e38c9a1
Compare
tabedzki
changed the base branch from
main
to
t3/confirm-surgery-registration
December 1, 2026 20:53
This was referenced Dec 1, 2026
tableConn takes the connection from table.schema, but the first use of a schema package still goes through dj.conn: U19 getSchema builds dj.Schema(dj.conn, ...). Once dj.conn has lost the connect_tech login (#50), a schema first used after that (action at the surgery dialog, the paramset steps tables in RegisterPreParamList) failed with 'Output argument "connObj" ... not assigned'. configParams now calls the new loadSchemas right after connect_tech, for all eight schema packages the GUI uses. Each getSchema keeps its schema, and so the login's connection, in its persistent. TestLoadSchemas reproduces the failure with an offline fixture package, checks that a loaded schema keeps the login, and checks that configParams calls loadSchemas right after connect_tech with every package the GUI code uses. Fixes #54 Assisted-by: ClaudeCode:claude-opus-5-5
They regex-searched configParams and the GUI code for the loadSchemas call and the schema names, so they broke on harmless rewording. The remaining tests cover loadSchemas itself. Assisted-by: ClaudeCode:claude-opus-5-5
…e login is lost loadSchemas ran every getSchema outside any try, in the constructor, so one schema that failed (say pipeline_imaging_element on an ephys rig) stopped the GUI from opening. Each package now gets a warning naming it, and the rest still load. 'clear functions' or 'clear all' wipes the getSchema persistents along with dj.conn's login, so loading the schemas at startup does not help then. tableConn now logs in again once with connect_tech when the schema cannot be built because dj.conn has no login, and retries. The README no longer says a test checks the loadSchemas list. Assisted-by: ClaudeCode:claude-opus-5-5
vrrigs
force-pushed
the
t3/load-schemas-after-login
branch
from
December 1, 2026 21:16
e38c9a1 to
1c38c1a
Compare
tabedzki
marked this pull request as ready for review
December 1, 2026 21:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Fixes #54
Follows #51 (merged). Stacked on #58 (on #57) because all three add to the same test lists; merge those first.
Problem
#51 gets transaction connections from the table with
tableConn(<table>)(table.schema.conn). But the first time a schema package is used, its U19-pipeline-matlabgetSchemarunsdj.Schema(dj.conn, ...). Ifdj.connhas lost theconnect_techlogin by then (#50), that first use fails with the same error:recordingandrecording_processload at startup.actionfirst loads increateRecording, just before the surgery dialog. The paramset steps tables can first load inRegisterPreParamListwhen the params came from Python.Fix
loadSchemas(packages)calls each<package>.getSchema. The schema, along with the login'sdj.Connection, then stays in that function's persistent.configParamscalls it right afterconnect_tech(), for every schema package the GUI uses:action,acquisition,lab,subject,recording,recording_process,pipeline_ephys_element,pipeline_imaging_element. No later table use, and notableConncall, goes back todj.conn.loadSchemascatches each package on its own and warns with its name, so one schema that fails (saypipeline_imaging_elementon an ephys rig) cannot stop the GUI from opening. That schema then loads on first use, as before.clear functionsorclear allwipes the saved schemas along withdj.conn's login.tableConnthen logs in again once withconnect_techand retries, so the write callbacks still get a connection. Checked against the DB: afterclear functions,dj.conn()gives the reported error, andtableConn(action.Surgery)logs in again and returns a connected session that a transaction opens and cancels on.loadSchemasis called directly fromconfigParams, so dependency analysis packages it. It findsgetSchemawithfeval, the same waydj.internal.Table/get.schemaalready does in the compiled build. That works because the.prjpackages the wholeU19-pipeline-matlabfolder as a resource.dj.Schemaloads its table list from the server, which moves from first use to startup.startupFcnalready loadedrecording,recording_process,subjectandlab(about 1.7 s). The four new ones add about 1.6 s, measured against the DB from this machine:action0.4 s,acquisition0.3 s,pipeline_ephys_element0.4 s,pipeline_imaging_element0.5 s.tableConn.mand the GUI README no longer describe this as a known limitation. The README says theloadSchemaslist inconfigParamsis kept complete by hand; no test checks it. The vendored toolboxes are untouched, and the write callbacks' catch blocks (A failing rollback skips the rest of the write callbacks' error handling #55, A failed or skipped surgery registration still moves and registers the recording #56) are not changed.Tests
tests/TestLoadSchemas.m, added to CI, README and AGENTS.md. It needs no DB: the fixture packagetests/fixtures/+djschemafixturehas a U19-stylegetSchema, aloginConnthat behaves like the vendoreddj.conn(no output once its connection is gone), and anOfflineSchemathat skips the table-list query.firstUseAfterTheLoginIsLostFailsreproduces tableConn still needs dj.conn the first time a schema is used #54:tableConnon a schema that has not been built yet throwsMATLAB:unassignedOutputs.loadedSchemaKeepsTheLoginandacceptsOnePackageName: afterloadSchemas,tableConnreturns the login's connection even after that login is gone.failingPackageOnlyWarns: a package that fails givesloadSchemas:NotLoadedand the packages after it still load.tableConnLogsInAgainOnce: with the login and the saved schema gone,tableConncalls its login function once and returns the new connection. Every test passes a stand-in forconnect_tech.test_jsonencodeprettypasses.uvx prek run --all-filespasses.modDataJointon the path:connect_tech,loadSchemaswith the eight packages, thenclear conn. After thatdj.conn()raises the reported error. A table from every package still counts its rows through the same connection, and a transaction opens and cancels on it.Not tested: the GUI itself, or the compiled build, on a rig.
Assisted-by: ClaudeCode:claude-opus-5-5