Skip to content

feat(core): add validationOnly mode to prevent change execution#880

Open
bercianor wants to merge 8 commits intomasterfrom
feat/validation-only-flag
Open

feat(core): add validationOnly mode to prevent change execution#880
bercianor wants to merge 8 commits intomasterfrom
feat/validation-only-flag

Conversation

@bercianor
Copy link
Copy Markdown
Contributor

@bercianor bercianor commented Mar 24, 2026

Summary

  • Adds a validationOnly flag that makes Flamingock verify pending changes without executing them — throws PendingChangesException if any are found, continues normally if everything is up to date
  • Designed for production safety patterns (e.g. Spring Boot profiles where validation-only: true in prod prevents accidental change execution)

Changes

New files

  • PendingChangesException — extends FlamingockException, carries pendingCount
  • ValidateOperation — mirrors ExecuteOperation loop but throws instead of applying; acquires lock for consistency guarantees

Modified files

  • CoreConfigurable / CoreConfigurationvalidationOnly flag (default false)
  • OperationFactory — routing override: EXECUTE_APPLY + isValidationOnly() → EXECUTE_VALIDATE; implements the pre-existing orphaned OperationType.EXECUTE_VALIDATE
  • AbstractChangeRunnerBuilder — fluent setValidationOnly(boolean)
  • SpringbootProperties — delegates flamingock.validation-only to coreConfiguration

Usage

Java:

Flamingock.builder()
    .setValidationOnly(true)
    .build()
    .run();

Spring Boot YAML:

flamingock:
  validation-only: true

Behaviour

  • No pending changes → continues normally, result NO_CHANGES
  • Pending changes found → throws PendingChangesException: "Flamingock validationOnly=true: N pending change(s) detected"
  • Lock is always acquired — validation is consistent (another instance cannot execute changes concurrently while this one validates)

Testing

  • PendingChangesExceptionTest — count, message, type hierarchy (5 tests)
  • ValidateOperationTest — no pending → success; pending → exception (3 tests)
  • OperationFactoryTest — routing to ValidateOperation when flag is active (2 tests)
  • Spring Boot end-to-end integration test (2 tests)

@bercianor bercianor force-pushed the feat/validation-only-flag branch from 87d1064 to 376b063 Compare March 26, 2026 16:29
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.

2 participants