Skip to content

feat(branches): optional environment list on branch create (DX-31560) - #195

Merged
cs-raj merged 4 commits into
developmentfrom
epic/DX-31560-branch-create-environments
Oct 28, 2026
Merged

cs-raj merged 4 commits into
developmentfrom
epic/DX-31560-branch-create-environments

Conversation

@cs-raj

@cs-raj cs-raj commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

🤖 Opened by deveco-dev (Claude). Review and merge stay with a person (MERGE=denied for this PR).

Changes: Branch create documents and passes through the API's publish_config.environments (all by default, none, or a list). Omitted list leaves the request body unchanged; the 422 is returned as is. Epic DX-31560 (PR #194 merged into this branch). Version 1.12.0.

Testing Plan: 6 new BranchCreateEnvironmentsUnitTests pass. The legacy tests/unit setUp logs in live, so 286 other tests fail in the sandbox (proxy 403); not compared to a baseline run. No new pylint warnings in branches.py. Live tests not run; QA story DX-31568.

Known Gaps:

  • Legacy unit suite not judged clean here (network).
  • skills/contentstack-management/SKILL.md may need a branch-create note.

Merge order: independent of the other three SDK PRs.


Generated by Claude Code

claude and others added 2 commits October 28, 2026 11:04
Branch create accepts an optional branch.publish_config.environments list of environment
names so a caller can clone only the environments it needs. An empty list clones none.
Omitting publish_config sends the same body as before and clones all environments. The
SDK passes the list through unvalidated and adds no length limit; an unknown name or a
mix returns the API's 422 response unchanged and no branch is created.

Documents the field and its three behaviors in the create docstring with an example.
Adds mocked unit tests for the posted body (two names, [], duplicates, a 150-name list,
mixed case, omitted, publish_config {}) and for a 422 returned unchanged, plus sanity
integration tests for create with two names, [], an unknown name and a mix (not run
here). Bumps the minor version to 1.12.0 and adds a changelog entry.

Refs: DX-31563

Co-authored-by: Raj Pandey <raj.pandey@contentstack.com>
Co-authored-by: Reeshika Hosmani <reeshika.hosmani@contentstack.com>
Co-authored-by: Aniket Shikhare <aniket.shikhare@contentstack.com>
Co-authored-by: Claude <noreply@anthropic.com>
…nch-create-environments

feat(branches): add optional environments list to branch create (DX-31563)
@snyk-io

snyk-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 2 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 2
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@cs-raj
cs-raj marked this pull request as ready for review October 28, 2026 12:28
@cs-raj
cs-raj requested a review from a team as a code owner October 28, 2026 12:28
claude and others added 2 commits October 28, 2026 13:26
The live cases added for publish_config.environments failed on dev11:
generate_valid_uid("branch_env") gives 16 characters (the API caps branch
uids at 15), and a fetch of a branch that does not exist returns 422
(error_code 905), not 404. Use a shorter prefix and compare a rejected
create's fetch with the response for a nonexistent branch (TC-16/TC-17).

Also, per the test cases page: create three class environments so two is
a strict subset (TC-13), add the one-name, no-list (TC-15) and
case-variant cases, and delete every branch and environment created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XifDUYYvn7GfSpLcKarg5S
…e-branch-envs

test(branches): fix live environment-list cases for dev11 (DX-31568)
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 2 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 2
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

cs-raj commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

The coverage check failed on 68736ad: 2 of 452 unit tests failed, test_label_unit.py::test_get_all_label and test_publish_queue_unit.py::test_get_a_publish_queue. Both hit api.contentstack.io live and got ReadTimeout (read timeout=2). Neither test nor the code it covers is touched by this PR (docstring plus the new BranchCreateEnvironmentsUnitTests, which pass), so this looks like a network flake in the legacy live-calling unit tests, not this change. No fix to port. Re-running the failed job once now.


Generated by Claude Code

cs-raj commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

The re-run of coverage also failed, on a different test: test_label_unit.py::test_create (ReadTimeout, 2s, api.contentstack.io; 451 of 452 passed). The first run failed on two other tests with the same error, so the failing test changes each run. The cause is legacy unit tests that call the live API with a 2-second timeout; none of them are touched by this PR. I'm not changing unrelated tests here. Options for a person: re-run the job again, or open a separate ticket to mock the live calls in tests/unit. The new BranchCreateEnvironmentsUnitTests pass in both runs.


Generated by Claude Code

@cs-raj
cs-raj merged commit 2506a62 into development Oct 28, 2026
9 of 11 checks passed
@cs-raj
cs-raj deleted the epic/DX-31560-branch-create-environments branch October 28, 2026 14:48
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.

3 participants