Repository navigation
Minor improvements - #32474
Minor improvements#32474
Conversation
❌ 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 |
There was a problem hiding this comment.
🟡 Changes recommended
The updated error handling can itself raise exceptions (e.g., HTTPStatus(exc.code) / non-int status comparisons), risking broken error responses at runtime.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR tightens ingestion- and managed-API error/log handling to avoid exposing sensitive internal details, updates time utilities to use zoneinfo, and adds regression tests to lock in the safer behavior.
Changes:
- Sanitize server-side API error responses (generic 5xx payloads) and reduce detail leakage from exception handlers and validation responses.
- Remove configured connector types from parser debug messages while retaining actionable parsing logs.
- Migrate ingestion time utilities from
pytztozoneinfo, adding DST fold-related regression coverage.
File summaries
| File | Description |
|---|---|
| openmetadata-airflow-apis/tests/unit/test_response.py | Adds regression tests ensuring 5xx responses don’t leak internal details while preserving safe 4xx messages. |
| openmetadata-airflow-apis/openmetadata_managed_apis/utils/parser.py | Removes connector/type-specific details from inner-connection parsing messages; adjusts debug logging. |
| openmetadata-airflow-apis/openmetadata_managed_apis/operations/last_dag_logs.py | Stops returning a detailed 500 message when log reading isn’t supported. |
| openmetadata-airflow-apis/openmetadata_managed_apis/operations/health.py | Replaces detailed 400 error payload with a generic message. |
| openmetadata-airflow-apis/openmetadata_managed_apis/operations/deploy.py | Removes server error payload that previously embedded exception details. |
| openmetadata-airflow-apis/openmetadata_managed_apis/api/routes/run_automation.py | Replaces validation error detail with a generic client-facing message. |
| openmetadata-airflow-apis/openmetadata_managed_apis/api/routes/deploy.py | Replaces validation error detail with a generic client-facing message. |
| openmetadata-airflow-apis/openmetadata_managed_apis/api/response.py | Forces generic error text for 5xx responses and removes parameterized server_error. |
| openmetadata-airflow-apis/openmetadata_managed_apis/api/error_handlers.py | Updates exception handlers to avoid returning exception repr/details. |
| ingestion/tests/unit/test_parser_logging.py | Adds regression coverage ensuring debug logs don’t echo configured connector type text. |
| ingestion/tests/unit/metadata/utils/test_time_utils.py | Adds parameterized tests for DST fold/nonexistent-time timestamp conversion behavior. |
| ingestion/src/metadata/utils/time_utils.py | Migrates timezone handling to ZoneInfo and adjusts datetime→timestamp conversions. |
| ingestion/src/metadata/ingestion/source/dashboard/ssrs/client.py | Adds justification and suppresses HTTP-mount security finding (adapter mount ≠ protocol selection). |
| ingestion/src/metadata/ingestion/ometa/http_adapter.py | Adds justification and suppresses HTTP-mount security finding (adapter mount ≠ protocol selection). |
| ingestion/src/metadata/ingestion/api/parser.py | Removes connector/type echoing from inner-connection parsing messages; updates debug logging style. |
| ingestion/src/metadata/core/connections/test_connection/checks/storage.py | Documents and suppresses sonar finding around ExpectedBucketOwner for generic S3-compatible stores. |
| ingestion/src/metadata/cli/scaffold.py | Documents and suppresses sonar finding about writing scaffolded files to validated paths. |
Review details
Suppressed comments (1)
ingestion/src/metadata/utils/time_utils.py:54
- Local variable
tmsaplooks like a typo and makes the logic harder to read/grep; since this function was modified, it’s a good opportunity to rename it to something clear (e.g.,timestamp_seconds).
if datetime_value.tzinfo is None:
datetime_value = datetime_value.replace(tzinfo=tz)
else:
datetime_value = datetime_value.astimezone(tz)
tmsap = datetime_value.timestamp()
if milliseconds:
return int(tmsap * 1000)
return int(tmsap)
- Files reviewed: 17/17 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
The new Flask unit tests build responses inside an app context but assert response.get_json() outside it, which can fail with “Working outside of application context” depending on Flask internals/version.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
openmetadata-airflow-apis/tests/unit/test_response.py:42
- This test exits the Flask app_context before calling response.get_json(). That can fail on Flask versions where get_json relies on current_app.json. Keep the assertions inside the app_context to avoid context-related failures.
with Flask(__name__).app_context():
response = ApiResponse.bad_request(message)
assert response.status_code == ApiResponse.STATUS_BAD_REQUEST
assert response.get_json() == {"error": message}
openmetadata-airflow-apis/tests/unit/test_response.py:58
- The assertions here run after the Flask app_context is closed. To avoid "Working outside of application context" errors when calling response.get_json(), keep the assertions inside the app_context.
with Flask(__name__).app_context():
response = ApiResponse.error(status, error)
assert response.status_code == expected_status
assert response.get_json() == {"error": expected_error}
- Files reviewed: 18/18 changed files
- Comments generated: 2
- Review effort level: Lite
✅ Playwright Results — workflow succeededValidated commit ✅ 618 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 57m 40s ⏱️ Max setup 4m 17s · max shard execution 17m 47s · max shard-job elapsed before upload 21m 3s · reporting 5s 🌐 253.65 requests/attempt · 2.74 app boots/UI scenario · 11.06% common-shard skew Optimization targets still in progress:
🟡 2 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 |
There was a problem hiding this comment.
🟢 Approval recommended
The changes align with the stated security-hardening goals, include targeted regression tests, and I only found minor docstring consistency issues.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
ingestion/src/metadata/utils/time_utils.py:33
- The docstring says “gap times remain nonexistent”, but
datetime_to_timestampalways returns an integer timestamp (and the new tests assert a specific timestamp for a known DST-gap local time). This wording is misleading—nonexistent local times are being resolved to some offset perzoneinfobehavior.
openmetadata-airflow-apis/openmetadata_managed_apis/utils/parser.py:64 - Docstring param name is out of sync with the function signature:
_parse_inner_connectiontakesconnection_dict, but the docstring still documentsconfig_dict, which makes the docs misleading.
- Files reviewed: 18/18 changed files
- Comments generated: 0 new
- Review effort level: Lite
Code Review ✅ Approved 1 resolved / 1 findingsAddresses ingestion code-scanning findings by clarifying intentional behavior, preventing configuration and exception details from being exposed, and migrating time utilities to zoneinfo. HTTPStatus exception handling in the global error handler has been fixed, and regression coverage added. ✅ 1 resolved✅ Edge Case: HTTPStatus(exc.code) can raise inside global error handler
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|





Addresses a small set of ingestion code-scanning findings by clarifying intentional behavior, preventing configuration and exception details from being exposed, and migrating time utilities to zoneinfo. Adds focused regression coverage.