erica1111-prog commented on PR #13049:
URL: https://github.com/apache/seatunnel/pull/13049#issuecomment-7061732027

   > Thanks for the update and the exact commit/test details! The new direct 
missing-password test now exercises the line added by this PR, and the fork 
Build is successful. I re-reviewed the complete diff; one small test-quality 
item remains: the new positive case does not yet demonstrate the measurement 
fallback described in the reply. Your reported local test run is author 
evidence, not a run performed by me.
   > 
   > # What problem does this PR solve?
   > **User pain:** a direct InfluxDBSinkFactory caller can bypass the declared 
URL/database and credential-pair rule.
   > 
   > **Fix:** validate that existing rule at the factory entry before 
measurement fallback and SinkConfig creation.
   > 
   > **In one sentence:** direct callers receive the same named configuration 
rejection as normal engine callers. Example: username without password now 
fails with OptionValidationException before a sink is prepared.
   > 
   > # 1. Code changes
   > ## 1.1 Core logic
   > **Complete runtime path:**
   > 
   > ```
   > Normal engine: plugin discovery -> FactoryUtil.createAndPrepareSink -> 
OptionRule -> InfluxDBSinkFactory.createSink (:70)
   > Direct caller: TableSinkFactoryContext -> createSink -> new 
ConfigValidator check (:74)
   >  -> existing catalog-derived measurement fallback (:76-81) -> SinkConfig 
(:83)
   >  -> TableSink supplier -> InfluxDBSink -> writer/flush/checkpoint 
(unchanged)
   > ```
   > 
   > **Key findings and correctness:**
   > 
   > * I re-read the entire two-file diff and both construction paths. The 
changed line is reached for every factory call; normal engine callers validate 
twice, while direct callers gain their first rule check.
   > * The new testCreateSinkValidationFailed directly invokes the production 
boundary, so removing the added validation would make this regression fail. 
That closes the main negative-path part of the previous finding.
   > * The newly added positive test still does not verify the measurement 
fallback it claims to cover (Issue 1). This is a focused remaining test-quality 
correction, not a newly discovered production bug.
   > * SinkFactory identity, optional measurement fallback, credential logging, 
writer/checkpoint behavior and dependencies remain unchanged.
   > 
   > **Before:**
   > 
   > ```
   > package org.apache.seatunnel.connectors.seatunnel.influxdb.sink;
   > 
   > import org.apache.seatunnel.api.configuration.ReadonlyConfig;
   > import org.apache.seatunnel.api.configuration.util.OptionRule;
   > import org.apache.seatunnel.api.options.SinkConnectorCommonOptions;
   > import org.apache.seatunnel.api.table.catalog.CatalogTable;
   > ```
   > 
   > **After:**
   > 
   > ```
   > package org.apache.seatunnel.connectors.seatunnel.influxdb.sink;
   > 
   > import org.apache.seatunnel.api.configuration.ReadonlyConfig;
   > import org.apache.seatunnel.api.configuration.util.ConfigValidator;
   > import org.apache.seatunnel.api.configuration.util.OptionRule;
   > import org.apache.seatunnel.api.options.SinkConnectorCommonOptions;
   > import org.apache.seatunnel.api.table.catalog.CatalogTable;
   > ```
   > 
   > ## 1.2 Compatibility
   > Fully compatible for valid jobs: same API/option names/defaults, protocol 
and saved state. Invalid direct calls now fail earlier with 
OptionValidationException by design. No historical successful writer behavior 
changes and no migration is needed.
   > 
   > ## 1.3 Performance and side effects
   > One extra OptionRule evaluation at factory construction; no per-row work, 
new network call, unbounded buffer, lock, retry or resource owner. Credential 
values are not logged by the added validation call.
   > 
   > ## 1.4 Errors, logging, and findings
   > **Issue 1: Make the positive factory case observe its claimed behavior**
   > 
   > * Location: 
`seatunnel-connectors-v2/connector-influxdb/src/test/java/org/apache/seatunnel/connectors/seatunnel/influxdb/InfluxDBFactoryTest.java:110`.
   > * Description and risk: The direct missing-password test now protects the 
new production line. However, this new positive test only asserts 
DoesNotThrow/non-null for factory.createSink(context); it never observes the 
derived measurement or instantiates the returned TableSink supplier. 
SinkConfig.java:68 accepts a null measurement, so deleting 
InfluxDBSinkFactory.java:76-81 would still return a nonnull lambda and this 
supposed fallback regression would stay green. This is the remaining 
positive-path part of the earlier coverage request.
   > * Best improvement: Keep the direct invalid-config regression. Either 
replace the positive existence-only assertion with an observable 
measurement/output assertion through an appropriate existing test seam, or 
remove that test and its unsupported fallback-coverage claim. Do not add 
reflection, a public accessor solely for a test, or a live-server dependency 
just to assert a lambda exists.
   > * Responsibility and trade-off: InfluxDBSinkFactory.createSink is the best 
boundary for direct callers, because shared FactoryUtil validation cannot 
protect code that bypasses it. Reusing the existing rule is the smallest 
complete production fix; do not change generic factory behavior or add 
connector-specific logic to shared code.
   > * Severity: Medium; blocking: true.
   > * Previously raised by another reviewer: No, unless explicitly attributed 
above.
   > 
   > Community input: no independent technical finding or maintainer 
approval/change request was present in the collected discussion.
   > 
   > # 2. Code quality
   > ## 2.1 Conventions
   > Reviewed all changed files for license, imports, naming, core-method and 
state-field comments. See the numbered findings for the required changes.
   > 
   > ## 2.2 Test coverage and stability
   > **Stability rating: Stable.** Stability: Stable. All added tests use fixed 
in-memory config/schema data; localhost:8086 is a config value, not an opened 
network port. No sleeps, async scheduling, static state or environment 
dependency is added. The negative direct-entry regression is meaningful; the 
positive case only observes a nonnull TableSink lambda, as Issue 1 explains. 
Current-head Build is successful. No local test was executed.
   > 
   > ## 2.3 Documentation
   > No user-facing option/default changes require bilingual reference edits. 
The author explicitly scopes this migration slice to the factory and its tests; 
normal engine E2E already enters through outer validation, so direct-call 
coverage is the relevant regression seam.
   > 
   > # 3. Architecture
   > ## 3.1 Change location
   > InfluxDBSinkFactory.createSink is the best boundary for direct callers, 
because shared FactoryUtil validation cannot protect code that bypasses it. 
Reusing the existing rule is the smallest complete production fix; do not 
change generic factory behavior or add connector-specific logic to shared code.
   > 
   > ## 3.2 Maintainability
   > Keep the behavior, lifecycle ownership, and failure contract together. 
InfluxDBSinkFactory.createSink is the best boundary for direct callers, because 
shared FactoryUtil validation cannot protect code that bypasses it. Reusing the 
existing rule is the smallest complete production fix; do not change generic 
factory behavior or add connector-specific logic to shared code.
   > 
   > ## 3.3 Extensibility
   > Prefer the existing component boundary and tests over unrelated shared 
abstractions.
   > 
   > ## 3.4 Upgrade impact
   > Fully compatible for valid jobs: same API/option names/defaults, protocol 
and saved state. Invalid direct calls now fail earlier with 
OptionValidationException by design. No historical successful writer behavior 
changes and no migration is needed.
   > 
   > # 4. Findings summary
   > **Completeness check:** All changed files and affected entry/failure paths 
were reviewed; configuration/serialization compatibility, test failure 
capability and stability, documentation/examples, change ownership, and current 
CI/conflict/review gates are covered above. No unreviewed source scope is 
claimed complete.
   > 
   > #  Finding Location        Severity
   > 1  Make the positive factory case observe its claimed behavior     
`seatunnel-connectors-v2/connector-influxdb/src/test/java/org/apache/seatunnel/connectors/seatunnel/influxdb/InfluxDBFactoryTest.java:110`
      Medium
   > # 5. Merge recommendation
   > **Merge after fixes**
   > 
   > **Blocking items:** Issues 1. Current-head CI and write-capable maintainer 
review remain independent requirements.
   > 
   > **Non-blocking suggestions:** None beyond the validation limits above.
   > 
   > Overall: the approach addresses a real path, but the listed blockers must 
be closed. Daniel has READ permission, so this COMMENT cannot dismiss 
historical requested changes or satisfy a write-capable maintainer approval 
gate.
   > 
   > **CI and repository state:** Signal pull request update: SUCCESS; Build: 
SUCCESS; 
[Build](https://github.com/erica1111-prog/seatunnel/actions/runs/44780907301): 
success. GitHub reports BLOCKED / REVIEW_REQUIRED.
   > 
   > **Verification:** Reviewed all changed files and the referenced call sites 
at `b41f3119cf5e8b5ed293a6715086bb131a374796` against merge base 
`35657a514ddd5437bf8e6e2f809fae1984c731a0`. `git diff --check` passed. I did 
not build, run tests, or execute SeaTunnel locally.
   > 
   > **Review time:** 2026-11-21T06:57:16.989151-05:00
   > 
   > **Local evidence:** `git fetch` obtained head 
`b41f3119cf5e8b5ed293a6715086bb131a374796`; `git merge-base` returned 
`35657a514ddd5437bf8e6e2f809fae1984c731a0`; `git diff --stat` reports 2 files 
changed, 112 insertions(+). `git show` and source searches were used for the 
entry points above. No local build, unit test, E2E, Docker run or service 
startup was executed.
   
   @DanielLeens Thanks for catching that! Updated 
`testCreateSinkWithDefaultMeasurementSuccess` in `InfluxDBFactoryTest` to 
instantiate the sink via `tableSink.createSink()` and explicitly assert that 
`SinkConfig#getMeasurement()` resolves to 
`catalogTable.getTableId().toTablePath().getFullName()` 
(`default.default_db.test_measurement`) when `measurement` is omitted.
   
   The updated commit is pushed and the fork `Build` workflow is triggered on 
the PR branch.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to