Repository navigation
fix(fqn): support double-quotes in fully qualified names + guard/repair corrupt FQNs - #28697
Conversation
…ir corrupt FQNs
Names containing a double-quote could not be represented in an FQN: the Fqn
grammar had no escape mechanism, yet quoteName() backslash-escaped the quote and
stored an unparseable segment. Building the FQN is a pure string op, so such
values were written successfully (insert hashes only the entity's own FQN); they
then detonated later with a 500 (ParseCancellationException) the first time a
nested FQN was hashed (e.g. a tags read), and were painful to migrate.
Three layered fixes:
- Grammar + quoteName: NAME_WITH_RESERVED now allows any character with '"'
escaped by doubling it (""). quoteName/unquoteName encode/decode accordingly
and are idempotent. Names without a quote encode identically to before, so
existing FQNs and their hashes are unchanged (no reindex/migration needed).
- Ingest guard: FullyQualifiedName.validateFqnName() asserts a name round-trips
through encode->parse->decode, wired into every nested-FQN setter (columns,
pipeline tasks, topic/searchIndex/apiEndpoint fields, mlFeatures). A name that
cannot be hashed is now rejected at ingest with a clear 400 instead of being
stored to fail later.
- Heal-on-read: FullyQualifiedName.isValid() detects legacy-corrupt FQNs;
PipelineRepository repairs unparseable task FQNs on the fly by re-deriving them
from the task name, so existing poisoned data reads cleanly (200) without a
migration. The repair is in-memory and persists on the next update.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a long-standing FQN corruption path by making " representable inside a quoted FQN segment (via "" escaping), adding server-side validation to reject unhashable nested names at write time, and introducing a heal-on-read repair for legacy-corrupt pipeline task FQNs so reads no longer 500.
Changes:
- Update the ANTLR FQN grammar to support embedded
"in quoted segments using""escaping. - Rework
FullyQualifiedName.quoteName/unquoteName, addvalidateFqnName()andisValid(), and expand unit tests for quote round-trips. - Wire
validateFqnName()into nested-FQN setters across repositories, and add a pipeline task FQN repair step during reads.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| openmetadata-spec/src/main/antlr4/org/openmetadata/schema/Fqn.g4 | Extends quoted-segment grammar to allow escaped quotes via "". |
| openmetadata-service/src/test/java/org/openmetadata/service/util/FullyQualifiedNameTest.java | Adds tests for quote escaping/idempotency, round-trip hashing, and new validation. |
| openmetadata-service/src/main/java/org/openmetadata/service/util/FullyQualifiedName.java | Implements new quote escaping semantics plus validation and parseability checks. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java | Validates nested field names before deriving/setting field FQNs. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SearchIndexRepository.java | Validates nested field names before deriving/setting field FQNs. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java | Validates task names on write and repairs legacy-corrupt task FQNs on read. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/MlModelRepository.java | Validates ML feature/source names before deriving/setting their FQNs. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ContainerRepository.java | Validates container column names before deriving/setting column FQNs. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnUtil.java | Validates column names before deriving/setting column FQNs (used in multiple read/write paths). |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnRepository.java | Validates data-model column names before deriving/setting column FQNs. |
| openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/APIEndpointRepository.java | Validates API endpoint field names before deriving/setting field FQNs. |
🟡 Playwright Results — all passed (10 flaky)✅ 4274 passed · ❌ 0 failed · 🟡 10 flaky · ⏭️ 88 skipped
🟡 10 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…n-read
Heal-on-read (PipelineRepository.repairTaskFqns) ran a full ANTLR parse for
every task on every pipeline read to subsidize a finite set of already-corrupt
rows, was incomplete (the bulk/LIST/search path still 500'd), and could NPE on
a null task FQN. Replace it with a one-time migration so the corruption leaves
the stored data and reads pay no per-request cost.
- Remove repairTaskFqns and its setFields() call; keep the validateFqnName
write-path guard that rejects un-representable names at ingest (400).
- Add migration v11211 (mysql + postgres): re-derive task FQNs where !isValid,
persist only when changed.
- Harden FullyQualifiedName.isValid to treat null/empty as invalid (no NPE).
- Require >=1 char inside a quoted FQN segment (grammar + not *), rejecting
empty quoted segments ("").
FullyQualifiedNameTest: 17/17.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
validateFqnName returned early when quoteName(name) was unchanged, letting
empty names through (quoteName("") == ""). An empty pipeline task name (the
schema sets no minLength on task.name) then produced an unhashable empty FQN
segment ("parent.") that 500'd on the next FQN hash -- the same failure class
as unrepresentable names. Treat null/empty as invalid so every nested-FQN
setter (columns, tasks, fields, mlFeatures) rejects them up front with a 400.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Addresses code review on the 1.13.1 pipeline task-FQN repair migration.
1. Failed-to-persist pipelines were double-counted in the summary log.
repairPipeline kept taskCount > 0 when pipelineDAO.update threw, so a row
that never persisted was reported as both "re-derived N task FQNs" and
"could not fix N pipeline(s)", overstating success. Reset taskCount to 0
on the persistence-failure path so only rows that actually persisted count
as repaired. repairPipelineTaskFqns now returns a RepairSummary so the
counts are asserted directly (doesNotCountFailedPersistAsRepaired fails
without the fix). The Migration handlers ignore the return value.
2. Revert bootstrap/sql/migrations/native/1.13.1/{mysql,postgres}/
schemaChanges.sql to match main exactly. The intake_form_entity DDL there
belongs to main (consumed by IntakeFormDAO) and arrived via the main
merge, not this PR; only a local comment was added on top. Dropping that
comment makes this PR's net change to those files zero and removes the
"data migration only" text that contradicted the DDL. The FQN repair runs
via the Java v1131 Migration handler and needs no SQL.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Gitar



Problem
A name containing a double-quote (
") could not be represented in a fully qualified name. TheFqngrammar had no escape mechanism for", yetquoteName()backslash-escaped it (\") and stored an unparseable FQN segment.Building an FQN is a pure string operation, so these corrupt values were written successfully —
insertonly hashes the entity's own FQN, not nested objects. They then detonated later with a 500 (ParseCancellationException) the first time a nested FQN was hashed (e.g. a tags-inclusive read, or the update path resolving the entity with tags). This was observed on real Mulesoft pipeline task names (e.g...._"agents"_...) and also on customer column names, and the corrupt rows could not even be deleted via the API.Fix (three layers)
1. Grammar +
quoteName— make"representableNAME_WITH_RESERVEDnow allows any character, with"escaped by doubling it (""):QUOTE ( ~["] | '""' )* QUOTE.quoteName/unquoteNameencode/decode with""-doubling and are idempotent."encode identically to before, so existing FQNs and their hashes are unchanged — no reindex/migration required for current data. Verified by the unchanged pre-existingFullyQualifiedNameTestcases.2. Ingest guard — catch the un-representable early
FullyQualifiedName.validateFqnName()asserts a name round-trips through encode→parse→decode, wired into every nested-FQN setter: columns (ColumnUtil,ColumnRepository,ContainerRepository), pipeline tasks, topic/searchIndex/apiEndpoint fields, mlFeatures.3. Heal-on-read — recover legacy poisoned data without a migration
FullyQualifiedName.isValid()detects legacy-corrupt FQNs (parse fails).PipelineRepository.repairTaskFqns()re-derives an unparseable task FQN from the tasknameon the fly, so existing poisoned rows read cleanly (200) again. The repair is in-memory (no write-amplification) and persists naturally on the next update.Validation
FullyQualifiedNameTest: 16/16 green (incl. quote round-trip +validateFqnName).400 Invalid name ..."agents"..., nothing persisted.200with the FQN repaired to the""-escaped form; stored blob untouched until next write.Notes
isValid+ re-derive pattern generalizes to columns/fields/features if we want it.Fqn.g4at build time, so they pick up the grammar change automatically.🤖 Generated with Claude Code