Repository navigation
fix: bulk backend + Airflow + integration-test refresh (17 files) - #33883
Conversation
17 files — all pure additions OR wholesale copies from harshach's branch where main has not touched the file since our merge-base. No conflict resolution ambiguity. Backend Java (5): - DataContractRepository.java — correct data-contract result retrieval to use execution identity (not timestamp) - DataContractResource.java — matching resource-layer plumbing - EntityLifecycleEventDispatcher.java — immutable snapshot with a synchronised swap so a registration racing a dispatch cannot NPE on the vacated tail slot - RdfLiveWriter.java — matching fix for the RDF projection write path - IngestionPipelineRepositoryTest.java — accompanying test Integration tests Java (3): - DataContractResourceIT.java — regression tests for both result-ID lookup fixes - RdfLiveProjectionIT.java — RDF projection tests - SearchIndexRetryQueueIT.java — retry-queue test isolation Airflow Python (9): - api/response.py, api/utils.py — response/util fixes - operations/deploy.py — wait for fresh registered/serialized DAG metadata before deployment is considered trigger-ready - utils/pipeline_run_id.py (new) — pipeline-run-id helper - tests/conftest.py (new) - tests/integration/operations/test_dag_lifecycle.py (new) — DAG lifecycle integration tests - tests/integration/operations/test_airflow_ops.py — refreshed - tests/unit/ingestion_pipeline/test_build_dag.py — refreshed - tests/unit/test_helpers.py — refreshed Cherry-picked from #33088. All original content authored by @harshach. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
… delete for undeployed Two follow-ups to make the airflow-apis-tests + service-unit-tests suites green: 1) send_failed_status_callback: derive runId from context.dag_run when the workflow_config's own pipelineRunId is None or missing. After a DAG reparse, build_dag's freshly-parsed pipelineRunId is a new random UUID that does not match the run the server actually recorded; using the id derived from dag_run.run_id via the same pipeline_run_id() helper the response layer uses makes the failed-status update land on the correct run. Fixes test_failure_callback_after_dag_reparse_updates_the_same_run. 2) IngestionPipelineRepository.deleteDeployedPipeline: early-return when the entity is not deployed. A metadata-only pipeline has no deployed workflow to remove from the runner, so requiring the runner to be reachable to complete a delete would fail with IngestionRunnerUnavailableException even when there is nothing to remove. Fixes IngestionPipelineRepositoryTest.deleteUndeployedPipelineDoesNotRequireRunner. Both changes correspond to hunks that harshach's branch already carries; they were excluded from the wholesale-copy batch because main had also touched the same files. Applying the specific hunks that the tests exercise is the minimal addition to make this PR self-consistent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three follow-up fixes on top of the earlier bulk backend refresh:
1. send_failed_status_callback: fix run-id resolution for the two paths that
the earlier commit missed:
- PREFER dag_run.conf.pipelineRunId when the server triggered the run.
For server-triggered runs the server names the DagRun `manual__<ts>` and
stashes the real UUID in `conf.pipelineRunId`; the derived UUIDv5 from
the timestamped run_id does NOT match what the server queued.
- duck-type the context on `.get` rather than `isinstance(dict)`. Airflow
2.x's callback context is `airflow.utils.context.Context`, a
`collections.abc.MutableMapping` and NOT a `dict` subclass. The earlier
check silently returned False, dropped `dag_run`, and no-op'd the reparse
fix on 2.x.
Priority order is now: conf.pipelineRunId -> pipeline_run_id(dag_id,
run_id) -> workflow_config.pipelineRunId.root.
2. IngestionPipelineRepository.deleteDeployedPipeline: previously guarded
with early-return when `deployed=false`, which left DAG/config files in
Airflow after a failed first-deploy attempt (files are written before
the readiness check; scheduler eventually parses them into an orphan
DAG). Now attempts runner cleanup regardless but tolerates an unavailable
runner for undeployed pipelines (effective allowUnavailableRunner=true).
Corresponding test assertion updated: cleanup is now skipped-but-attempted
for the undeployed+unavailable case.
3. delete_dag_id (operations/delete.py): reorder so Airflow's own
`delete_dag` runs FIRST inside a session, THEN files are removed. The
original order removed files before the airflow-side deletion, so a
RuntimeError like "TaskInstances still running" would leave the pipeline
with an orphan record in Airflow's db and no files to re-parse. Fixes
test_running_dag_keeps_its_files_when_deletion_is_rejected.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previous fix (`effectiveAllowUnavailableRunner`) resolved gitar's "failed-first-deploy leaves DAG on disk" concern but greptile then flagged that a direct hard delete on an undeployed pipeline with unavailable runner silently reports success — potentially orphaning Airflow artifacts. Split by caller intent: - Cascade/force delete (allowUnavailableRunner=true) — tolerate & report skipped, unchanged. - Direct hard delete of a DEPLOYED pipeline + unavailable runner — surface the exception, unchanged. - Direct hard delete of an UNDEPLOYED pipeline + unavailable runner — ATTEMPT cleanup (so files-on-disk from a failed first-deploy get removed when the runner IS reachable), swallow the unavailable exception (return false), but with an explicit doc note calling out the residual risk when runner is unreachable AND files exist. Proper fix is a compensating cleanup at deploy-readiness-timeout time, tracked separately. Test updated: `deleteUndeployedPipelineDoesNotRequireRunner` back to `assertFalse` with a comment explaining the metadata-only intent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…amed import The `delete` module was reordered so airflow's own delete runs FIRST inside the session, and its import binds locally as `airflow_delete_dag` (not `delete_dag`). The test still monkey-patched `delete.delete_dag` and used a 1-arg replacement, so it AttributeErrored before `delete_dag_id` even ran. - Patch the correct attribute (`airflow_delete_dag`). - Accept the `session=` kwarg the call site passes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
py-checkstyle in the merge queue reported common.py needed reformat. Ran ruff format 0.15.22 (CI's version) against ingestion/pyproject.toml. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d-airflow-ingestion-bulk
Code Review ✅ Approved 5 closed / 5 findings🟡 Medium risk · Changes Airflow lifecycle and run identities plus data-contract result retrieval. Bulk refresh of 17 files across backend Java, Airflow Python, and integration tests addressing data-contract result lookup by execution UUID, run-ID synchronization across Airflow response/task/callback layers, DAG lifecycle management with metadata persistence waits, concurrent event-handler registration safety, and retry-queue test isolation. Five correctness issues resolved: worker run-ID derivation now matches server identity, CustomPythonOperator scheduled-run coverage added, failure callbacks respect server runIds, failed deployments properly clean up Airflow metadata before file removal, and reparse context detection fixed for Airflow 2. No open issues. ✅ 5 closed✅ Bug: Worker never derives run id from dag_run; status runIds diverge
✅ Quality: No test covers scheduled-run runId derivation in CustomPythonOperator
✅ Bug: Failure callback ignores server runId in conf for server-triggered runs
✅ Bug: Failed first deploy leaves DAG in Airflow that delete now skips
✅ Edge Case: isinstance(context, dict) misses Airflow 2 Context; reparse fix no-ops
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Fixes #33087
Describe your changes:
Bulk refresh 17 files across backend Java, Airflow Python, and integration tests from #33088. All files are pure additions OR wholesale copies from harshach's branch where main has not touched the file since our merge-base — no conflict resolution ambiguity.
Backend Java (5)
DataContractRepository.java— correct data-contract result retrieval to use execution identity (not timestamp)DataContractResource.java— matching resource-layer plumbingEntityLifecycleEventDispatcher.java— immutable snapshot with a synchronised swap so a registration racing a dispatch cannot NPE on the vacated tail slot. Race is reachable in production (SearchRepository rebuild + vector-service reinit both re-register handlers while requests are in flight).RdfLiveWriter.java— matching fix for the RDF projection write pathIngestionPipelineRepositoryTest.java— accompanying unit testIntegration tests Java (3)
DataContractResourceIT.java— regression tests for both result-ID lookup fixesRdfLiveProjectionIT.java— RDF projection testsSearchIndexRetryQueueIT.java— retry-queue test isolationAirflow Python (9)
api/response.py,api/utils.py— response/util fixesoperations/deploy.py— wait for fresh registered/serialized DAG metadata before deployment is considered trigger-readyutils/pipeline_run_id.py(new) — pipeline-run-id helpertests/conftest.py(new)tests/integration/operations/test_dag_lifecycle.py(new) — DAG lifecycle integration teststests/integration/operations/test_airflow_ops.py,tests/unit/ingestion_pipeline/test_build_dag.py,tests/unit/test_helpers.py— refreshedType of change:
Notes
Cherry-picked from #33088. All original content authored by @harshach.
🤖 Generated with Claude Code
The PR appears safe to merge because no accepted new issue or outstanding previous finding remains.
Summary
This PR refreshes backend, Airflow, and integration-test behavior around data-contract result identity, ingestion run identity, DAG lifecycle management, concurrent event-handler registration, and retry-queue isolation.
Diagram
Reviews (5) · Last reviewed commit: "fix: refine deleteDeployedPipeline to sa..."