Skip to content

Enhance address space handling to accept numeric CIDR masks - #4734

Merged
Jay W (JayDoubleu) merged 75 commits into
mainfrom
jc-wk/address-space-size-cidr
Oct 6, 2026
Merged

Jay W (JayDoubleu) merged 75 commits into
mainfrom
jc-wk/address-space-size-cidr

Conversation

@JC-wk

@JC-wk James Chapman (JC-wk) commented Oct 27, 2025 •

Copy link
Copy Markdown
Collaborator

Resolves #4733

What is being addressed

Currently IP ranges are allocated based on t-shirt sizing s/m/l this introduces CIDR ranges to allow more granular subnet allocation

How is this addressed

  • Accepts cidr values as strings from "16" to "29" for subnet creation
  • Updates documentation
  • Updates CHANGELOG.md
  • Updates API version
  • Adds Tests

@github-actions

github-actions Bot commented Oct 27, 2025 •

Copy link
Copy Markdown

Unit Test Results

892 tests   892 ✅  11s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit bfb3d01.

♻️ This comment has been updated with latest results.

@JC-wk

Copy link
Copy Markdown
Collaborator Author

I've tested allocating a /27 and that worked in my environment

image

@JC-wk
James Chapman (JC-wk) marked this pull request as ready for review October 28, 2025 19:39
@JC-wk
James Chapman (JC-wk) requested a review from a team as a code owner October 28, 2025 19:39
Copilot AI balanced review requested due to automatic review settings May 22, 2026 13:39

Copilot AI 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

Adds support in the API for requesting auto-assigned address spaces using numeric CIDR prefix lengths (as strings), extending beyond the existing small/medium/large presets while keeping backwards compatibility.

Changes:

  • Extend address space allocation logic to accept numeric CIDR masks (string values) and validate allowed ranges.
  • Add repository tests for numeric CIDR prefix requests.
  • Update workspace authoring documentation and the project changelog to describe the new behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/tre-workspace-authors/authoring-workspace-templates.md Documents numeric CIDR mask support for address_space_size when requesting additional address spaces.
CHANGELOG.md Records the enhancement in the unreleased changelog.
api_app/tests_ma/test_db/test_repositories/test_workpaces_repository.py Adds tests covering successful numeric CIDR prefix requests.
api_app/models/schemas/workspace_template.py Updates sample schema description text to mention numeric CIDR masks.
api_app/db/repositories/workspaces.py Implements numeric CIDR prefix parsing/validation and routes it into new CIDR allocation.

Comment thread api_app/db/repositories/workspaces.py Resolved
Comment thread api_app/db/repositories/workspaces.py Resolved
Copilot AI review requested due to automatic review settings September 16, 2026 17:29

Copilot AI 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.

🟢 Approval recommended

Numeric mask handling, validation, schemas, documentation, versions, and tests are consistent with the stated scope.

Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Comment thread api_app/api/routes/workspaces.py Resolved
@ChrisChapman-gh

Copy link
Copy Markdown
Collaborator

James Chapman (@JC-wk) - Could you update the api version - Ta

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The base bundle uses an incorrect patch bump, and the airlock-import-review bundle is not versioned for its schema change.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
Resolved since last review (1)

Comment thread templates/workspaces/base/porter.yaml Resolved

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Bundled address-space-consuming workspace services still do not expose address_space_size, preventing validated requests from selecting smaller service subnets.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Bundled AML and Databricks schemas still do not expose the new service mask setting, and the changelog omits the bumped component versions.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

Comment thread CHANGELOG.md Resolved
@JayDoubleu

Copy link
Copy Markdown
Collaborator

/test-extended 0908820

@JayDoubleu

Copy link
Copy Markdown
Collaborator

This PR adds numeric CIDR allocation, but it does not fully implement #3431.

Verified against commit 0908820e4ac405d2829e8963cd3b92ecae15e109:

  • The base, unrestricted and airlock-import-review workspace schemas offer numeric selections from /16 to /24. They do not expose the smaller workspace size requested in Smallest workspace address space #3431.
  • The bundled Azure ML, Databricks and OHDSI service schemas do not define address_space_size. Passing "27" to their production schema validation is rejected with Unevaluated properties are not allowed ('address_space_size' was unexpected), before the allocator runs.
  • The allocator supports /16 to /29 for service templates that explicitly expose the property, as described in the template-author documentation.

The smaller workspace and bundled service support should remain follow-up work under #3431. I am removing its closing reference from this PR description, while retaining the reference to #4733 for numeric CIDR allocation.

Local validation passed: 892 API tests, changed-file Python lint, the three workspace schemas, and allocation checks for all masks from /16 to /29. Extended validation has been requested for this commit. The existing extended tests use small, so they provide provisioning regression coverage but do not establish live numeric-CIDR behaviour.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/37499885128

(in response to this comment from Jay W (@JayDoubleu))

@JayDoubleu

Copy link
Copy Markdown
Collaborator

/test-force-approve

The changelog-only update in 2d9319a7 created a new PR head that needs the required smoke-check status. It only adds the component versions to the changelog; the implementation is unchanged from 0908820e.

The extended validation run for 0908820e is still running: https://github.com/microsoft/AzureTRE/actions/runs/37499885128

I will merge this PR into main only after the extended tests pass. This command waives the required check on the changelog commit; it does not mean that the extended tests have passed.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

🤖 pr-bot 🤖

✅ Marking tests as complete (for commit 2d9319a)

(in response to this comment from Jay W (@JayDoubleu))

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

Unbounded decimal conversion can return HTTP 500 for malformed input.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Reject overlong decimal input before integer conversion

api_app/​db/​repositories/​workspaces.py:233

isdecimal() does not bound the input length. In the Python 3.12 API runtime, a string containing more than 4,300 decimal digits passes this check but int(address_space_size) raises ValueError; for workspace-service allocation this occurs outside the route's ValueError handler, so malformed input returns a 500 instead of the intended 422. Reject overlong numeric strings before conversion (or match the explicit allowed strings).

@JayDoubleu

Copy link
Copy Markdown
Collaborator

/test-force-approve

I merged the latest main into this PR again, creating head bfb3d01f, which needs the required smoke-check status.

The extended validation run for 0908820e completed successfully:

  • Extended tests: 3 passed.
  • Smoke tests: 23 passed.
  • Overall workflow: successful.

Run: https://github.com/microsoft/AzureTRE/actions/runs/37499885128

The changes since that tested commit are the changelog version details and the latest merge from main. This command waives the required check on the new merge commit; the passing test results above apply to 0908820e.

We also removed Resolves #3431 from the PR description because smaller workspace sizing and CIDR selectors in the bundled workspace services remain follow-up work. Resolves #4733 is retained for the numeric CIDR allocation capability.

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The implementation, validation, documentation, versioning, and automated tests consistently cover the intended behavior.

Review effort: Balanced
Findings: None

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

🤖 pr-bot 🤖

✅ Marking tests as complete (for commit bfb3d01)

(in response to this comment from Jay W (@JayDoubleu))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Update address_space_size property to allow cidr subnets

8 participants