You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "abolfazlmadanii (via GitHub)" <gi...@apache.org> on 2026/08/15 07:58:17 UTC

[PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

abolfazlmadanii opened a new pull request, #11817:
URL: https://github.com/apache/seatunnel/pull/11817

   ### Purpose of this pull request
   
   Part of #11007.
   
   This PR completes the Email sink declarative option rule by:
   
   - declaring the SMTP port, attachment name, and field delimiter options;
   - validating that email_smtp_port is greater than zero with Conditions.greaterThan;
   - adding focused tests for valid, default, zero, and negative SMTP port values;
   - documenting the SMTP port constraint in English and Chinese.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Invalid non-positive email_smtp_port values are now rejected during option validation. The default value and valid configurations remain unchanged.
   
   ### How was this patch tested?
   
   - ./mvnw -pl seatunnel-connectors-v2/connector-email test
   - ./mvnw spotless:apply
   - ./mvnw -q -DskipTests verify
   
   The connector-email tests passed with 5 tests and no failures. The full ./mvnw test command was also attempted, but the reactor stopped in the unrelated seatunnel-config-shade module because shaded ConfigFactory classes were unavailable in its test classpath.
   
   ### Check list
   
   * [x] No new Jar binary package is added.
   * [x] English and Chinese Email connector documentation is updated.
   * [x] No incompatible-change entry is required; valid configurations and defaults are unchanged.
   * [x] Existing connector packaging, mapping, labels, and E2E wiring are unchanged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "abolfazlmadanii (via GitHub)" <gi...@apache.org>.
abolfazlmadanii commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5301405599

   After reviewing the connector again, I think a more conservative approach would be to first confirm the intended scope with the maintainers, or limit this PR to registering the missing options in `OptionRule`. The Email connector does not currently have an imperative SMTP-port validation to migrate, so the `email_smtp_port > 0` rule adds new validation behavior. Would you prefer that this PR keep the new constraint, or only add the missing options to `OptionRule`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "abolfazlmadanii (via GitHub)" <gi...@apache.org>.
abolfazlmadanii commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5305674570

   @goutamadwant Thanks for catching this. I addressed the unknown-key coverage gap in commit `188bd0c10`.
   
   The shared `EmailFactoryTest` validation helper now calls `ConfigValidator.validateUnknownKeys()` before `ConfigValidator.validate()`. Since `testExplicitOptionalOptions` explicitly configures `email_smtp_port`, `email_attachment_name`, and `email_field_delimiter`, removing any of those declarations from `OptionRule` will now fail the test and directly protect the CLI validation path that this PR fixes.
   
   Verification passed:
   
   - `./mvnw spotless:apply`
   - `./mvnw -pl seatunnel-connectors-v2/connector-email -DskipITs test` — 6 tests, 0 failures, 0 errors
   - `./mvnw -q -DskipTests verify`
   
   @DanielLeens, this also closes the remaining test-coverage item from your status summary. Could you please take another look when convenient?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5307503535

   Thanks for your contribution! This is a solid addition to the project, and your attention to detail really shows. Contributors like you are what keep this community moving forward. Feel free to keep the PRs coming — we're always glad to have you here!
   
   Please ignore the following message if you have joined in the Slack~
   ```
   To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace.
   Slack workspace link: https://s.apache.org/seatunnel-slack
   
   This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join 😄
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "abolfazlmadanii (via GitHub)" <gi...@apache.org>.
abolfazlmadanii commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5302059718

   Thanks for the detailed review and for verifying the behavior against the full source.
   I agree that the current title is not fully accurate, since the SMTP port constraint introduces new validation rather than migrating an existing check.
   Since the scope question is still open, I’ll hold off on changing or extending the port constraint until a maintainer confirms whether it should be included in this PR. If it is kept, I can update the title and description accordingly and address the suggested range validation, comment, and additional default-value test.
   The main CI workflow currently requires maintainer approval before it can run.
   Thanks again for the thorough review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5302442595

   @abolfazlmadanii The option registration fix looks correct. I reproduced the original path with ConfigValidator.validateUnknownKeys(): without EMAIL_ATTACHMENT_NAME and EMAIL_FIELD_DELIMITER in OptionRule it fails with both reported as unknown keys, and with this change it passes.
   
   One test gap: EmailFactoryTest currently calls only ConfigValidator.validate(), which does not check unknown keys. The existing 5 tests still pass even if those two option declarations are removed.
   
   Could we update the test helper to run validateUnknownKeys() before validate()? That would directly cover the CLI validation failure this PR fixes and prevent the declarations from being removed accidentally later.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5307277170

   <img width="1466" height="844" alt="image" src="https://github.com/user-attachments/assets/b34cb22d-8e7f-42b6-bca8-06ea4eb1cf08" />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "abolfazlmadanii (via GitHub)" <gi...@apache.org>.
abolfazlmadanii commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5305615760

   Thanks for the detailed review. I pushed commit `e9af64892` addressing the recommended changes:
   
   - validate the complete SMTP port range (`1..65535`);
   - add an inline comment explaining the fail-fast validation;
   - cover omitted optional options and their existing defaults;
   - cover explicitly configured optional options;
   - update the English and Chinese documentation to match the full port range.
   
   Local verification passed:
   
   - `./mvnw spotless:apply`
   - `./mvnw -pl seatunnel-connectors-v2/connector-email -DskipITs test` — 6 tests, 0 failures, 0 errors
   - `./mvnw -q -DskipTests verify`
   
   I have also updated the PR description to clarify that the SMTP port constraint is new fail-fast validation rather than a migration of an existing imperative check. Invalid port values previously failed later during email delivery. Could a maintainer please confirm whether keeping this validation in the scope of this PR is acceptable?
   
   @DanielLeens, could you please take another look at the updated changes?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5304921369

   Thanks both for the follow-up — this is exactly the kind of back-and-forth that makes a PR better.
   
   @abolfazlmadanii, holding off on extending the port-range validation until a maintainer confirms scope is the right call, and I agree the title should describe what the diff actually does (adds a new SMTP-port constraint plus registers the two missing options) rather than "migrate," since "migrate" implies a pre-existing check just moved location, and for `email_smtp_port` there wasn't one. That's a small, easy fix once scope is settled — no need to block on it separately.
   
   @goutamadwant, good catch on the test gap, and I can confirm it from the same angle: `EmailFactoryTest` only exercises `ConfigValidator.validate()`, which checks declared constraints (`Conditions`, ranges, etc.) but not "does the schema even know about this key" — that's `validateUnknownKeys()`'s job, and it's wired into the real CLI path (`ConfigValidationUtils`/`SeaTunnelConfValidateCommand`) but not into this test. So today the test suite would stay green even if `EMAIL_ATTACHMENT_NAME`/`EMAIL_FIELD_DELIMITER` were removed from `optionRule()` again in some future change — which is precisely the class of regression this PR is fixing. Adding a `validateUnknownKeys()` call (or a small helper that runs both) to `EmailFactoryTest` would turn that from "fixed by inspection" into "protected by a test," and I'd treat that as effectively closing my own default-value-test suggestion from the original review too, since a well-placed `validateUnknownKeys()` assertion covering all three
  options is more direct than testing each option's default individually.
   
   Current status, to keep this from going in circles: the open items are (1) the scope question on the SMTP-port range/comment work — waiting on a maintainer, (2) the title/description update once scope is settled, and (3) the `validateUnknownKeys()` test-coverage gap @goutamadwant raised. Nothing here changes my read that the core option-registration fix is correct and the root cause you found is real — happy to take another look as soon as you've had a chance to act on whichever of these lands first.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Migrate email validation to declarative OptionRule [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #11817:
URL: https://github.com/apache/seatunnel/pull/11817#issuecomment-5307265713

   Good job.
   
   +1 if CI passes.
   LGTM
   
   
   Thanks a lot for your valuable contribution to Apache SeaTunnel!
   
   To pass the automated CI checks for this PR, could you please enable CI workflows in your forked repository first? You can refer to the check run link below as a reference for the required CI configuration  https://github.com/apache/seatunnel/pull/11817/checks?check_run_id=95113893719
   
   If you run into any trouble enabling CI or encounter related errors during the process, feel free to leave a comment here. Contributors are always ready to offer help~
   
   <img width="2412" height="1472" alt="image" src="https://github.com/user-attachments/assets/6abd2ea1-da45-4d78-a81c-0158f2d7a851" />


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org