Skip to content

refactor(dloc): set a data location's root path fields in one place - #208

Draft
ehennestad wants to merge 1 commit into
devfrom
consolidate-data-location-root-path-fields
Draft

ehennestad wants to merge 1 commit into
devfrom
consolidate-data-location-root-path-fields

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Why

The fields that describe the root path of a session's data location (RootUid, RootPath, RootIdx, Diskname) are assigned field by field in six places: expandDataLocationInfo, validateDataLocationPaths, and refreshDataLocations, fixDataLocations, updateRootDirPath and updateRootDir in Session. A new field or a change in how one is derived has to be made in all of them.

What changes

A new static method, DataLocationModel.setRootPathFields, copies one root path of a model item to one element of a data location struct array. All six places call it.

The six are not merged into one method, because they differ in what happens when something is unknown:

Method Unknown data location Unknown root path
expandDataLocationInfo fields left empty fields left empty
validateDataLocationPaths RootIdx NaN, Diskname N/A RootIdx NaN, Diskname N/A
refreshDataLocations raises ItemNotFound existing fields kept
updateRootDirPath raises ItemNotFound raises InvalidRootPath

Each keeps its lookup and that handling. Only the assignment is shared.

One behaviour changes. updateRootDir stored a logical array in RootIdx, while every other method stores the number of the root path, and the tooltip of the DataLocation table variable prints that value as a number. It now stores the number.

SessionDataLocationFieldsTest covers the four Session methods, which had no tests.

🤖 Generated with Claude Code

The fields describing the root path of a session's data location were
assigned field by field in six places: expandDataLocationInfo,
validateDataLocationPaths, and four methods of Session. The new static
DataLocationModel.setRootPathFields does the assignment for all six.

The six callers differ in what they do when a root path or data
location is unknown, so each keeps its own lookup and its own handling
of that case. Only the assignment is shared.

Session.updateRootDir passed a logical array as the root index and
stored it in RootIdx, where every other method stores a number. It now
stores the number, since this is the line that changed.

Adds tests for the Session methods, which had none.

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

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

677 tests  +11   677 ✅ +11   1m 33s ⏱️ +32s
 54 suites + 1     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit bf9e3d4. ± Comparison against base commit c33735d.

@ehennestad
ehennestad marked this pull request as draft November 9, 2026 07:41
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