Skip to content

feat(QTDI-2862): add watch() attribute to @FixedSchema for dynamic schema refresh - #1256

Open
thboileau wants to merge 5 commits into
masterfrom
copilot/QTDI-2862_fixed-schema-watch
Open

feat(QTDI-2862): add watch() attribute to @FixedSchema for dynamic schema refresh#1256
thboileau wants to merge 5 commits into
masterfrom
copilot/QTDI-2862_fixed-schema-watch

Conversation

@thboileau

@thboileau thboileau commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Requirements

  • Any code change adding any logic MUST be tested through a unit test executed with the default build
  • Any API addition MUST be done with a documentation update if relevant

Why this PR is needed?

@FixedSchema currently provides no way to trigger a schema refresh when a related configuration parameter changes value. Snowflake works around this with a hardcoded special-case in Studio. QTDI-2862 generalises the mechanism: a new watch() attribute on @FixedSchema declares which configuration paths should trigger a re-discovery, removing the need for connector-specific hacks.

Jira ticket: QTDI-2862

What does this PR adds (design/code thoughts)?

component-apiFixedSchema.java

  • New String[] watch() default {}; attribute with Javadoc documenting the relative path syntax (same as @Updatable.parameters()).

component-runtime-managerComponentSchemaEnricher.java

  • New constant FIXED_SCHEMA_WATCH_META_PREFIX = "tcomp::ui::schema::fixed::watch".
  • When fixedSchema.watch().length > 0, emits the comma-separated path list under that key in the component metadata.

component-runtime-managerComponentSchemaEnricherTest.java

  • New test: @FixedSchema(value="discover", watch={"config/param"}) → key emitted.
  • Regression test: plain @FixedSchema without watch → key absent.

component-toolsFixedSchemaValidator.java

  • New validation: if watch() is non-empty and value() is empty → build-time error.

component-toolsFixedSchemaValidatorTest.java

  • Test covering the new validation error.

sample-parent/sample-features/fixed-schemaFixedSchemaInput.java

  • Added watch = {"configuration/someConfig"} to the sample to demonstrate the feature.

Build: mvn clean verify passes on all affected modules (component-api, component-runtime-manager, component-tools, sample-features/fixed-schema). Spotless applied.

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

…hema refresh

- Add String[] watch() attribute to @FixedSchema annotation in component-api
  to declare parameter paths that trigger schema refresh at design time.
- Emit 'tcomp::ui::schema::fixed::watch' metadata key in ComponentSchemaEnricher
  when watch() is non-empty (comma-joined paths, mirrors FIXED_SCHEMA_FLOWS_META_PREFIX).
- Add FixedSchemaValidator check: watch() non-empty with empty value() is an error.
- Add unit tests for both ComponentSchemaEnricher and FixedSchemaValidator.
- Update fixed-schema sample to demonstrate the watch() attribute.
@thboileau

Copy link
Copy Markdown
Contributor Author

Scope & Design Review — QTDI-2862

# Severity File Description Resolution
1 MINOR ComponentSchemaEnricherTest.java fixedSchemaMetadataWithoutWatchDoesNotEmitWatchKey() was a complete duplicate of fixedSchemaMetadataNoFlowPresent() FIXED — removed redundant test
2 MINOR ComponentSchemaEnricher.java Constant FIXED_SCHEMA_WATCH_META_KEY used _KEY suffix inconsistent with existing _PREFIX peers FIXED — renamed to FIXED_SCHEMA_WATCH_META_PREFIX

Approval gate: APPROVED — no Blocker or Major findings. 2 Minors resolved.


Signed: Claude Sonnet 4.6

@thboileau

Copy link
Copy Markdown
Contributor Author

Compliance Report — QTDI-2862

Files reviewed: 7

File Findings
.gitignore None — pre-existing line
FixedSchema.java None
ComponentSchemaEnricher.java None
ComponentSchemaEnricherTest.java None
FixedSchemaValidator.java None
FixedSchemaValidatorTest.java None
FixedSchemaInput.java None

Verdict: COMPLIANT — 0 critical findings, 0 warnings.


Signed: Claude Sonnet 4.6

@thboileau
thboileau requested a review from undx July 28, 2026 08:27
"Annotation's value must match the name of a DiscoverSchema or a DiscoverSchemaExtended annotation. " +
"The related action will return the fixed schema for the specified flows.")
"The related action will return the fixed schema for the specified flows. " +
"Use watch() to declare parameter paths whose changes should trigger a schema refresh at design time.")

@thboileau thboileau Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks like that we need to update the documentation of the framework (cf "documentation" root directory of this repository)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 20da2fb3eb0 — added a "Watching parameters for schema refresh" subsection to documentation/src/main/antora/modules/ROOT/pages/studio-schema.adoc documenting the watch() attribute, with a code example mirroring the sample-features/fixed-schema usage.

thboileau and others added 2 commits July 28, 2026 14:18
Add a "Watching parameters for schema refresh" subsection to
studio-schema.adoc documenting the new @FixedSchema.watch()
attribute, mirroring the sample-features/fixed-schema usage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thboileau

Copy link
Copy Markdown
Contributor Author

Review round 1 — summary

Comment Class Action
#1 — component-runtime#1256, FixedSchema.java:31 — "update the documentation of the framework" Code fix Fixed in 20da2fb3eb0
#2 — studio#1711, TCKUIService.java:288 — "reduce cyclomatic complexity" Already addressed Replied on studio#1711

Fixes pushed: 20da2fb3eb0 — fix(QTDI-2862): address review round 1 - document FixedSchema watch()
Pending clarifications: 0

Rebased on master: origin/master was ahead by 4 commits (release-prep commits) — rebase attempted locally but reverted due to the no-force-push guardrail; caught up via a merge commit (72cb0cb6e91) instead, then the doc fix was applied on top.

Round summary generated by AI. Please resolve threads after verifying the fixes.

@sonar-rnd

sonar-rnd Bot commented Jul 28, 2026

Copy link
Copy Markdown

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.

1 participant