Skip to content

[Data Onboarding] Let a host lock the resolver step's Element Loading fields - #718

Draft
markus-moser wants to merge 4 commits into
feature/data-onboardingfrom
data-onboarding-resolverstep-lock-for-element-loading
Draft

markus-moser wants to merge 4 commits into
feature/data-onboardingfrom
data-onboarding-resolverstep-lock-for-element-loading

Conversation

@markus-moser

@markus-moser markus-moser commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

A host that reuses the resolver step and works out Element Loading from its own data (the loading strategy and its key column) needs to show those fields read-only. Today it can only refuse the change when the admin saves.

ResolverStep gets an optional isElementLoadingLocked prop. LoadingPanel passes it on to the loading-strategy select and, through DynamicTypeResolverRenderProps.disabled, to each strategy's settings (id, path, attribute). Without the prop nothing changes, so the importer's own editor works as before, read-only form included: the step passes true or nothing, never false, which would override the form's disabled.

Engine changes

  • Data Importer Studio frontend: the optional prop and its pass-through described above. This is needed because another bundle's format editor binds DataImporter/Components/ResolverStep and must not let admins edit fields it derives itself. Custom loading strategies from other bundles get disabled in their render props and can ignore it.

Tests

  • resolver-step.test.tsx: the fields are disabled with the prop and editable without it, for each strategy; the locked fields keep their stored values, and the class stays editable under the lock. Without the prop, a read-only form keeps the loading fields read-only.
  • The jest DOM environment gets a MessageChannel that runs on the environment's own timers. antd's Form notifies its watchers through one, and Node's own channel keeps Jest from exiting.

🤖 Generated with Claude Code

A bundle that hosts the resolver step and derives how elements are loaded
from its own data can now pass isElementLoadingLocked: the loading strategy
and every field of its settings are shown disabled, the rest of the step
stays editable. The importer's own editor does not set it.

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

Copy link
Copy Markdown
Contributor Author

Changed-line coverage at c05f22a (tree fb8df5b1), measured with npx jest ./js/src --coverage (lcov) in assets/studio and scripts/diff-coverage.mjs against origin/feature/data-onboarding:

  • loading-panel.tsx 1/1, resolver-step.tsx 1/1, id-loading-strategy-resolver-settings.tsx 1/1, path-loading-strategy-resolver-settings.tsx 1/1
  • Total: 4/4 = 100 %

Istanbul counts only lines that carry a statement, so the added disabled={ disabled } JSX attributes are not in the count; resolver-step.test.tsx checks each of them by asserting the rendered field is disabled with the lock and enabled without it (id, path, attribute). test/support/dom-environment.ts is the Jest environment and outside the coverage scope; the whole suite (9 suites, 41 tests) runs under it.

The diff changes no PHP file (git diff --stat --no-renames origin/feature/data-onboarding...HEAD -- '*.php' is empty), so the Data Importer Functional suite is unaffected.

markus-moser and others added 2 commits October 25, 2026 22:12
Passing an explicit false overrode the form's disabled state, so a user
without write permission could edit the loading fields.

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

Copy link
Copy Markdown
Contributor Author

Red run for the read-only form case: resolver-step.test.tsx "keeps the loading fields read-only in a read-only form without the lock" (id, path, attribute), run against the unfixed c05f22a8 with only the test added (npx jest js/src/modules/data-importer/components/tabs/steps/resolver-step):

    ✕ keeps the loading fields read-only in a read-only form without the lock (id)
    ✕ keeps the loading fields read-only in a read-only form without the lock (path)
    ✕ keeps the loading fields read-only in a read-only form without the lock (attribute)
Tests:       3 failed, 8 passed, 11 total

The fields got disabled={false}, which overrides antd's form-level disabled. Fixed in 156039c (the step passes true or nothing); with it, the full studio jest run is 44/44 green, and eslint and tsc are clean.

@sonarqubecloud

Copy link
Copy Markdown

@markus-moser

Copy link
Copy Markdown
Contributor Author

Coverage of the changed lines at f7541a80 (base origin/feature/data-onboarding), Studio jest suite with coverage (npx jest ./js/src --coverage --coverageReporters=lcov, 44 tests in 9 suites, all passing), measured with the docs repository's diff-coverage script:

 100 %  1/1  assets/studio/js/src/modules/data-importer/components/tabs/steps/resolver-step/loading-panel.tsx
 100 %  1/1  assets/studio/js/src/modules/data-importer/components/tabs/steps/resolver-step/resolver-step.tsx
 100 %  1/1  assets/studio/js/src/modules/data-importer/dynamic-types/resolver/loading-strategy/id/id-loading-strategy-resolver-settings.tsx
 100 %  1/1  assets/studio/js/src/modules/data-importer/dynamic-types/resolver/loading-strategy/path/path-loading-strategy-resolver-settings.tsx
Changed lines run by tests: 4/4 = 100 %

The changed lines in attribute-loading-strategy-resolver-settings.tsx and dynamic-type-resolver-abstract.ts carry no executable statement of their own (JSX props, an interface field). The attribute file has 17/17 lines run, and resolver-step.test.tsx checks that all five of its fields are disabled under the lock. No untested lines.

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