Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a980bc5
chore(search): remove unused VectorSearchUtils
harshach Nov 21, 2026
5a57828
refactor(search): extract AbstractVectorIndexService from OpenSearchV…
harshach Nov 21, 2026
6ba6fe2
feat(search): run Elasticsearch semantic search on the shared vector …
harshach Nov 21, 2026
d492df1
refactor(search): reach the vector index service through the search r…
harshach Nov 21, 2026
ce9c23b
test(search): run the chunk index on real OpenSearch and Elasticsearch
harshach Nov 21, 2026
98f4250
docs(search): say why stored vectors are read by field name
harshach Nov 21, 2026
e23e41a
docs(decisions): record the shared vector index service
harshach Nov 21, 2026
a500448
docs(agents): a Java method returns once, at the end
harshach Nov 21, 2026
29b7789
refactor(search): give vector index methods a single return
harshach Nov 21, 2026
a29ffa7
docs(review): review the one-return rule instead of exempting it
harshach Nov 21, 2026
012c405
fix(search): keep entity embeddings when the chunk index cannot be wr…
harshach Nov 21, 2026
fdecc08
docs(decisions): record how vector chunk failures affect entity embed…
harshach Nov 21, 2026
056e837
refactor(search): return once from the staged recreate and reembed en…
harshach Nov 21, 2026
e9ce1d1
fix(search): never promote a staged chunk generation that missed a write
harshach Nov 21, 2026
e4a809c
fix(search): keep chunk failures from being lost or blocking entity u…
harshach Nov 21, 2026
40135df
fix(search): write the chunk header only after the rest of the set
harshach Nov 21, 2026
156561d
refactor(search): return once from the partition worker
harshach Nov 21, 2026
f24a28f
fix(search): load the LLM configuration in the ops CLI
harshach Nov 21, 2026
b10af77
Isolate bulk restore cleanup tests from the global repository registry
TeddyCr Nov 20, 2026
96e9726
Merge main into agent/can-you-check-if-we-are-addd
manerow Nov 23, 2026
e9bcc55
fix(search): promote the chunk generation with the entity indexes
manerow Nov 23, 2026
49e03c7
fix(search): count and retry chunk writes a reindex misses
manerow Nov 23, 2026
3384acf
docs(decisions): the chunk generation goes live with the entity indexes
manerow Nov 23, 2026
1243345
test(search): compare the failed-delete scenario with the live chunks…
manerow Nov 23, 2026
21245f6
fix(search): fail a partition that lost a staged chunk delete without…
manerow Nov 23, 2026
ee2e71d
fix(search): keep every stored chunk id within the header's count
manerow Nov 23, 2026
dd38d5a
docs(decisions): the chunk header's count bounds every stored chunk id
manerow Nov 23, 2026
ff67ebc
fix(search): retry an entity a reindex could not embed and count it once
manerow Nov 23, 2026
ea4571f
docs(decisions): retry a missed fresh embed, and keep the live chunks…
manerow Nov 23, 2026
568ca35
fix(search): retry only the misses of the partition that finished
manerow Nov 23, 2026
6932a12
docs(decisions): a miss is retried by the partition that missed it
manerow Nov 23, 2026
fa101bd
Merge main into agent/can-you-check-if-we-are-addd
manerow Nov 24, 2026
354be26
fix(search): skip the chunk delete when the chunk index does not exis…
manerow Nov 24, 2026
748fb90
Merge main into agent/can-you-check-if-we-are-addd
manerow Nov 25, 2026
86b7481
test(search): write the Elasticsearch ontology term embedding through…
manerow Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .claude/rules/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ repository) and `common/src/main/java/org/openmetadata/common/utils/CommonUtil.j

- **Methods ≤ ~15 lines** (excluding blanks/braces) and do **one nameable thing** — if you describe
it with "and"/"then", split it.
- **Prefer one successful return, placed at the end.** Do not scatter multiple success and fallback
returns through a long method. Extract validation and named helpers until the main flow reads
linearly. Throwing a specific validation exception at the boundary is preferable to manufacturing
an `error` result or deeply nesting the valid path. Do not introduce a mutable `result` variable
solely to satisfy a return-count rule when a direct expression is clearer. (Returns inside lambdas,
`switch` expressions, and anonymous classes don't count against the outer method.)
- **One return per method, at the end** (ADR:2026-11-20-a-method-returns-once). A method that
returns a value computes it through `if`/`else`, a ternary or a `switch` expression and returns it
once, as its last statement. A `void` method has no `return`: put the work inside the condition
that allows it. No guard-clause `return` and no early `return` from a loop. Throwing a specific
validation exception at the boundary is allowed and is preferable to manufacturing an `error`
result. When the conditions nest past three levels, extract a named helper instead of adding
returns. (Returns inside lambdas, `switch` expression arms and anonymous classes belong to those
bodies, not the outer method.)
```java
// BAD: mixed validation, fallback, and success returns
QueryResult execute(String query) {
Expand All @@ -44,6 +46,13 @@ repository) and `common/src/main/java/org/openmetadata/common/utils/CommonUtil.j
String validatedQuery = requireSupportedQuery(query);
return run(validatedQuery);
}

// BAD: void guard clauses // GOOD: the condition wraps the work
void refresh(Entity entity) { void refresh(Entity entity) {
if (!client.isAvailable()) return; if (client.isAvailable() && isStale(entity)) {
if (!isStale(entity)) return; write(entity);
write(entity); }
} }
```
- **Max 3 levels of nesting** — extract a named eligibility helper, don't sprinkle early returns.
- **Max cyclomatic complexity 10** — extract complex booleans into named methods.
Expand Down
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
```
`make install_test` bootstraps pinned uv and Nox; sessions in `ingestion/noxfile.py`
synchronize dependencies from the lock before execution. Style, generation and coverage
tools use separate `ingestion/.nox/` environments. `make install_dev_env` remains an alias

Check warning on line 35 in AGENTS.md

View workflow job for this annotation

GitHub Actions / harness-integrity

[dead-reference] path does not resolve: `ingestion/.nox/`
for `make install_test`; published extras remain available. Use
`make generate ARGS=--python-only` for Python-only generation and
`python3 scripts/check_generated_models.py --check` to validate freshness.
Expand Down Expand Up @@ -90,6 +90,8 @@
**Comments explain *why*, never restate code.** Do NOT add comments that describe what obvious code does (`// Create user` before `createUser()`). Only comment complex business
logic, non-obvious algorithms/workarounds, public-API JavaDoc, or `TODO/FIXME` with a ticket reference. If code needs a comment to be understood, refactor it to be clearer instead.

**One return per method, at the end (Java).** Compute the result through `if`/`else`, a ternary or a `switch` expression and return it once as the last statement; a `void` method has no `return` and puts its work inside the condition that allows it. No guard-clause or early returns; throwing a specific validation exception is allowed, and conditions nested past three levels move into a named helper. Details and examples in `.claude/rules/java.md`; rationale in ADR:2026-11-20-a-method-returns-once.

**Testing philosophy.** Test real behavior, not mock wiring — if a test mocks 3+ of your own classes to verify a method call, it tests the wrong thing. Prefer integration tests
over heavily-mocked unit tests (this project has real ITs: `OpenMetadataApplicationTest`, Docker, real OpenSearch). Mocks are for boundaries (HTTP clients, third-party APIs), not
internals. Ask "what breaks if this test passes but the code is wrong?" — if the answer is "nothing", rewrite it. Assert on observable outcomes (API responses, DB state), not
Expand All @@ -102,8 +104,7 @@
**Schema-first.** JSON Schemas in `openmetadata-spec/` are the single source of truth; all generated code (Java POJOs, Pydantic models, TS types) is derived. **Edit the schema,
then regenerate — never hand-edit generated output.** Details in `.claude/rules/schema-first.md`.

**Output style.** Clean code blocks, no unnecessary explanation; assume an experienced reader; focus on functionality over education. Do not add unnecessary blank lines between
prose and code blocks.
**Output style.** Clean code blocks, no unnecessary explanation; assume an experienced reader; focus on functionality over education. Do not add unnecessary blank lines between prose and code blocks.

**No wrappers around core-ui components.** If a wrapper component exists that wraps a core-ui component, skip it — use the `openmetadata-ui-core-components` component directly at the call site. Only create a wrapper if it adds genuine, non-trivial behaviour (custom hook logic, composed sub-components, domain-specific state). A wrapper that only passes props through is a maintenance liability: it hides which core component is in use and drifts from upstream updates.

Expand Down
5 changes: 3 additions & 2 deletions REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,9 @@ Anything below is enforced by CI, or authors rejected it repeatedly in this wind
- **Java micro-style quoted from [`java.md`](.claude/rules/java.md) without a defect**: fully qualified names, `final` on
locals, method or class length, utility classes not `final`, literals in test assertions. These
had zero acceptances across 18 bot threads. Authors still follow `java.md` while writing; a
reviewer does not post a finding for it. `java.md` says to *prefer* one successful return:
flat validation guards and throws are fine, so "use one trailing return" is not a finding. Size
reviewer does not post a finding for it. The one exception is the return rule
(ADR:2026-11-20-a-method-returns-once): a new or changed production method with more than one
`return`, or a `return` that is not its last statement, is a 🟡 finding. Throws are fine. Size
rules target production code, not tests or verbatim backports.
- **`@Isolated` or `@Execution(SAME_THREAD)`** on an IT that touches process-global state. That is a
supported group (74 IT files use it), not a breach of the concurrent-IT rule.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Status:** Accepted
- **Revisions:** v1 2026-11-11 (initial) · v2 2026-11-12 (Elasticsearch topics refresh on the
next reindex, not only when edited)
next reindex, not only when edited) · v3 2026-11-20 (Elasticsearch embeds every chunk)
- **Deciders:** Search and AI context maintainers
- **Guard:** `VectorDocBuilderTopicFieldsTest` (topic format, chunk boundary) and
`VectorDocBuilderTest` (`tableChunkText_isByteIdenticalToTheFormatBeforeTopicFields`,
Expand Down Expand Up @@ -64,3 +64,8 @@ v2 (2026-11-12): a reindex reuses a stored embedding only when its fingerprint m
`updatedAt` no longer decides (ADR:2026-11-11-reindex-reuses-an-embedding-only-when-its-fingerprint-matches).
On Elasticsearch, the next Search Indexing run for `topic` re-embeds every topic with schema
fields, one paid call each, without waiting for an edit. Elasticsearch still embeds chunk 0 only.
No longer true; see v3.

v3 (2026-11-20): Elasticsearch has the chunk index and embeds every chunk
(ADR:2026-11-20-elasticsearch-and-opensearch-share-one-vector-index-service). Upgrading is the
same on both engines. Run Search Indexing for `topic`.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# A reindex reuses a stored embedding only when its fingerprint matches

- **Status:** Accepted
- **Revisions:** v1 2026-11-11 (initial)
- **Revisions:** v1 2026-11-11 (initial) · v2 2026-11-20 (both engines share the reuse lookup;
Elasticsearch embeds every chunk)
- **Deciders:** Search and AI context maintainers
- **Guard:** `StoredEmbeddingReuseTest`, `reindexReusesOnlyStoredEmbeddingsWhoseFingerprintIsCurrent`
in `ElasticSearchVectorServiceTest` and `OpenSearchVectorServiceTest`, `StoredEmbeddingReuseIT`
(both engines); live/reindex parity: `VectorDocBuilderTest` (custom properties) and
in `OpenSearchVectorServiceTest`, `StoredEmbeddingReuseIT` (both engines); live/reindex parity:
`VectorDocBuilderTest` (custom properties) and
`MetricRepositoryTest.aReindexReadKeepsEveryInputOfTheMetricEmbeddingFingerprint`
- **Related:** open-metadata/OpenMetadata#37524, open-metadata/OpenMetadata#37522,
open-metadata/OpenMetadata#28313
Expand Down Expand Up @@ -54,9 +55,10 @@ old embedding forever:

- **Upgrade cost.** The first reindex after a release that changes the fingerprinted text
re-embeds exactly the entities whose text changed. Elasticsearch makes one paid call per entity
(chunk 0 only). OpenSearch makes none beyond what it already made, because the chunks were
re-embedded anyway and chunk 0 now also reaches the entity doc. Entities with unchanged text keep
their embedding. Upgrade notes for such a release must say which entity types will re-embed.
(chunk 0 only). No longer true; see the v2 amendment. OpenSearch makes none beyond what it
already made, because the chunks were re-embedded anyway and chunk 0 now also reaches the entity
doc. Entities with unchanged text keep their embedding. Upgrade notes for such a release must
say which entity types will re-embed.
#37522 is such a change: the first reindex that has both re-embeds every topic with schema
fields, on both engines, and no other entity type because of it.
- **The first reindex with this rule also refreshes embeddings left stale by earlier releases**:
Expand Down Expand Up @@ -86,3 +88,15 @@ old embedding forever:
fingerprint itself, to be picked up.
- **Revisit** if fingerprint computation shows up as a measurable share of reindex time. A cheaper
key must still change when the embedding text changes.

## Amendment

v2 (2026-11-20): both engines run one vector index service
(ADR:2026-11-20-elasticsearch-and-opensearch-share-one-vector-index-service).

- **One reuse lookup.** `getExistingEmbeddingsBatch` has a single implementation, so its unit
guard is the OpenSearch test alone. `StoredEmbeddingReuseIT` still runs it on both engines.
- **Elasticsearch embeds every chunk.** Where this record says Elasticsearch makes one call per
entity, or embeds chunk 0 only, it now makes one call per chunk, as OpenSearch does. The entity
doc takes chunk 0's embedding from that same call.
- **`reembed` runs on Elasticsearch.**
31 changes: 31 additions & 0 deletions docs/decisions/2026-11-20-a-method-returns-once.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# A Java method returns once, at the end

- **Status:** Accepted
- **Revisions:** v1 2026-11-20 (initial)
- **Deciders:** Sriharsha Chintalapani
- **Guard:** reviewer, per the `REVIEW.md` "Do not report" exception for the return rule
- **Related:** ADR:2026-11-20-elasticsearch-and-opensearch-share-one-vector-index-service

## Context
`.claude/rules/java.md` asked authors to *prefer* one successful return and explicitly allowed
direct early returns where a result variable felt heavier. In practice that wording let guard
clauses accumulate: the shared vector index service extracted for Elasticsearch parity carried
sixteen methods with two or three exits, `void` methods among them, and review stopped on
`updateEntityEmbedding`, which returned from two places before doing its work. A reader has to
trace every exit to know what a method does on each path, and a later edit placed after an early
return silently runs on only some of them.

## Decision
A Java method has at most one `return`, and it is the last statement. A value-returning method
computes its result through `if`/`else`, a ternary or a `switch` expression. A `void` method has no
`return`; its work sits inside the condition that allows it. Throwing a specific exception for
invalid input is allowed. When conditions nest past three levels, the condition or the branch
moves into a named helper rather than gaining an early exit. Returns inside lambdas, `switch`
expression arms and anonymous classes belong to those bodies.

## Consequences
Every method reads top to bottom with one exit, so code added before the `return` runs on every
path. Some methods gain a local result variable or one more `if` level; the nesting limit keeps
that bounded by pushing branches into named helpers. Existing code is not rewritten wholesale; a
change that touches a method brings it into line. Revisit if the nesting limit and this rule start
forcing helpers that exist only to satisfy each other.
Loading
Loading