Skip to content

feat(cli-e2e-v2): Slice 1 — framework + MySQL pilot connector - #27949

Merged
harsh-vador merged 75 commits into
mainfrom
feat/cli-e2e-v2-slice1
Sep 21, 2026
Merged

harsh-vador merged 75 commits into
mainfrom
feat/cli-e2e-v2-slice1

Conversation

@IceS2

@IceS2 IceS2 commented May 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Introduces a composition-based connector E2E framework with MySQL as the reference connector. The goals are real end-to-end coverage and tests that are easy to understand, debug, maintain, and extend.

Owned source data -> real metadata CLI -> real OpenMetadata server -> persisted-state assertions

The existing v1 suite remains in place; this PR does not remove it or migrate other connectors.

Design

All framework paths below are under ingestion/tests/cli_e2e_v2/.

  • runtime/ composes WorkflowCase(invocation, persisted, check): execute the CLI once, then poll fresh observations until the entire checker passes. Exit code, structured status, and exact record-error counts are validated independently. Only assertion mismatches retry; transport, parsing, and programming errors propagate.
  • features/database/ provides database workflow configuration, independently declared catalog/type expectations, and reusable catalog, profile, sample, foreign-key, and lineage checks. Strict catalog matching rejects missing, unexpected, duplicated, and incorrectly linked entities.
  • mysql/ owns a pinned disposable MySQL container, restricted ingestion account, fresh per-test schemas, declared seeds, connector configuration, and scenarios. Each test owns an OpenMetadata service; cleanup runs on success and failure. A running OpenMetadata server and authentication are supplied separately.
  • contracts/ provides the reusable pytest workflow test and connector-owned coverage inventory. --e2e-contract-check rejects missing, duplicate, unknown, skipped, or xfailed required cases and partial suite selection.

This replaces the mutable fluent assertion API and baseline-repair hierarchy with ordinary pytest fixtures and composed queries/checks. New connectors supply their own source setup, configuration, expectations, and scenarios without adding runtime subclasses or a central connector registry.

Coverage

The MySQL suite contains 20 feature scenarios plus 11 source/fixture tests. It preserves all 12 scenarios from the initial implementation and extends coverage:

  • Catalog structure, native column types, primary keys, nullability, comments, and view identity.
  • Stored-procedure bodies, fully qualified foreign keys, view DDL, and table/column lineage.
  • Profiler row counts and representative numeric/string metrics, including nulls, duplicates, and freshness after source mutations.
  • Native sample values, null rows, and replacement of previously persisted samples.
  • Positive and negative PII classification checks.
  • Table include/exclude/regex precedence and filtering between two populated schemas.
  • Repeated ingestion, stable entity IDs, metadata updates, and soft deletion without deleting retained tables.
  • Broken-view containment with an explicitly expected CLI failure and continued ingestion of healthy tables.

320 offline framework tests exercise success and failure behavior, including subprocess/status handling, polling composition, strict assertions, cleanup, reporting, and inventory enforcement. Focused production tests cover configuration-log redaction and the dbt status-file contract.

Before pushing 7be95bc879, the combined offline/framework and focused unit run completed with 347 passed, contract collection found all 31 MySQL tests, and pre-commit checks passed. This does not establish that the complete live connector suite is green.

CLI, logging, and CI

  • Adds optional structured workflow status output, including ingest-dbt --status-file, for independent exit/status validation by the E2E runner.
  • Subprocess stdout/stderr use ordinary pytest capture; -s streams logs locally. There is no custom E2E log publisher or redaction layer. Product code owns redaction, with CI-native secret masking as additional protection.
  • Temporary workflow configurations and status files are not published as diagnostics. The live workflow retains its existing JUnit report upload.
  • The live connector workflow, .github/workflows/py-cli-e2e-tests-v2.yml, is manually triggered and enforces complete connector coverage.
  • The shared Python workflow runs offline framework tests on Python 3.10 when E2E code, relevant dependency/test configuration, generated-model schemas, or CI wiring changes. It does not automatically run live connector tests.

Scope and known limitations

  • Strict MySQL YEAR/BIT sample assertions and profiler useStatistics/freshness checks retain known live failures. The corresponding production fixes are deferred; the tests do not use skips, xfails, or relaxed expectations to hide them.
  • Dashboard connectors are design-validated through composition examples and offline framework checks only. No live Metabase tests ship in this PR.
  • DQ, usage, and query-log lineage E2Es remain out of scope. The database invocation helper explicitly rejects the unsupported usage pipeline.
  • Standalone lineage CLI status support and broader production crash/status and validation-log redaction issues remain deferred.

Documentation

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no new actionable defect remains, and both previous threads are resolved.

Summary

The PR introduces a composition-based CLI E2E framework and a live MySQL pilot suite, together with structured workflow status output and CI integration.

  • Adds isolated source/service fixtures, reusable persisted-state checks, strict contract inventory enforcement, and extensive offline framework coverage.
  • Routes supported CLI workflows through common execution and optional JSON status-file handling.
  • Adds manually triggered live MySQL coverage and conditionally runs offline framework tests in shared Python CI.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  F[Owned MySQL fixture] --> C[metadata CLI subprocess]
  C --> W[Workflow execution]
  W --> S[OpenMetadata server]
  W --> J[Structured status JSON]
  S --> P[Fresh persisted-state queries]
  J --> V[Exit, success, and error-count validation]
  P --> A[Polling assertions]
  V --> R[Test result]
  A --> R
Loading

Reviews (3) · Last reviewed commit: "Rename workflow status source identifier"

IceS2 added 30 commits April 27, 2026 15:53
…s helper

Serializes each workflow step's status as JSON to the given path. The
success field mirrors the CLI's exit-code semantic: True iff every step
meets its failure threshold (the same condition that prevents
raise_from_status_internal from raising).

The per-step threshold check is extracted into _step_meets_success_threshold
and shared by both raise_from_status_internal and write_status_file, so
error raising and status-file reporting can never diverge.

Payload:
  {
    "pipeline_type": str,
    "ingestion_pipeline_fqn": str | None,
    "success": bool,
    "steps": [<StepSummary dicts>]
  }

Also adds pytest tests using a new OkSink/OkWorkflow fixture:
- success path (no failures),
- sink failures below threshold (SimpleWorkflow),
- source failures (BrokenWorkflow),
- ingestion_pipeline_fqn propagation via config.model_copy.

Purely additive - no callers yet; the CLI execution layer wires this
up in a following commit.
Adds optional status_file kwarg to execute_workflow. When provided, calls
workflow.write_status_file(path) after stop() so the status JSON reflects
the final per-step state. The write happens inside a try/finally around
execute() so partial status is written on crash — more useful than no
status for post-mortem. raise_from_status stays outside the finally so
original exceptions propagate unchanged.

Backward compatible: existing callers pass no status_file and behavior
is unchanged. Run functions in cli/*.py will forward the kwarg in a
following commit, and cmd.py will expose the --status-file flag after that.
All config-taking CLI commands (ingest, profile, test, lineage, usage,
ingest-dbt, app, classify) now accept the optional status_file path and
forward it into execute_workflow. Purely additive — callers without the
kwarg continue to work unchanged. cmd.py will expose the --status-file
argparse flag and thread it into these calls in the next commit.
…patch

Final CLI prep commit. --status-file is now a visible option on every
config-taking subcommand (ingest, profile, test, lineage, usage,
ingest-dbt, app, classify). metadata() extracts the path from parsed
args and passes it to RUN_PATH_METHODS[<cmd>](path, status_file);
downstream run functions (updated in the previous commit) forward it
into execute_workflow, which calls BaseWorkflow.write_status_file when
a path is supplied.

Backward compatible: omitting the flag preserves prior behavior end-to-end.
Optional path value defaults to None at every layer.
Two top-level groups:
- core/ — framework shared by all connectors (config, runner, fluent,
  expected, source). Concrete modules land in following commits.
- <connector>/ — everything for one connector (expected catalog, baseline
  data + enforcer, fixtures, test file). mysql/ is the pilot; future
  connectors add their own sibling folder.

Empty __init__.py markers only. Connector-centric grouping keeps every
file touched when adding/modifying a connector in one folder, so PR
reviews and template cloning stay simple.
Typed contract between CliRunner (added in a later commit) and tests.
Frozen dataclasses mirroring the JSON shape written by
BaseWorkflow.write_status_file. `warnings`/`errors`/`filtered` are
int counts (matching the live payload observed in smoke testing);
`failures` is the optional detail list. Exposes `.all_failures` for
flat assertions and `.step(name)` for targeted per-step lookups.
CliExecutionError raised by CliRunner (future Task 11) on non-zero
subprocess exit; carries exit_code + stderr + config_path + command
so pytest's default failure rendering surfaces everything needed
for post-mortem. SourceBaselineDrift raised by ensure_baseline
(future Task 17) when source state drifts in check_only mode ---
cloud sources default to check_only to avoid mutating shared state.
Env.required raises EnvLoadError at fixture time with a clear message
when a required E2E_* secret is missing — replaces v1's $E2E_* shell
expansion in YAML that produced opaque Pydantic errors when vars were
absent. ServerConfig owns the shared sinkConfig + openMetadataServerConfig
applied to every test's rendered YAML, reading OM_SERVER_URL and
OM_JWT_TOKEN from env with sensible local-Docker defaults.
Immutable dict-backed builder for the YAML config passed to `metadata`.
WorkflowConfig.build starts in 'metadata' pipeline mode with the shared
sink+server config; .as_metadata(**flags) produces a new instance with
markDeletedTables / includeTables / includeViews / includeStoredProcedures
set on sourceConfig.config. .write_tmp serializes to a per-invocation
numbered YAML file under pytest's tmp_path. Pipeline-to-CLI-subcommand
mapping lives here so CliRunner can dispatch from cfg.cli_subcommand.

The 'lineage' pipeline_type maps to the 'ingest' subcommand: metadata
lineage is a raw-SQL-parse tool with a different config schema entirely;
connector-based DatabaseLineage workflows run through metadata ingest,
differentiated only by sourceConfig.config.type and source.type.

Remaining overlays (as_profiler/as_lineage/as_usage/as_test/with_filter/
with_overrides) land in a following commit.
Completes WorkflowConfig's overlay API. .as_profiler uses real profiler
schema fields (profileSample, computeTableMetrics, computeColumnMetrics)
not auto-classification fields. .as_lineage and .as_usage both carry
resultLimit. .as_auto_classification is its own switcher with
storeSampleData/enableAutoClassification/sampleDataCount/includeViews
and maps to cli_subcommand "classify".

.with_filter takes separate include/exclude lists at database/schema/table
levels and merges (appends) across multiple calls — supports OM's
simultaneous include-AND-exclude pattern.

_PIPELINE_CLI_SUBCOMMAND and _PIPELINE_SOURCE_CONFIG_TYPE updated with
"auto_classification" → "classify" / "AutoClassification".
Per-invocation numbered artifacts (cfg_<pipeline>_<n>.yaml +
status_<pipeline>_<n>.json) so multiple runs within a single test
keep distinct files. Counter keyed by pipeline_type so same-pipeline
repeats increment while cross-pipeline calls both start at 0.

Raises CliExecutionError with full stderr + config_path + command on
non-zero exit. Also raises (defensive) if the CLI exits 0 but fails
to write a status file — catches future regressions in
BaseWorkflow.write_status_file.
Deadline-based retry on AssertionError — returns the check's value as
soon as it succeeds, raises the final failure once timeout elapses.
Other exception types propagate immediately (no retry on programming bugs).

Logging contract: first attempt at DEBUG, final failure at ERROR with
attempt count + elapsed seconds, middle attempts silent. Replaces v1's
time.sleep-in-a-while-loop polling patterns. Consumed by fluent assertion
namespaces (.eventually()) added in following commits.
OmClient wraps metadata.ingestion.ometa.OpenMetadata (no new HTTP code
per Decision #21); exposes .table(fqn), .service(name), and .raw
escape hatch. TableAssert has synchronous exists/get, single-property
has_tag/has_owner, drill-down .column(name), entity-level .eventually(timeout)
one-shot wrapper, and three namespace properties (.lineage/.profile/.tests)
that lazy-import their Task 14 implementations. ColumnAssert has
has_tag/has_type/has_description_containing.
…ssert

Completes the fluent surface. Each namespace owns its own .eventually(timeout)
one-shot wrapper.

- LineageAssert: has_upstream / has_downstream / has_column_lineage, using
  OM's get_lineage_by_name and tolerating either upstreamEdges/downstreamEdges
  or a nodes-only shape in the response.
- ProfileAssert: row_count() returns NumericAssert (at_least/equals/between).
  .eventually() polls until profile.rowCount is non-None then hands off.
- TestsAssert/TestCaseAssert: case(name).passes() / .fails() check the latest
  testCaseResult's testCaseStatus.
- ServiceAssert: exists, get (raw DatabaseService), has_entity_count (tables
  or schemas) via list_all_entities filtered by service.

All retry via the Task 12 retry_until helper — first attempt at DEBUG, final
at ERROR with elapsed time.
Per Decision #4, these are custom wrappers reusing OM's Pydantic value
types (DataType, Constraint, DatabaseServiceType) — automatic enum
drift-safety while keeping spec modules short (no forced population of
the 30+ fields on the real Table/Column entities).

Expected tree: ExpectedService → ExpectedDatabase → ExpectedSchema →
ExpectedTable → ExpectedColumn. Unset / None fields mean "don't assert"
so specs stay terse. description uses str | None with substring semantics
(Decision #16). ExpectedTable.ordered defaults False — columns matched
by name, tolerant to reordering.

MatchMode enum (STRICT / SUPERSET / SUBSET) drives the differ's tolerance
for "extras" in the actual OM state. Consumed by StructuralDiffer in the
next commit.
assert_service_matches(expected, om, mode=SUPERSET) walks an Expected*
tree, fetches actual OM state per-level via OmClient.raw, collects
path-qualified Diff entries, and raises StructuralMismatch with a
multi-line message listing every discrepancy.

Level-by-level walk with get_by_name at each node — missing parent
short-circuits without cascading "column X missing" noise. Column
matching is by name (table-level .ordered not yet consumed; landing
point for future by-position mode).

STRICT mode flags extra columns beyond the expected set; SUPERSET
(default) tolerates extras, treating actual as a superset of expected.

Diffs render via bracket-path notation (service[foo].database[bar].table[baz]
.column[qux].dataType) so pytest failure output is greppable.
SourceBaselineEnforcer Protocol defines the three-phase lifecycle
(introspect -> compare -> apply) shared by all source families. EnforcementPolicy
binds an enforcer to a mode (apply for local Docker, check_only for
shared cloud). Trust mode (policy=None + expected=None) short-circuits with
a WARNING so a connector can migrate to v2 before its baseline is modeled.

ensure_baseline(policy, expected, connector_name) is the uniform entry
point. check_only drift raises SourceBaselineDrift with the operator CLI
command for manual recovery; apply mode delegates to enforcer.apply.

SQL family types (SqlSourceBaseline + BaselineTable + BaselineColumn + Seed +
BaselineView) are the only concrete baseline family shipped with MVP.
Seed uses a two-field shape: sql (idempotent INSERT) + expected_row_count
(COUNT-based drift gate).
First concrete SourceBaselineEnforcer implementation. Via SQLAlchemy:

- introspect() queries INFORMATION_SCHEMA for schemas, tables (BASE TABLE),
  columns, and views in one pass per category. Uses bindparam(expanding=True)
  for the IN clauses so multi-schema baselines work correctly.
- compare() walks the SqlSourceBaseline, diffing each schema / table / column /
  seed row-count / view against the introspected state. Missing-parent entries
  short-circuit that subtree to avoid cascading noise.
- apply() runs CREATE SCHEMA IF NOT EXISTS, CREATE TABLE IF NOT EXISTS with
  column + PK definitions, executes idempotent Seed.sql when row count drifts,
  and runs each view's definition_sql verbatim (baseline supplies CREATE OR
  REPLACE VIEW ...).

Type normalization is deliberately minimal (strip UNSIGNED + whitespace) —
baselines should declare types that match MySQL's INFORMATION_SCHEMA output
directly. Factory classmethod from_url(url, baseline) for common case of
building from a connection string.
…rift error

The Task 19 standalone operator CLI (python -m ...source.apply) was removed
from the plan — MVP ships only MySQL which runs mode="apply" locally, so
check_only never triggers and the CLI is dead code. When the first cloud
connector lands, the recovery mechanism (likely a pytest --source-mode=apply
flag reusing existing fixtures) will be designed against real requirements
instead of speculative ones.

SourceBaselineDrift error message now points at a generic out-of-band recovery
instruction rather than a nonexistent module path.
Declarative MySQL source state: one schema (e2e) with two tables
(customers + transactions) and one view (customer_txn_summary), each
sized to exercise every major connector feature while staying as small
as possible.

customers (10 rows): INT PK, VARCHAR, email/phone PII columns for
auto-classification, INT numeric (age, credit_score) and TEXT nullable
(bio) for profiler coverage, DATE and TINYINT, status VARCHAR for DQ
enum assertions.

transactions (10 rows): INT FK to customers.id for join-level table
lineage via INFORMATION_SCHEMA.KEY_COLUMN_USAGE, DECIMAL(10,2) for
profiler mean/stddev, DATETIME for date-range profiling, status for DQ
assertions.

customer_txn_summary (view): LEFT JOIN of both tables for view-to-table
lineage testing.

Seed SQL uses ON DUPLICATE KEY UPDATE for full idempotency and explicit
timestamp literals (no NOW()) for determinism — profiler min/max
assertions and DQ value checks can rely on fixed values.

get_policy() uses functools.lru_cache(maxsize=1) — no mutable
module-level state. Importing the module never reads env vars (test
discovery and static analysis work with no E2E_MYSQL_* set). Env vars
are resolved only on the first call; EnvLoadError surfaces immediately
with the missing key name.
Extends the framework to model MySQL stored procedures (and future
connectors' equivalents) through every layer:

- core/source/sql.py: BaselineStoredProcedure dataclass + stored_procedures
  field on SqlSourceBaseline (backward compat via default_factory).
- mysql/enforcer.py: introspect reads INFORMATION_SCHEMA.ROUTINES where
  ROUTINE_TYPE='PROCEDURE'; compare reports missing procedures as Drifts;
  apply issues DROP PROCEDURE IF EXISTS + CREATE (no CREATE OR REPLACE in
  MySQL). DELIMITER is CLI-only — PyMySQL sends the whole CREATE PROCEDURE
  as one string and MySQL parses the body server-side.
- core/expected/types.py: ExpectedStoredProcedure + stored_procedures field
  on ExpectedSchema.
- core/expected/differ.py: _diff_stored_procedure walks procedures in each
  schema, checking presence + substring-match on description.
- core/fluent/stored_procedure_assert.py (new): StoredProcedureAssert with
  exists / get / has_description_containing / has_code_containing.
- core/fluent/om_client.py: .stored_procedure(fqn) entry point, lazy-import
  pattern matching .service().

All additive -- no existing method bodies changed, no breaking changes.
Three tables + one view + one stored procedure, breadth-first across
every MySQL connector feature deterministically seedable:

- customers (10 rows): adds full PII-regex coverage (email, phone, ssn,
  address, city, country, zipcode, first_name, last_name, full_name,
  date_of_birth) plus DQ enum (status), profiler numeric (age,
  credit_score), profiler date (joined_date, date_of_birth), and
  nullable columns (bio, phone, ssn, address). Auto-classification
  pipeline lights up most Presidio recognizers via column-name regex.
- transactions (10 rows): adds CHAR(3) for currency (distinct from VARCHAR
  in type coverage), CHAR(12) reference_number, ip_address VARCHAR for
  IP_ADDRESS PII recognizer, MEDIUMTEXT notes. Keeps FK customer_id ->
  customers.id for table lineage.
- all_types (3 rows): NEW table exercising every MySQL -> OM DataType
  mapping: all integer widths, float/double/decimal, every CHAR/VARCHAR/
  TINYTEXT/TEXT/MEDIUMTEXT/LONGTEXT, every BINARY/VARBINARY/TINYBLOB/BLOB/
  MEDIUMBLOB/LONGBLOB, DATE/TIME/DATETIME/TIMESTAMP/YEAR, BIT(8), JSON,
  ENUM, SET. Seed uses hex literals (X'...'), bit literals (b'...'),
  JSON_OBJECT/JSON_ARRAY, and ENUM/SET string values.
- customer_txn_summary (view): view-to-table lineage across both tables.
- sp_active_customer_count (stored procedure): static SELECT COUNT(*) with
  status='active' filter. Exercises StoredProcedure entity ingestion when
  .as_metadata(include_stored_procedures=True) is set.

All seed SQL is deterministic (no NOW/RAND/UUID) and idempotent (ON
DUPLICATE KEY UPDATE). Stored procedure uses DROP IF EXISTS + CREATE in
apply() -- MySQL has no CREATE OR REPLACE PROCEDURE.

Expected row counts: customers=10, transactions=10, all_types=3 -- fixed
so profiler row_count.equals(N) assertions work cleanly.

get_policy() continues to lazy-build + cache the EnforcementPolicy.
_check_strict_schema_extras lists actual tables and stored procedures via
list_all_entities filtered by databaseSchema FQN, comparing against the
declared expected sets. Any actual entity not in the expected set produces
a Diff with path suffix "(strict)" for visual distinction in failure output.

SUPERSET mode behavior is unchanged — existing test expectations against
SUPERSET stay green.

Required by filter tests, which need to verify "exclude" semantics: merely
walking declared items isn't enough because extras stay invisible. The
new check closes that gap at the schema level.

Database/service-level extras (e.g., stray schemas, unrelated databases)
are not flagged — would need similar list_all_entities walks at those
levels. Deferred until a test demands it.
Declarative OM-side expectation mirroring MYSQL_BASELINE. Single factory
mysql_expected(service_name, *, tables=None) returns the full catalog
(4 tables + 1 view + 1 stored procedure) or a restricted slice when
`tables` is supplied. Caller computes the post-filter table list
explicitly — the factory does not mirror the ingest-side regex logic,
which keeps the filter config <-> expected catalog mapping obvious at
each test call site.

Each table's column list is a separate private helper so diffs stay
readable. 18 columns on customers (full PII coverage), 10 on
transactions, 30 on all_types (every MySQL type the connector maps),
5 on the customer_txn_summary view. stored_procedures stays as
[sp_active_customer_count] — no current scenario disables SPs.

Several DataType variants (MEDIUMINT, TINYTEXT/LONGTEXT/TINYBLOB/
MEDIUMBLOB/LONGBLOB) are best-guess mappings; Task 25's first live
run is the authoritative validator and will surface any corrections.
Split into two files so test modules can import helpers cleanly
(pytest discourages importing from conftest).

connector.py:
  - mysql_service_name(session_uuid, variant="") — builds the service
    name. Variant suffix enables per-test isolation for filter tests
    that can't share service state.
  - build_mysql_config(service_name, server) — factory for building a
    base MySQL WorkflowConfig. Reads E2E_MYSQL_* env vars via
    Env.required so missing secrets fail-fast at fixture time.

conftest.py:
  - mysql_source_ready (session): runs ensure_baseline, creating schema,
    tables, views, stored procedure, and deterministic seed rows.
  - mysql_cfg (module): shared default config for tests that don't need
    variant isolation.

Depends on session_uuid + om_server_config fixtures from the top-level
conftest.py (arriving in Task 23). pytest resolves the chain lazily.
Absolute `from tests.cli_e2e_v2.*` imports across 18 files broke pytest
conftest loading because pytest doesn't put ingestion/ on sys.path
before importing conftest modules. The repo convention (v1 cli_e2e,
integration test conftests) is relative imports within test packages —
converting matches that pattern.

Converted:
  - 44 occurrences across 18 files (core/* + mysql/* + top-level conftest).
  - Depth-aware: same-dir uses .X, sibling-up uses ..sibling.X, etc.

Also lands the top-level conftest.py (Task 23) with session-scoped
identity/server/client fixtures + per-test om_client/cli_runner +
registered_services finalizer for OM service cleanup.

Verified: pytest --collect-only on tests/cli_e2e_v2/ now exits 5 (no
tests collected) without ConftestImportFailure.
Exercises every MVP-scoped pipeline against the MySQL baseline:

  metadata ingest       — vanilla structural diff + all_types column
                          type spot-checks + stored procedure presence
                          + service-level entity counts
  profiler              — exact row counts (customers=10, transactions=10,
                          all_types=3) per deterministic seed
  lineage               — view-derived only (customer_txn_summary→customers/
                          transactions via SQL parse); FK constraints land
                          on TableConstraint entries, not lineage edges
  auto-classification   — PII tags on column-name regex matches (email,
                          ssn, first_name → Sensitive; phone, address,
                          date_of_birth → NonSensitive)

Plus four filter scenarios using isolated variant-named services:
  tables_include exact, tables_exclude exact, schemas_include only e2e,
  and regex include+exclude with exclude-priority semantic.

Session-shared tests use mysql_cfg; filter tests build isolated configs
via build_mysql_config(service_name, om_server_config) so STRICT-mode
extras assertions don't get polluted by prior-test state.

DQ pipeline deferred to post-MVP (requires TestCase entities seeded via
OM API before the test command can run).

Live validation happens in Task 25 — today's build only verifies
collection + imports.
Env gains two new methods:
  - ref(key) — validates presence and returns "${KEY}" in one step
  - set_default(key, default) — os.environ.setdefault wrapper

ServerConfig.to_workflow_config_dict and build_mysql_config now emit
${OM_*} / ${E2E_MYSQL_*} references via Env.ref() instead of embedding
real JWT tokens / passwords / host:port values. The metadata CLI's
load_config_file applies os.path.expandvars to raw YAML before parsing,
so subprocesses resolve references at load time — but tmp_path artifacts
a developer might share in tickets or Slack no longer leak credentials.

Validation lives inside ref() rather than per-connector factories:
Env.ref("E2E_MYSQL_PASSWORD") both validates the var is set AND emits
the reference string. Per-connector code reads as a flat list of refs
with no scattered Env.required calls.

ServerConfig instance fields still hold real resolved values (used by
om_http_client fixture, which authenticates directly without YAML).
ServerConfig.from_env uses Env.set_default to backfill OM_SERVER_URL
and OM_JWT_TOKEN with local-Docker defaults so local runs work without
env var plumbing.
Replaces the static-method Env API (required / optional / set_default / ref)
with a single class. Construction captures (key, default, required);
Env.ref() returns '${KEY}' for YAML embedding, Env.get() returns the raw
value for non-YAML contexts.

Connector code and framework code converge on one idiom:
  Env("E2E_MYSQL_USER").ref()                       # YAML field
  Env("OM_SERVER_URL", default=FALLBACK).get()      # raw value
  Env("E2E_MYSQL_DATABASE", required=False).get()   # optional

No caller touches os.environ directly. ServerConfig.from_env, its
to_workflow_config_dict, build_mysql_config, and mysql/baseline.py's
get_policy are all updated to the new API. The rendered YAML still emits
${E2E_MYSQL_*} / ${OM_*} references so credentials never enter tmp_path
artifacts; metadata CLI's os.path.expandvars expands them at subprocess
load time.
- BaselineColumn: foreign_key + description fields
- BaselineTable: description field
- MySqlEnforcer: emit FK + COMMENT in CREATE TABLE via new helpers
- mysql baseline: FK on transactions.customer_id -> customers.id; table/column comments on customers+transactions; docstring caveat about CREATE TABLE IF NOT EXISTS limit
- TableAssert: has_description_containing + has_foreign_key_constraint
- mysql expected: description substring assertions (picked up by differ walk)
- mysql conftest: module-scoped mysql_metadata_ingested fixture; 7 tests drop inline metadata CLI (saves ~6 subprocess runs per module pass)
- new test: test_transactions_foreign_key_constraint

pytest collection: exit=0, 12 tests (up from 11).
@IceS2
IceS2 added this pull request to the merge queue Sep 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-21T12:03:37Z)

No failing check on merge-queue commit b9412f0 — invalidated by an entry ahead in the queue, or a required check timed out.

@harsh-vador
harsh-vador added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit 9efde03 Sep 21, 2026
127 of 130 checks passed
@harsh-vador
harsh-vador deleted the feat/cli-e2e-v2-slice1 branch September 21, 2026 16:46
harshach added a commit that referenced this pull request Sep 21, 2026
…-hierarchy

One commit — the cli-e2e-v2 framework and MySQL pilot connector (#27949) —
which landed on main while the previous merge was being verified, so the branch
was a commit behind as soon as it was pushed. Merged cleanly, no conflicts.

Almost entirely ingestion Python (73 files) plus two workflow files that come
from main rather than being authored here.

Python gates on the merged tree: ruff check passes over ingestion/ and
openmetadata-airflow-apis/, ruff format reports 2871 files already formatted,
and check_ruff_suppressions --check exits 0. impact-map.generated.json needs no
regeneration.
Khairajani added a commit that referenced this pull request Oct 6, 2026
Backport of #34302 to 2.0, connector fix and unit tests only.

get_table_names returns the data dictionary name verbatim, so a table is
stored as schema.CUSTOMERS, while get_foreign_keys reported referred_table
through normalize_name as customers. common_db_source looks the referred table
up by exact FQN, so it never matched: the constraint was discarded with no
error, no warning and a reported 100% workflow success, leaving
tableConstraints empty for every Oracle table.

Taking row[3] as stored matches get_table_names by construction, in both
identifier modes and for tables created with quoted lowercase or mixed-case
names. No FQN changes, so nothing is renamed and no migration is needed.

test_oracle_constraint_reflection.py asserted the normalised referred_table and
so pinned the behaviour this fixes; its expectation is updated.

The v2 E2E suite from #34302 is not backported: ingestion/tests/cli_e2e_v2 does
not exist on 2.0, since the framework from #27949 was never backported.

Two pre-existing failures in test_oracle.py on 2.0, both about stored-procedure
schema casing, are unaffected: they fail identically with and without this
change.

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

Ingestion 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.

9 participants