Repository navigation
Fixes #36189: Keep the Ontology Studio UI build inside the UI's src folder - #36642
Conversation
OntologyStudio.utils.ts imported sparqlQuerySettings.json from openmetadata-service by an 8-level relative path. Collate builds this UI from collate-ui/src/main/resources/ui/src/openmetadata-ui/, where that path resolves to nothing, so its release build failed. The UI now keeps its own copy of the three seed query templates in OntologyStudio.constants.ts. A Jest test pins the copy to the server file, and a second test fails when any production UI file imports a relative path that leaves openmetadata-ui/src/main/resources/ui/. The decision record gains a v2 amendment.
Collate's copy-om-to-collate step copies only src/** and playwright/** from the UI folder, so a production import of package.json, public/ or vite/ breaks Collate's build the same way the server import did. The guard now compares each relative specifier against src/, and it also reads .less and .css files for @import, @import (reference) and url(). Add ADR:2026-10-30-production-ui-code-imports-only-from-the-ui-src-folder for the rule, its test-file exception, its cost and the forms the guard does not read. The query-console record cites it, notes that a server-only seed edit is caught by the nightly Jest run, and uses the README's revision separator. The pin test uses toStrictEqual, matching the console's lodash isEqual.
Code Review ✅ Approved🟡 Medium risk · Replacing the server seed import with a UI copy could leave the console hiding stale templates if the copy drifts, despite its pin test. Moves the Ontology Studio seed templates into the UI's own VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
…older (#36642) * Fixes #36189: Keep the Ontology Studio UI build inside the UI folder OntologyStudio.utils.ts imported sparqlQuerySettings.json from openmetadata-service by an 8-level relative path. Collate builds this UI from collate-ui/src/main/resources/ui/src/openmetadata-ui/, where that path resolves to nothing, so its release build failed. The UI now keeps its own copy of the three seed query templates in OntologyStudio.constants.ts. A Jest test pins the copy to the server file, and a second test fails when any production UI file imports a relative path that leaves openmetadata-ui/src/main/resources/ui/. The decision record gains a v2 amendment. * Keep production UI imports inside the UI's src folder Collate's copy-om-to-collate step copies only src/** and playwright/** from the UI folder, so a production import of package.json, public/ or vite/ breaks Collate's build the same way the server import did. The guard now compares each relative specifier against src/, and it also reads .less and .css files for @import, @import (reference) and url(). Add ADR:2026-10-30-production-ui-code-imports-only-from-the-ui-src-folder for the rule, its test-file exception, its cost and the forms the guard does not read. The query-console record cites it, notes that a server-only seed edit is caught by the nightly Jest run, and uses the README's revision separator. The pin test uses toStrictEqual, matching the console's lodash isEqual.



Describe your changes:
Fixes #36189
What broke. After #36190 landed, Collate's UI release build failed with one error (Collate run):
Why it broke.
OntologyStudio.utils.tsimported the server'ssparqlQuerySettings.jsonby a relative path that climbs out of the UI'ssrc/folder. Collate'scopy-om-to-collatestep copies onlysrc/**fromopenmetadata-ui/src/main/resources/ui/intocollate-ui/src/main/resources/ui/src/openmetadata-ui/, and a separate step copiesplaywright/**. From there the same path names a file that does not exist. The same is true of any production import that leavessrc/, including the UI folder's ownpackage.json,public/andvite/.What changed.
OntologyStudio.constants.tsholds the UI's own copy of the three seed templates, typed asSavedSparqlQuery[].isCanonicalGlossaryQueryTemplatecompares against that copy with the sameisEqualcheck, so the console hides exactly the templates it hid before.OntologyStudio.constants.test.tsimports the server file and asserts withtoStrictEqualthat the copy equals itsqueryTemplates.toStrictEqualrejects an extraundefined-valued key, as lodashisEqualdoes. If someone edits a server seed and skips the UI copy, Jest fails.uiImportBoundary.test.tsfails, naming the file and the specifier, when a production file undersrc/has a relative specifier that resolves outsidesrc/. It reads these forms:.ts,.tsx,.jsand.jsxfiles,import ... from, side-effectimport,export ... from,import('...')andrequire('...');.lessand.cssfiles,@import,@import (reference)andurl(...).src/openmetadata-ui/*and its build never reaches a test. The exempt paths are*.test.*,*.spec.*,__mocks__/,__tests__/,src/test/andsrc/setupTests.js.ADR:2026-10-30-production-ui-code-imports-only-from-the-ui-src-folderstates the rule, the test-file exception and its cost. That cost is that shared data is copied intosrc/and pinned by a test. The record also lists the forms the guard does not read:import.meta.glob,new URL(..., import.meta.url), a template-literalimport()andrequire.resolve. The guard also matches inside comments and strings. No production file uses those forms to leavesrc/today.ADR:2026-10-26-native-query-console-hides-only-unchanged-bundled-templatesgains a v2 amendment that cites the new record and names the pin test as a guard. Its Consequences note that a PR changing onlysparqlQuerySettings.jsondoes not trigger the UI Jest job, so the nightly run catches drift after merge.Review. An independent review of
6eaa7a58225returned FIX with two majors, and this head resolves both. The guard's boundary moved from the UI folder tosrc/, and the import rule got its own decision record. A second independent review passed5598cd5fc5cwith three minors. The PR title now names thesrc/folder, which fixes the first. A follow-up PR fixes the other two after this one lands.@source,@reference,@pluginand@config, and Lessdata-uri(). None of them leavessrc/today.playwright/**to thecopy-om-to-collatestep, but a separate Collate step copies it. The rule itself is unchanged.Type of change:
High-level design:
N/A, small change.
Tests:
Use cases covered
maven-collate-cibuilds Collate's UI from this head.Unit tests
uiImportBoundary.test.tsfails and namessrc/components/OntologyExplorer/OntologyStudio.utils.ts. At this head it passes, reading 299 style files with 232 relative style specifiers, all insidesrc/.../../../package.json, an import frompublic/, a Less@importand@import (reference)that leavesrc/, a Lessurl('...')and a CSS unquotedurl(...)that leavesrc/.OntologyStudio.constants.test.tsfails when a copy entry gainsdescription: undefined, and when the copy'ssavedAtchanges.OntologyStudio.utils.test.ts,OntologyStudioQueryConsole.test.tsxandOntologyExplorerPage.test.tsx: 5 suites, 106 of 106 tests pass.Backend integration tests
Playwright (UI) tests
UI screen recording:
Not applicable. This is a build fix with no visible change.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code