Skip to content

fix(bundle): use --source-code-path for apps deploy - #50

Merged
Anthony Johnson II (AJ-EthereaLogic-ai) merged 4 commits into
mainfrom
bug/39-app-deploy-source-code-path
May 6, 2026
Merged

fix(bundle): use --source-code-path for apps deploy#50
Anthony Johnson II (AJ-EthereaLogic-ai) merged 4 commits into
mainfrom
bug/39-app-deploy-source-code-path

Conversation

@AJ-EthereaLogic-ai

Copy link
Copy Markdown
Member

Summary

  • Replace removed --target/--var flags on databricks apps deploy with apps deploy <name> --source-code-path <path>
  • Auto-generate an app.yml at the workspace source-code-path with command: and env entries resolved against value_from resource references and bundle variables
  • New spec specs/DS-PATCH-038_app_deploy_source_code_path.md; traceability matrix bumped to v1.6
  • Documentation updated in README.md and docs/deployment_guide.md

Closes #39.

Test plan

  • make lint (uv run ruff check .) — clean
  • make typecheck (uv run mypy src/driftsentinel tests) — 60 source files, no issues
  • make test — 503 passed
  • 12 new tests under tests/test_app.py::TestDeployScriptCommandShape, TestDeployScriptAppYamlGeneration, TestDeployScriptResourceResolution cover command shape, env resolution, and resource lookup edge cases
  • Manual smoke test on Databricks Free Edition: make app-deploy CATALOG=<C> PROFILE=<P> reaches apps get state=RUNNING and active_deployment.status.state=SUCCEEDED (post-merge, per DS-PATCH-038 §6.3)

🤖 Generated with Claude Code

Databricks CLI v0.295.0+ removed --target/--var from `apps deploy`.
DS-PATCH-038 resolves the workspace source path from `bundle summary`,
auto-generates an `app.yml` with env entries resolved against
`value_from` references and bundle variables, and invokes
`apps deploy <name> --source-code-path <path>`. Closes #39.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Not up to standards ⛔

🔴 Issues 1 medium

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Complexity 1 medium

View in Codacy

🟢 Metrics 103 complexity · 0 duplication

Metric Results
Complexity 103
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread scripts/deploy_databricks_app.py Fixed

@codacy-production codacy-production Bot 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

The PR successfully implements the transition to --source-code-path for Databricks CLI v0.295.0+, but it is not currently up to standards. While the functional logic for app.yml generation is present, the script scripts/deploy_databricks_app.py has reached a high level of cyclomatic complexity (CCN 29) without adequate test coverage. A major discrepancy was found: the documentation updates (docs/deployment_guide.md and the Traceability Matrix v1.6) required by the acceptance criteria are completely missing from the PR. Furthermore, a high-severity type-safety issue and a medium-severity logic flaw in command string handling must be addressed before merging.

About this PR

  • The required updates to docs/deployment_guide.md and the Traceability Matrix (v1.6) are missing from this change set. These are necessary to fulfill the PR requirements.
  • The deployment script has significantly increased in complexity without a corresponding increase in automated test coverage, posing a high risk for future regressions.

Test suggestions

  • Verify databricks apps deploy command construction omits bundle flags and includes source-code-path.
  • Verify app.yml generation resolves Volume paths from concrete securable names.
  • Verify app.yml generation falls back to bundle variables for Volume path resolution when securable names contain references.
  • Verify app.yml generation resolves Job IDs from resource references in the bundle summary.
  • Verify app.yml generation preserves literal environment variable values.
  • Verify app.yml generation returns None (skipping upload) when no command is specified in the app config.
  • Verify unrecognized resource references resolve to an empty string in environment variables (fail-soft).
  • Increase unit test coverage for complex resource resolution logic in scripts/deploy_databricks_app.py to mitigate complexity risks.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Increase unit test coverage for complex resource resolution logic in `scripts/deploy_databricks_app.py` to mitigate complexity risks.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread scripts/deploy_databricks_app.py Outdated
return 0

deploy_cmd = ["databricks", "apps", "deploy", *bundle_args]
app_yaml = _build_app_yaml_content(summary, args.app_key)

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.

🔴 HIGH RISK

The summary variable needs to be explicitly narrowed to a dictionary type (e.g., using an assertion) to satisfy type checkers and improve safety before it is passed to _build_app_yaml_content.

See Issue in Codacy

return ["-p", profile] if profile else []


def _resolve_app_resource_values(summary: dict[str, Any], app_key: str) -> dict[str, str]:

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.

🟡 MEDIUM RISK

This function is becoming difficult to maintain due to its high cyclomatic complexity. Consider refactoring the resolution logic for Volumes and Jobs into dedicated helper functions like _resolve_volume_resource and _resolve_job_resource.

See Issue in Codacy
See Complexity in Codacy

Comment thread scripts/deploy_databricks_app.py Outdated
env_out.append({"name": name, "value": ""})

return yaml.safe_dump(
{"command": list(command), "env": env_out},

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.

🟡 MEDIUM RISK

Suggestion: Ensure 'command' is handled correctly if it arrives as a string to avoid character-level splitting in the generated app.yml.

Suggested change
{"command": list(command), "env": env_out},
{"command": [command] if isinstance(command, str) else list(command), "env": env_out},

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75e71422d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread scripts/deploy_databricks_app.py Outdated
apps = summary.get("resources", {}).get("apps", {}) or {}
app = apps.get(app_key) or {}
config = app.get("config") or {}
app_resources = config.get("resources") or []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read app resource bindings from top-level app node

This resolver pulls bindings from config.resources, but the bundle app definition keeps resources at the app root (see resources/driftsentinel_app.yml, where resources is a sibling of config). If bundle summary preserves that schema, app_resources is always empty here, so _build_app_yaml_content resolves every value_from entry (including RUNTIME_VOLUME_PATH and DATASET_PIPELINE_JOB_ID) to "", yielding an app.yml that deploys with missing runtime wiring.

Useful? React with 👍 / 👎.

@AJ-EthereaLogic-ai
Anthony Johnson II (AJ-EthereaLogic-ai) merged commit aa94cc5 into main May 6, 2026
9 of 10 checks passed
@AJ-EthereaLogic-ai
Anthony Johnson II (AJ-EthereaLogic-ai) deleted the bug/39-app-deploy-source-code-path branch May 6, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix make app-deploy script — newer Databricks CLI rejects --target/--var on apps deploy

1 participant