Skip to content

bim.store cost/structural refs return a raw rather than normalized modelId #5234

Description

@louistrue

Split out of review on #5231, where it was flagged but is pre-existing and affects the shipped cost path, so it did not belong in that PR.

createStoreAdapter's per-call resolution returns the caller's raw model id:

return { modelId: requested, store: dataStore, editor, mutationView, ownerHistoryId };

while addEntity and buildElement return normalizeMutationModelId(...)__legacy__ for a legacy public id. entityRefToString serializes modelId unchanged, so the same entity can receive different serialized keys depending on which store method created its ref.

This is verbatim from main before #5231 (git show <pre-5231>:apps/viewer/src/sdk/adapters/store-adapter.ts, the createCostStoreBackend closure); #5231 only extracted that closure so cost and structural share one resolver, which is what made the inconsistency visible.

Fixing it changes the ref identity bim.store.addCost* hands back today, so it wants its own change where it can be reviewed against the cost tests and any consumer that keys off EntityRef.modelId — not a drive-by in a structural PR.

Suggested fix: return normalized from the shared resolver, and check store-adapter-cost-undo.test.ts plus anything comparing entityRefToString output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestreadyMaintainer-approved: in scope, wanted now, scoped. A PR may close this.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions