Skip to content

fix(Interfaces): refactor - #578

Merged
BenPinet merged 62 commits into
nextfrom
fix/interfaces
Nov 8, 2026
Merged

BenPinet merged 62 commits into
nextfrom
fix/interfaces

Conversation

@JulienChampagnol

Copy link
Copy Markdown
Member

No description provided.

JulienChampagnol and others added 29 commits November 6, 2026 18:55
geode_id was redeclared as an inline `string` in 10 interfaces. It is the id
OpenGeode gives to an object, so the same data loaded twice shares it. Define
the GeodeId alias and the GeodeIdentified mixin in app/types/identifiers.ts
and extend it instead (Readonly/Partial for the readonly and optional
variants).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A data loaded twice shares its geode_id, only the data id makes it unique, so
`id` was ambiguous next to `geode_id`. Define DataId and the DataIdentified
mixin in app/types/identifiers.ts and name `data_id` the data id of the rows
keyed by a data id: DataItem, NewDataItem, ModelComponentRecord,
ModelComponentRelationRecord, ObjectStyle, the metadata of the context menu and
the structural types that read them. The Dexie indexes of the data,
model_components, model_components_relation and data_style tables follow (the
database is deleted at every start, so it needs no migration).

The back-end, the viewer and the projects saved before this still name it `id`,
so temporary adapters accept both (app/utils/legacy_data_id.ts):
- importItem converts the items it gets from the back-end or a project
- the data and data_style stores convert legacy rows on importStores
Requests keep sending `id`. Remove the adapters once the python schemas use
data_id.

This also reads data_id where the code read the `id` of an untyped record: the
mesh style loop (which threw on the unknown key) and the info card of the
context menu, with a test for each.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eObjectTyped

geode_object_type was redeclared as an inline `string` in the data items, the
tree, the menu and the pickers. Define the GeodeObjectType alias and the
GeodeObjectTyped mixin in app/types/identifiers.ts and extend it (Partial for
the optional ones, the alias where the type is `string | undefined` or a
parameter).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
viewer_type was redeclared as an inline `string` in the data items, the tree and
the menus. Define the ViewerType alias and the ViewerTyped mixin in
app/types/identifiers.ts and extend it. ViewerType stays a string: besides mesh
and model it also names the entries of the menus (basemap, model_component,
model_component_type, scene).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AttributeStoredConfig was copied in 17 files of the mesh and model styles. Define
it once in internal/stores/data_style/attribute_types.ts, composed of the small
AttributeBounds and AttributeColorMapped interfaces (the not chosen yet form is
Undefinable of them), and import it. The files no longer re-export it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AttributeState was copied in 17 files of the mesh and model styles. Define it
once in internal/stores/data_style/attribute_types.ts, as the optional
AttributeSelection (name and item) with the stored configs, and import it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ValidAttributeInput was copied in 16 files of the mesh and model styles. Define
it once in internal/stores/data_style/attribute_types.ts, composed of
AttributeSelection, AttributeBounds and AttributeColorMapped, and import it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AttributeInput was copied in 16 files of the mesh and model styles. Define it
once in internal/stores/data_style/attribute_types.ts, as the Undefinable form
of AttributeSelection, AttributeBounds and AttributeColorMapped, and import it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The AttributeGroup of the corners, lines, surfaces and blocks coloring groups
each repeated the six fields of ValidAttributeInput before their own list of
component ids. Extend ValidAttributeInput instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Texture was declared with the same two fields in five components. Define it in
app/types/texture.ts as the texture the viewer takes
(MeshApplyTexturesParamsTexture), so it follows the schema, and import it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AttributeInfo was declared with the same fields in utils/threshold.ts and
composables/attribute_selector.ts, next to NamedAttribute in utils/attributes.ts
and an inline subset in attribute_coloring_style.ts. Define it once in
utils/attributes.ts as a NamedAttribute that may carry more fields, and use it
in the other places (attribute_selector.ts keeps exporting it for the attribute
selector).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ModelComponentRelationRecord was declared in data.ts, data_helpers/relations.ts
and data_helpers/collections.ts, the last two still with the `id` the data id of
the rows had before data_id. Define it once in data_helpers/relations.ts, which
owns the relation queries, and import it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…he selection

The model selection declared its own ModelComponentRecord, a subset with the data
id, the geode id and the type, although the table it reads holds the full rows.
Import the ModelComponentRecord of data_helpers/mesh.ts instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ScrollInfo was declared with the same three fields in tree_scroll.ts and
tree_keyboard_nav.ts. Define it once in tree_scroll.ts, which produces it, and
import it in tree_keyboard_nav.ts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FetchErrorLike was declared with the same three fields in api_fetch.ts and
upload_file.ts. Define it once in api_fetch.ts, which upload_file.ts already
imports from.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
IntermediateItem in OverlappingObjectsPicker.vue repeated the five fields of the
ProposedItem of use_overlapping_picker.ts it is built from. Export ProposedItem
and use it in the component.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FetchRawOptions and PerformFetchOptions repeated the route, method, params,
baseURL and max_retry of the request. Define them once as FetchRequest and
extend it (PerformFetchOptions also extends the request handlers and requires
the headers).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
EdgedCurveStyle repeated the visibility and the points of PointSetStyle before its edges. Extend PointSetStyle instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Grid2dStyle repeated the visibility, points and edges of EdgedCurveStyle before its cells. Extend EdgedCurveStyle instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Grid3dStyle repeated the four fields of Grid2dStyle before its polyhedra. Extend Grid2dStyle instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SurfaceStyle repeated the visibility, points and edges of EdgedCurveStyle before its polygons. Extend EdgedCurveStyle instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SolidStyle repeated the four fields of SurfaceStyle before its polyhedra. Extend SurfaceStyle instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ModelWithBlocksStyle repeated the seven fields of ModelWithoutBlocksStyle before its blocks. Extend ModelWithoutBlocksStyle instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
MeshComponentColoring and ModelComponentColoring were the same three fields, and the model style repeated two of them inline. Define ComponentColoring in default_styles/constants.ts, next to AttributeConfig and RGBAColor, and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TreeviewChild repeated the id and the title that identify and name a node of a tree. Define them once as TreeNode in app/types/tree.ts and extend it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TreeviewGroup repeated the id and the title of a TreeNode before its children. Define TreeGroup, a TreeNode that groups other nodes, in app/types/tree.ts and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FormattedComponentGroup repeated the id and the title of a TreeNode before its read-only children. Define ReadonlyTreeGroup in app/types/tree.ts and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CollectionComponentGroup repeated the id and the title of a TreeNode before its read-only children. Use ReadonlyTreeGroup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
BasemapTreeGroup repeated the id and the title of a TreeNode before its children, which are TreeNodes themselves. Use TreeGroup of TreeNode.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JulienChampagnol and others added 28 commits November 6, 2026 20:22
…nents dataId

The mesh coloring components, the coloring type selector, the attribute
selector and the textures selector and item took the data id as the `id` prop.
Rename it `dataId: DataId` and pass it as `data-id` where they are used. The
context menu keeps its `id`, which is also the id of a basemap.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…lters dataId

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ProposedItem, IntermediateItem and the time series Target copy the shape of a
DataItem (viewer_id, geode_object_type, ...): name their data id data_id like
DataItem does. PickedItem and ViewerIdResult mirror the response of the viewer
and keep id.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
getMenuItems took them as `objectType` and `geodeObject`, and addDataStyle as
`geode_object`. Name them viewerType: ViewerType and geodeObjectType:
GeodeObjectType, as everywhere else.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The check that an attribute coloring has all its fields was copied in 16 files
of the mesh and model styles, each under its own name
(isMeshEdgesVertexAttributeValid, isModelCornersVertexAttributeValid, ...). Define
isAttributeValid once in internal/stores/data_style/attribute_valid.ts and use it
everywhere, including the integration tests that imported the old ones.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…styles

The stored config of an attribute that has none yet (no range, no color map,
the default no data color) was written out in 18 files of the mesh and model
styles, two of them spreading a partial config over it. Define it once in
internal/stores/data_style/attribute_default.ts. It is a function so that each
caller gets its own object.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cornerId, lineId, surfaceId and blockId (and their plural arrays, the
snake_case forms and the *_ids fields of the coloring groups) are the id of a
component of a model, its geode_id. Define ModelComponentId in
app/types/identifiers.ts and use it instead of `string`. The viewer ids of the
blocks (block_ids: number[]) and componentId(s), which can also hold a type
such as "Corner", keep their types.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The menu metadata, the model component menu payload, the type selection context
and the hover data each declared `modelId: DataId`. Define the ModelIdentified
mixin in app/types/identifiers.ts and extend it (Partial and Readonly for the
optional and readonly ones). The Props of the components keep their own field:
the Vue compiler cannot resolve an extends through the @ogw_front alias without
typescript installed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
modelId was declared `modelId: DataId` in 570 places. Define ModelId = DataId in
app/types/identifiers.ts and declare `modelId: ModelId`, so that the fact that
the id of a model is the id of its data is written once. The ModelIdentified
mixin follows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
meshId was declared `meshId: DataId` in 591 places. Define MeshId = DataId in
app/types/identifiers.ts and declare `meshId: MeshId`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cornerId, cornerIds, corner_id and corners_ids were typed ModelComponentId or
ModelComponentId[]. Define CornerId = ModelComponentId in
app/types/identifiers.ts and use it, so a cornerIds is an array of CornerId.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
lineId, lineIds, line_id and lines_ids were typed ModelComponentId or
ModelComponentId[]. Define LineId = ModelComponentId in app/types/identifiers.ts
and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
surfaceId, surfaceIds, surface_id and surfaces_ids were typed ModelComponentId
or ModelComponentId[]. Define SurfaceId = ModelComponentId in
app/types/identifiers.ts and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
blockId, blockIds, block_id and blocks_ids were typed ModelComponentId or
ModelComponentId[]. Define BlockId = ModelComponentId in
app/types/identifiers.ts and use it. The viewer ids of the blocks
(block_ids: number[]) are not component ids and keep their type.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The mesh components applied a style to each data of a batch through callbacks
taking a `targetId`. It is the id of a mesh: name it `meshId: MeshId`. The
model cards and the shared batch helpers, which also serve models, keep
targetId.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ctType

The extension, CRS, object and missing files selectors declared their geode
object type (the geodeObjectType prop, the output_geode_object of the
extension, the filename to type maps) as `string`. Use GeodeObjectType.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
visibility was declared `boolean` in 125 places: the style interfaces, the
visibility getters and setters, and the computed visibilities of the
components. Define Visibility = boolean in app/types/style.ts and use it. The
Props, Emits and defineModel of the components keep boolean: without typescript
the Vue compiler would give a prop typed with an alias no runtime type, and
lose the boolean casting of `<Component visibility />`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The width of the edges of a data was declared `number` in the edges style, the
default styles and the model edges options. Define Width = number in
app/types/style.ts and use it. The widths of panels, menus and canvases are
other things and keep number.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The size of the points of a data was declared `number` in the points style,
the default styles and the model points options. Define Size = number in
app/types/style.ts and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The opacity of what is drawn in the viewer was declared `number` in the mesh
opacity styles, the coloring components, the basemap layers and the clipping
planes. Define Opacity = number in app/types/style.ts and use it. The adaptive
styles of the interface keep number.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The name of an attribute was declared `string` in the attribute styles of the
meshes and the models, in the attribute coloring types and in the components
and utils that read it. Define AttributeName = string in
app/types/attribute.ts and use it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The item of an attribute was declared `number` in the attribute styles of the
meshes and the models and in the components. In the mesh components the
computed attribute items were declared `string | undefined` although their
getters and setters work with the number of the store: use AttributeItem
(a number) there too, which also removes the type errors that mismatch hid.
Define AttributeItem = number in app/types/attribute.ts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ge name

AttributeRange named three different things: a [number, number] in
composables/batch_style.ts, a { min, max } in utils/attributes.ts and a
{ minimum, maximum } in the attribute types. Define the tuple with both bounds
set as ValidAttributeRange in app/types/attribute.ts (as the ValidAttributeInput
of the same bounds), and name the two objects after their fields:
AttributeMinMax and AttributeBounds. This frees AttributeRange for the stored
range of an attribute, whose bounds may not be set.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The range of an attribute coloring, [minimum, maximum] where a bound is
undefined until one is stored, was written [number | undefined, number |
undefined] in 45 places and, in the components, [number, number] | undefined
although the getters return the partial tuple and the setters destructure it
without a check. Define AttributeRange in app/types/attribute.ts and use it:
the computed ranges of the components are AttributeRange, which also removes
type errors that mismatch hid.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The name of the color map of an attribute coloring was declared `string` in the
attribute styles of the meshes and the models, their getters and setters and the
coloring style. In six mesh components its computed was declared
Map<string, RGBAColor> although the store returns the name of the color map:
declare it AttributeColorMap. Define AttributeColorMap = string in
app/types/attribute.ts, and rename the { colorMap } mixin of the attribute types
to AttributeColorMapped to free the name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The time step an attribute is read at was declared `number` in the attribute
styles of the meshes and the models, their getters and setters, the coloring
style and the components. Define AttributeTimeStep = number in
app/types/attribute.ts and use it. The lists of time steps keep number[].

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An attribute range is composed of a minimum and a maximum, declared `number` in
the attribute styles of the meshes and the models, the attribute types and the
batch style. Define AttributeRangeMinimum and AttributeRangeMaximum in
app/types/attribute.ts, build AttributeRange and ValidAttributeRange from them
and use them. The minimum and maximum of the threshold filter keep number.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@BenPinet
BenPinet merged commit 18255f6 into next Nov 8, 2026
27 checks passed
@BenPinet
BenPinet deleted the fix/interfaces branch November 8, 2026 12:02
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.

3 participants