From 3e5cec20d29ae439212c9fcbec70348e81fc1638 Mon Sep 17 00:00:00 2001 From: James Maes Date: Wed, 14 Oct 2026 16:45:02 -0500 Subject: [PATCH] fix: endpoint pickers only for saved-object sources the host registers A host without saved reports (kof22) failed instance validation: file_gateway_alias.savedReportId named the unregistered possible-value source savedReport (and its bulkEdit process inherited it). The producer now drops the picker and its contingent filter for savedView, savedReport and savedBulkLoadProfile when the host has not registered that source. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 ++++ README.md | 4 +++ .../filegateway/FileGatewayQBitProducer.java | 26 +++++++++++++++++++ .../FileGatewayQBitProducerTest.java | 25 ++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c2f29..045296e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes are documented here, following [Keep a Changelog](https://ke ## [Unreleased] +### Fixed + +- Endpoint pickers for saved views, saved reports and saved bulk-load profiles are dropped when + the host has not registered those possible-value sources, so hosts without them validate. + ### Added - File transfer Preferences with connect-permission visibility, read-only connection details, diff --git a/README.md b/README.md index 0c7ee51..f95ac74 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ Apply [docs/ddl/file_gateway.sql](docs/ddl/file_gateway.sql) to the host's datab H2 and PostgreSQL and stores UTC timestamps without a zone, matching QQQ's RDBMS binding. The gateway does not create or migrate tables at runtime. +Register core's saved views, saved reports and saved bulk-load profiles (if the app uses them) +before the gateway producer: endpoint pickers for a source the app hasn't registered become plain +id fields, so the instance still validates. + Register metadata while building the QInstance: ```java diff --git a/src/main/java/com/kingsrook/qbits/filegateway/FileGatewayQBitProducer.java b/src/main/java/com/kingsrook/qbits/filegateway/FileGatewayQBitProducer.java index ffdf517..4ddc1fe 100644 --- a/src/main/java/com/kingsrook/qbits/filegateway/FileGatewayQBitProducer.java +++ b/src/main/java/com/kingsrook/qbits/filegateway/FileGatewayQBitProducer.java @@ -29,6 +29,7 @@ import com.kingsrook.qqq.backend.core.alerts.QAlertTypeMetaData; import com.kingsrook.qqq.backend.core.exceptions.QException; import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerMultiOutput; import com.kingsrook.qqq.backend.core.model.metadata.QInstance; +import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData; import com.kingsrook.qqq.backend.core.model.metadata.layout.QAppMetaData; import com.kingsrook.qqq.backend.core.model.metadata.layout.QAppSection; import com.kingsrook.qqq.backend.core.model.metadata.layout.QIcon; @@ -43,6 +44,9 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData; *******************************************************************************/ public class FileGatewayQBitProducer implements QBitMetaDataProducer { + /** Core possible-value sources a host may or may not register. */ + static final java.util.Set OPTIONAL_HOST_SOURCES = java.util.Set.of("savedView", "savedReport", "savedBulkLoadProfile"); + /******************************************************************************* ** The sftp wall owns its list (core's qbit prefixes are transitional and the ** assistant may now read audits): partners never reach identity, audits, @@ -149,6 +153,7 @@ public class FileGatewayQBitProducer implements QBitMetaDataProducer t.getName().equals(FileGatewayTables.ALIAS)).findFirst().orElseThrow(); + instance.addPossibleValueSource(new com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSource().withName("savedView") + .withType(com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSourceType.TABLE).withTableName("savedView")); + FileGatewayQBitProducer.dropMissingPickers(instance, alias); + assertThat(alias.getField("savedViewId").getPossibleValueSourceName()).isEqualTo("savedView"); + assertThat(alias.getField("savedViewId").getPossibleValueSourceFilter()).isNotNull(); + assertThat(alias.getField("savedReportId").getPossibleValueSourceName()).isNull(); + assertThat(alias.getField("savedReportId").getPossibleValueSourceFilter()).isNull(); + assertThat(alias.getField("savedBulkLoadProfileId").getPossibleValueSourceName()).isNull(); + assertThat(alias.getField("tableName").getPossibleValueSourceName()).isEqualTo("tables"); + } } -- 2.54.0