Skip to content

Making id and name length configrable so that id and name can be set larger than 128 and 256 respectively#200

Merged
jakhani merged 11 commits intomainfrom
id-config
Apr 7, 2026
Merged

Making id and name length configrable so that id and name can be set larger than 128 and 256 respectively#200
jakhani merged 11 commits intomainfrom
id-config

Conversation

@jakhani
Copy link
Copy Markdown
Collaborator

@jakhani jakhani commented Mar 31, 2026

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes (Please run ./gradlew build --write-locks to refresh dependencies)
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Describe the new behavior from this PR, and why it's needed

Maestro's ID and name length limits (128 and 256 respectively) are currently compile-time constants. This PR makes them configurable at runtime via application config, with defaults that preserve existing behavior for all deployments that do not explicitly override them.

Motivation: Some workflows migrated from Airflow have DAG IDs up to 226 characters and task IDs up to 249 characters. The database already supports larger sizes; only the application validation layer needs updating.

No default behavior change: If maestro.maestro-id-name-validation is not set in config, limits default to exactly the same values as before (128 for IDs, 256 for names). Existing deployments are unaffected.

Changes in this PR

maestro-common

  • Added MaestroIdNameValidationLimits interface (in com.netflix.maestro.utils) exposing getIdLengthLimit() and getNameLengthLimit(). Includes a DEFAULTS constant (backed by Constants) used as a fallback when the interface is not injected (e.g. unit tests without Spring).
  • Added MaestroNameSizeConstraint — a null-safe, length-only annotation that replaces @Size(max = Constants.NAME_LENGTH_LIMIT) on optional name fields (Workflow.name, AbstractStep.name) where the limit must be configurable at runtime.
  • Updated MaestroIdConstraint, MaestroNameConstraint, MaestroReferenceIdConstraint, and MaestroNameSizeConstraint to inject MaestroIdNameValidationLimits via @Inject (same pattern as AlertingValidator in PropertiesConstraint). Each validator falls back to MaestroIdNameValidationLimits.DEFAULTS when not injected.

maestro-server

  • Added MaestroIdNameValidationProperties — Spring @ConfigurationProperties bound under maestro.maestro-id-name-validation.*, implementing MaestroIdNameValidationLimits. Field-level defaults match Constants, so any unconfigured limit automatically retains its original value independently (e.g. configuring only id-length-limit leaves name-length-limit at 256).
  • Added MaestroIdNameValidationConfiguration — exposes MaestroIdNameValidationProperties as a MaestroIdNameValidationLimits Spring @Bean so validators can inject it.
  • Wired MaestroIdNameValidationProperties into MaestroProperties.

Tests

  • Added MaestroIdNameValidationLimitsTest covering each constraint (MaestroIdConstraint, MaestroNameConstraint, MaestroReferenceIdConstraint, MaestroNameSizeConstraint) with a custom ConstraintValidatorFactory that injects arbitrary MaestroIdNameValidationLimits via reflection on @Inject fields — no Spring context required.
  • Updated MaestroIdConstraintTest, MaestroNameConstraintTest, MaestroReferenceIdConstraintTest to reference Constants directly instead of the old static holder.

Testing done:
Unit tests are passing.
Verified in local Maestro server by setting id and name limit to 200 and creating a dag with smaller and larger length than that.

┌───────────────────────────┬──────────────┬─────────────────────────────────────────────────────────────────┐
│           Test            │    Input     │                             Result                              │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Dag ID = 128 chars        │ at old limit │ ✅ PASS                                                         │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Dag ID = 200 chars        │ at new limit │ ✅ PASS                                                         │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Dag ID = 201 chars        │ over limit   │ ✅ FAIL with "id length limit 200 - rejected length is [201]"   │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Dag name = 200 chars      │ at new limit │ ✅ PASS                                                         │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Dag name = 201 chars      │ over limit   │ ✅ FAIL with "name length limit 200 - rejected length is [201]" │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Step ID = 200 chars       │ at new limit │ ✅ PASS                                                         │
├───────────────────────────┼──────────────┼─────────────────────────────────────────────────────────────────┤
│ Step ID = 201 chars       │ over limit   │ ✅ FAIL with "id length limit 200 - rejected length is [201]"   │
└───────────────────────────┴──────────────┴─────────────────────────────────────────────────────────────────┘

Note: The limit is fully configurable via maestro.maestro-id-name-validation.id-length-limit and maestro.maestro-id-name-validation.name-length-limit in application.yml, with no code changes required.

Comment thread maestro-common/src/main/java/com/netflix/maestro/models/ValidationLimits.java Outdated
Comment thread maestro-server/src/main/resources/application.yml Outdated
Janki Akhani added 4 commits April 1, 2026 13:29
…eck. Size check is applicable for Workflow and Abstract Step name. While pattern check is for Tag.name, SignalCreateRequest.name and SignalInstance.name
import com.netflix.maestro.models.Constants;

/** Interface exposing configurable validation limits used by constraint validators. */
public interface ValidationLimits {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

May be MaestroNameIdValidationLimits or MaestroNameIdValidationConfigs

Janki Akhani and others added 4 commits April 6, 2026 14:28
…ttern check. Size check is applicable for Workflow and Abstract Step name. While pattern check is for Tag.name, SignalCreateRequest.name and SignalInstance.name"

This reverts commit c360a81.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@praneethy91 praneethy91 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for making the changes!

Copy link
Copy Markdown
Collaborator

@rdeepak2002 rdeepak2002 left a comment

Choose a reason for hiding this comment

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

Latest changes lgtm and are well-tested, thanks!

@jakhani jakhani merged commit 3e124f1 into main Apr 7, 2026
2 checks passed
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.

4 participants