Skip to content

Fixes #28152: Add NATS JetStream Messaging Connector - #32122

Merged
harshach merged 4 commits into
mainfrom
harshach/fix-pr-28153-conflicts
Aug 27, 2026
Merged

harshach merged 4 commits into
mainfrom
harshach/fix-pr-28153-conflicts

Conversation

@harshach

@harshach harshach commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes

Fixes #28152.

Supersedes #28153. This replacement applies the completed NATS connector work cleanly on the current main branch without a merge commit. The connector commit retains the original author, Rafael Grecco ([email protected]).

This adds a schema-first NATS JetStream messaging connector with:

  • JetStream stream and subject discovery through paginated API requests
  • Basic, token, NKey, TLS, and anonymous connection modes
  • Schema extraction from JetStream metadata
  • Bounded message sampling with UTF-8 and base64 handling
  • Service registration, documentation, generated models, UI metadata, and integration coverage

Type of change

  • Bug fix
  • New feature
  • Improvement
  • Documentation

High-level design

  • Schema and registration: Adds NatsConnection as the schema source of truth and regenerates the Java, Python, and TypeScript models. Registers NATS in the ingestion registry, messaging service enum, UI service metadata, and beta-service list.
  • Connection boundary: Wraps the NATS client in BaseConnection, validates API responses, owns connection cleanup, removes temporary TLS files on partial failures, and reports contextual connection/API errors.
  • Discovery: Uses detailed paginated STREAM.LIST responses to avoid one STREAM.INFO request per stream. Subjects become topics under their JetStream stream container.
  • Sampling: Scans a bounded recent sequence window, returns at most ten samples and 1 MiB total, preserves valid UTF-8, base64-encodes binary data, and tolerates sequence gaps.
  • Compatibility: The change is additive. It does not alter existing connector schemas and requires no database migration.

Tests

Unit tests

  • Added/updated unit tests
  • ingestion/tests/unit/source/messaging/test_nats.py
  • 91 tests pass; connector coverage is 92% overall (connection.py 99%, metadata.py 85%, models/service 100%).
source env/bin/activate
pytest -c ingestion/pyproject.toml ingestion/tests/unit/source/messaging/test_nats.py \
  --cov=metadata.ingestion.source.messaging.nats --cov-report=term-missing -q

Backend integration tests

  • Added/updated backend integration tests
  • N/A: this connector adds no backend REST endpoint or repository behavior.

Ingestion integration tests

  • Added/updated ingestion integration tests
  • ingestion/tests/integration/nats/
  • The suite starts nats:2.10 with JetStream, creates representative streams/messages, creates the OpenMetadata service, runs ingestion, and validates the resulting topics and samples.
  • A local execution reached the OpenMetadata service-creation step after starting NATS and creating its streams. The already-running local OpenMetadata server was built from revision 8cb4..., which predates the new Nats enum, so it rejected the new service type with HTTP 400. Rebuilding the local server from this branch is required to complete that environment-level run.

Playwright tests

  • Added/updated Playwright tests
  • N/A: the UI uses the existing schema-driven messaging-service form; no new custom interaction or page behavior is introduced.

Other verification

make generate
make update_typescript_types
mvn -pl openmetadata-spec -DskipTests package
yarn parse-schema
yarn i18n
yarn generate:app-docs

The exact UI checkstyle sequence (organize imports, ESLint, Prettier, and license-header verification) passes for every changed UI file. basedpyright reports zero errors for the connector and its tests.

UI recording

  • TODO before marking ready for review: attach a short recording of the schema-driven NATS service form and connection test.

Connector quality review

The /connector-review procedure was run against the complete replacement diff.

Category Score
Schema and registration 9.6/10
Connection and authentication 9.7/10
Source, topology, and performance 9.5/10
Test quality 9.2/10
Code quality and style 9.5/10
Overall 9.5/10

Verdict: APPROVED from the connector-quality perspective. The final pass has 0 blockers, 0 warnings, and 0 remaining actionable suggestions. The PR remains a draft only because the UI recording above is outstanding.

The review identified and this replacement resolves issues involving authentication exclusivity, unsupported non-JetStream behavior, beta registration, swallowed API errors, connection ownership and cleanup, pagination validation, N+1 stream requests, sampling gaps and byte bounds, binary payload handling, optional schema-test behavior, and integration-test assertions/error handling.

The static connector analyzer's only remaining message is a false positive claiming no unit tests because it checks a legacy test path; the 91 unit tests are present under ingestion/tests/unit/source/messaging/.

Checklist

  • I have linked the issue addressed by this PR.
  • I have described the design and backward-compatibility impact.
  • I have added tests that prove the connector behavior.
  • I have run generation, focused tests, type checking, and formatting/checkstyle verification.
  • I have added comments only where they explain non-obvious behavior.
  • I have not modified CI workflows.
  • The commit preserves the original contributor as author.
  • I have attached the required UI recording.

Greptile Summary

The PR adds schema-first NATS JetStream support across ingestion, shared service contracts, generated UI models, service registration, documentation, and integration coverage.

  • Adds NATS authentication, TLS, stream discovery, schema extraction, and bounded message sampling.
  • Registers NATS across the server, ingestion framework, generated contracts, and schema-driven UI.
  • Adds focused unit and ingestion integration tests.

Confidence Score: 3/5

The PR is not yet safe to merge because the example workflow still publishes an administrative JWT that must be replaced with secret-backed configuration.

The NKey dependency issue is fixed by installing the nats-py NKey extra, but the complete administrative JWT remains committed in the NATS workflow example and continues to violate the repository’s credential-handling boundary.

Files Needing Attention: ingestion/src/metadata/examples/workflows/nats.yaml

Important Files Changed

Filename Overview
ingestion/setup.py Registers the NATS extra with nats-py NKey support, resolving the previously reported missing dependency.
ingestion/src/metadata/ingestion/source/messaging/nats/connection.py Implements NATS authentication, TLS setup, JetStream API validation, connection testing, and owned cleanup.
ingestion/src/metadata/ingestion/source/messaging/nats/metadata.py Implements paginated stream discovery, topic conversion, optional KV-backed schemas, and bounded sample collection.
openmetadata-spec/src/main/resources/json/schema/entity/services/connections/messaging/natsConnection.json Defines the schema-first NATS connection and authentication contract consumed by generated models.
ingestion/src/metadata/examples/workflows/nats.yaml Adds a runnable NATS workflow example but retains the previously reported hardcoded administrative JWT.
ingestion/tests/unit/source/messaging/test_nats.py Provides extensive coverage for NATS connection, discovery, schema, sampling, error, and cleanup behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  C[NATS connection configuration] --> J[JetStream connection]
  J --> D[Paginated stream discovery]
  D --> T[OpenMetadata topic requests]
  J --> K[Optional schema KV lookup]
  K --> T
  J --> S[Bounded sample retrieval]
  S --> P[Topic sample data]
  T --> O[OpenMetadata REST sink]
  P --> O
Loading

Reviews (4): Last reviewed commit: "fix(nats): include NKey authentication d..." | Re-trigger Greptile

Context used (4)

@harshach harshach left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NATS connector quality review

Verdict: APPROVED — 9.5/10

Category Score
Schema and registration 9.6/10
Connection and authentication 9.7/10
Source, topology, and performance 9.5/10
Test quality 9.2/10
Code quality and style 9.5/10

Final finding count: 0 blockers, 0 warnings, 0 actionable suggestions.

Findings identified and resolved

  1. Removed the misleading jetStreamEnabled=false mode, which could not discover core-NATS subjects and silently returned an empty catalog.
  2. Replaced the flat authentication fields with an exclusive schema union for basic, token, and NKey credentials; anonymous access remains available by omitting authentication.
  3. Registered NATS in BETA_SERVICES so the UI status matches the connector's release stage.
  4. Replaced swallowed/masked JetStream API failures with contextual errors and explicit pagination-response validation.
  5. Added BaseConnection ownership and deterministic drain/close behavior.
  6. Hardened TLS temporary-file cleanup, including failures during partial certificate/key materialization.
  7. Made the optional schema test step report real failures instead of becoming a silent no-op.
  8. Removed the N+1 STREAM.INFO pattern by consuming detailed, paginated STREAM.LIST responses.
  9. Made recent-message sampling tolerate stream sequence gaps while keeping the scan bounded.
  10. Added a 1 MiB aggregate sample-size cap in addition to the ten-message count limit.
  11. Preserved valid UTF-8 exactly and base64-encoded binary payloads instead of using lossy replacement decoding.
  12. Added contextual validation for non-object JSON returned by NATS API requests.
  13. Strengthened integration helpers and pagination tests by removing silent exception handling and asserting actual offsets.

Verification evidence

  • 91 focused unit tests pass with 92% connector coverage (connection.py 99%, metadata.py 85%, models/service 100%).
  • Schema/model generation, OpenMetadata spec compilation, TypeScript schema parsing, i18n generation, app-doc generation, connector type checking, Python formatting/linting, and changed-file UI checkstyle pass.
  • The integration suite successfully starts NATS JetStream and creates its fixture streams. Its local OpenMetadata step requires rebuilding the already-running server from this branch because that server revision predates the new Nats enum.
  • The static analyzer's "No unit tests found" message is a path-detector false positive; tests live at ingestion/tests/unit/source/messaging/test_nats.py.

The connector-quality review is complete. Separately, the pull request should remain a draft until the repository-required UI recording is attached.

Comment on lines +211 to +219
return {
"replication_factor": config.num_replicas,
"max_message_size": config.max_msg_size,
"retention_size": config.max_bytes,
"cleanup_policies": _NATS_RETENTION_TO_CLEANUP.get(config.retention, ["delete"])
if config.retention
else None,
"topic_config": topic_config,
}

@gitar-bot gitar-bot Bot Aug 26, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Edge Case: NATS unlimited (-1) limits stored as negative topic sizes

JetStream returns max_bytes and max_msg_size as -1 (and max_age as 0) when a stream has no limit configured — e.g. the integration test's users and events streams. _build_topic_config_params passes these straight through, so retentionSize and maximumMessageSize are written to OpenMetadata as -1 instead of unset, producing misleading negative sizes in the topic entity. Normalize non-positive sentinels to None so unlimited streams show no size rather than -1.

Treat NATS -1/0 unlimited sentinels as None so they are not stored as negative sizes.:

def _positive_or_none(value):
    return value if value and value > 0 else None
...
return {
    "replication_factor": config.num_replicas,
    "max_message_size": _positive_or_none(config.max_msg_size),
    "retention_size": _positive_or_none(config.max_bytes),
    "cleanup_policies": _NATS_RETENTION_TO_CLEANUP.get(config.retention, ["delete"])
    if config.retention
    else None,
    "topic_config": topic_config,
}

Was this helpful? React with 👍 / 👎

@harshach
harshach marked this pull request as ready for review August 26, 2026 15:44
Copilot AI lite review requested due to automatic review settings August 26, 2026 15:44
Comment thread ingestion/setup.py Resolved
Comment on lines +49 to +50
securityConfig:
jwtToken: "eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security JWT credential is committed

The example stores a complete JWT directly under securityConfig.jwtToken, exposing a reusable credential in repository history and propagating it into copied configurations instead of sourcing authentication from an environment variable or secrets manager.

How this was verified: The changed workflow contains the complete JWT literal in its authentication configuration.

Context Used: CLAUDE.md (source)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new schema-first NATS JetStream messaging connector to OpenMetadata’s ingestion framework, wiring it end-to-end through the spec → generated models/types → UI connection form + icons/docs, along with unit and integration coverage.

Changes:

  • Introduces NatsConnection schema + registers Nats as a MessagingServiceType (spec + UI wiring + generated types).
  • Implements the Python ingestion source for NATS JetStream (connection handling, stream discovery, optional KV-backed schema ingestion, bounded sampling).
  • Adds unit + integration tests and a workflow example for running NATS ingestion.

Reviewed changes

Copilot reviewed 20 out of 36 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
openmetadata-ui/src/main/resources/ui/src/utils/ServiceIconUtils.ts Registers the NATS service icon for UI rendering.
openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.ts Adds lazy-loader entry for the NATS connection schema in the service form.
openmetadata-ui/src/main/resources/ui/src/utils/EntityUtils.interface.ts Adds formatted display label for NATS in messaging service type formatting.
openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/messaging/natsConnection.json Adds UI-consumed JSON schema for NATS connection configuration.
openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts Regenerated types to include NATS connection fields in workflow config models.
openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/testSuitePipeline.ts Regenerated types to include NATS connection fields in test-suite pipeline models.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/messagingService.ts Regenerated messaging service entity types to include MessagingServiceType.Nats and NATS connection shape.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/serviceProgressEvent.ts Regenerated ingestion pipeline progress event types with NATS additions.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts Regenerated ingestion pipeline entity types with NATS additions.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/connections/serviceConnection.ts Regenerated service connection union types to include NATS connection config.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/connections/messaging/natsConnection.ts New generated TS interface/enums for NatsConnection.
openmetadata-ui/src/main/resources/ui/src/generated/entity/data/topic.ts Updates generated MessagingServiceType to include Nats for topic entities.
openmetadata-ui/src/main/resources/ui/src/generated/entity/automations/workflow.ts Regenerated automation workflow types to include NATS connection fields.
openmetadata-ui/src/main/resources/ui/src/generated/entity/automations/testServiceConnection.ts Regenerated automation test-connection types to include NATS connection fields.
openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts Regenerated API request typings to include NATS connection options.
openmetadata-ui/src/main/resources/ui/src/generated/api/services/createMessagingService.ts Regenerated API typings for creating messaging services with NATS connection config.
openmetadata-ui/src/main/resources/ui/src/generated/api/automations/createWorkflow.ts Regenerated API typings for creating workflows with NATS connection config.
openmetadata-ui/src/main/resources/ui/src/constants/ServiceType.constant.ts Marks MessagingServiceType.Nats as Beta in the UI service picker.
openmetadata-ui/src/main/resources/ui/public/locales/en-US/Messaging/Nats.md Adds UI field-level help documentation for the NATS connector.
openmetadata-spec/src/main/resources/json/schema/entity/services/messagingService.json Registers Nats as a messaging service type and adds connection $ref.
openmetadata-spec/src/main/resources/json/schema/entity/services/connections/messaging/natsConnection.json Adds schema-first connection config definition for NATS.
openmetadata-service/src/main/resources/json/data/testConnections/messaging/nats.json Adds backend test-connection step definitions for NATS.
ingestion/tests/unit/source/messaging/test_nats.py Adds unit test suite covering NATS connector behavior (auth, pagination, schema, sampling, cleanup).
ingestion/tests/integration/nats/test_metadata.py Adds integration assertions validating streams become topics and basic metadata is set.
ingestion/tests/integration/nats/populate_schemas_kv.py Adds helper script to populate a JetStream KV bucket with schemas for testing.
ingestion/tests/integration/nats/populate_nats.py Adds helper script to create streams and publish sample messages for testing.
ingestion/tests/integration/nats/conftest.py Adds testcontainers-based NATS JetStream fixture + service creation + workflow config fixture.
ingestion/tests/integration/nats/init.py Initializes the NATS integration test package.
ingestion/src/metadata/ingestion/source/messaging/nats/service_spec.py Registers the NATS connector via BaseSpec.
ingestion/src/metadata/ingestion/source/messaging/nats/models.py Adds Pydantic models for JetStream stream config/state parsing.
ingestion/src/metadata/ingestion/source/messaging/nats/metadata.py Implements NATS JetStream discovery → topic creation, optional schema from KV, and bounded sampling.
ingestion/src/metadata/ingestion/source/messaging/nats/connection.py Implements connection ownership/cleanup, TLS handling, and test-connection steps.
ingestion/src/metadata/ingestion/source/messaging/nats/init.py Initializes the NATS messaging source module.
ingestion/src/metadata/examples/workflows/nats.yaml Adds a runnable ingestion workflow example for NATS.
ingestion/setup.py Adds nats extra dependency (nats-py) for ingestion packaging.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +347 to +351
except (ValueError, UnicodeDecodeError):
logger.debug(
"Skipping non-text sample at sequence %s from NATS stream %s",
seq,
topic_details.topic_name,
Copilot AI review requested due to automatic review settings August 26, 2026 21:34
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Aug 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 36 changed files in this pull request and generated no new comments.

Suppressed comments (1)

ingestion/src/metadata/ingestion/source/messaging/nats/metadata.py:351

  • This sample-data path currently skips non-UTF-8 payloads (UnicodeDecodeError/ValueError) rather than base64-encoding them. That contradicts the PR description (“base64-encodes binary data”) and means binary streams will show fewer/no samples even when they are within the byte/sample limits.

Consider either (a) encoding binary payloads as base64 strings (optionally with a clear prefix/metadata) and updating unit tests accordingly, or (b) updating the PR description/docs to explicitly state that binary payloads are omitted from samples.

            except (ValueError, UnicodeDecodeError):
                logger.debug(
                    "Skipping non-text sample at sequence %s from NATS stream %s",
                    seq,
                    topic_details.topic_name,

@github-actions

Copy link
Copy Markdown
Contributor

❌ UI Checkstyle Failed

❌ ESLint + Prettier + Organise Imports (src)

One or more source files have linting or formatting issues.

❌ Licence Header

One or more files are missing or have an outdated Apache 2.0 licence header.

Affected files
  • openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/messaging/natsConnection.json
    • openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.ts

🔍 ESLint findings in this PR's files — ESLint report could not be read — see the job log.

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

No machine-readable report was produced.


Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.14% (80645/120111) 51.56% (49328/95669) 52.52% (14755/28091)

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@harshach
harshach merged commit 36f5148 into main Aug 27, 2026
138 of 140 checks passed
@harshach
harshach deleted the harshach/fix-pr-28153-conflicts branch August 27, 2026 00:38
harshach added a commit that referenced this pull request Aug 27, 2026
`src/jsons/` is dereferenced from openmetadata-spec by the `parse-schema`
postinstall and is gitignored wholesale; every other connection schema in
it is untracked. natsConnection.json was force-added in #32122 in its
prettier-formatted form, which the generator does not produce — so
`yarn install` rewrites it and leaves the tree dirty, and UI Checkstyle
fails the git-status gate at the end of its first step on every PR.

Co-Authored-By: Claude Opus 5 <[email protected]>
harshach pushed a commit that referenced this pull request Aug 27, 2026
…le (#32138)

* fix(ui): untrack generated natsConnection.json to unblock UI Checkstyle

src/jsons/connectionSchemas/** is generated output: .gitignore:100
ignores the tree, and `yarn parse-schema` (postinstall -> build-check)
rmSyncs and rewrites it on every install. #32122 force-added the NATS
connection schema into it, in prettier's formatting rather than the
`JSON.stringify(obj, null, 2)` form parseSchemas.js emits.

The two formats can never agree - JSON.stringify always expands arrays
and never writes a trailing newline - so every CI run regenerates the
file, dirties the working tree before any check executes, and fails
whichever `git status --porcelain` gate in ui-checkstyle.yml runs
first: "ESLint + Prettier (src)" for PRs touching src/**, "Licence
Header" for everything else. Merge-queue UI Checkstyle has been red
since the NATS commit landed.

Untrack the file - it is rebuilt at install time, and the spec source
under openmetadata-spec/ stays committed - and mirror ESLint's
`src/jsons/connectionSchemas/**` ignore into .prettierignore so
prettier cannot rewrite generated schemas again.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(ui): cover all five parse-schema output dirs in .prettierignore

runParsers() in parseSchemas.js regenerates connectionSchemas/connections,
ingestionSchemas, governanceSchemas, applicationSchemas and configuration.
The first pass listed only three, leaving governanceSchemas/ and
configuration/ open to the same prettier-vs-JSON.stringify conflict.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
harsh-vador added a commit that referenced this pull request Aug 27, 2026
… install

`src/jsons/**` was gitignored and regenerated by `parse-schema` on every
`yarn install` (via `postinstall` -> `build-check`). Three files had been
force-added past that ignore rule (#29964, #32122). Once tracked, every CI
run regenerated them, and because the committed content did not match the
generator's output byte-for-byte the working tree came up dirty before any
linting ran. ui-checkstyle gates on `git status --porcelain`, so it failed
on main for every PR regardless of what that PR changed.

Commit the generated output instead, the same way `src/generated/` TypeScript
types are handled:

- drop the `src/jsons/*` ignore rule and track all 279 generated files
- remove `parse-schema` from `build-check`, so `yarn install` and the Maven
  build no longer rewrite tracked files; `yarn parse-schema` stays available
  for manual regeneration
- exclude `src/jsons/` from Prettier, the licence-header check, and ESLint
  (the ESLint ignore is widened from `src/jsons/connectionSchemas/**`), and
  from the changed-file list in `ui-checkstyle-changed.sh`, so no formatter
  can reintroduce drift between the committed files and generator output

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
harshach pushed a commit to zerafachris/OpenMetadata that referenced this pull request Aug 27, 2026
…on install (open-metadata#32150)

* build(ui): track dereferenced JSON schemas instead of regenerating on install

`src/jsons/**` was gitignored and regenerated by `parse-schema` on every
`yarn install` (via `postinstall` -> `build-check`). Three files had been
force-added past that ignore rule (open-metadata#29964, open-metadata#32122). Once tracked, every CI
run regenerated them, and because the committed content did not match the
generator's output byte-for-byte the working tree came up dirty before any
linting ran. ui-checkstyle gates on `git status --porcelain`, so it failed
on main for every PR regardless of what that PR changed.

Commit the generated output instead, the same way `src/generated/` TypeScript
types are handled:

- drop the `src/jsons/*` ignore rule and track all 279 generated files
- remove `parse-schema` from `build-check`, so `yarn install` and the Maven
  build no longer rewrite tracked files; `yarn parse-schema` stays available
  for manual regeneration
- exclude `src/jsons/` from Prettier, the licence-header check, and ESLint
  (the ESLint ignore is widened from `src/jsons/connectionSchemas/**`), and
  from the changed-file list in `ui-checkstyle-changed.sh`, so no formatter
  can reintroduce drift between the committed files and generator output

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci(ui): auto-update dereferenced JSON schemas alongside generated types

`src/jsons/**` is now tracked, so it needs the same drift protection
`src/generated/**` already has.

typescript-type-generation.yml: run `yarn parse-schema` next to
`json2ts-generate-all.sh`, stage `src/jsons/` with `src/generated/`, and
trigger on changes to `src/jsons/**` and `parseSchemas.js`. Same behaviour as
before for both cases: auto-commit on same-repo PRs, fail with instructions on
fork PRs.

ui-checkstyle.yml: add `src/jsons/**` to `files_ignore` so generated schemas
are never passed to ESLint/Prettier/organise-imports.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ui): fail parse-schema loudly instead of emitting partial output

parseSchemas.js caught every error and only logged it, so the process exited
0 no matter how many schemas failed to generate. That was harmless while
src/jsons was gitignored and rebuilt on every install, but the previous commit
tracks that output — and main() clears each destination directory before
regenerating it. A transient failure (an unresolvable $ref, a read error) now
leaves the schema *missing*, the auto-update workflow reads that as a deletion,
and on a same-repo PR the bot force-pushes a commit removing a tracked file,
with no CI signal.

Collect failures instead of swallowing them and set a non-zero exit code, so
the workflow stops before its "Check for changes" step. Errors are still
collected rather than thrown, so one bad schema does not mask the others: the
run reports every failure at once.

Verified by injecting an unresolvable $ref into kafkaConnection.json — exit 1,
six schemas reported, and `git status` confirmed those six would otherwise have
been staged as deletions. Restoring the schema returns the run to exit 0 with
byte-identical output.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

This branch was previously deployed

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

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ingestion): Add NATS Messaging Service Connector

3 participants