@@ -23,7 +23,7 @@ import { walkFilterFieldKeys, type FilterFieldKey } from './filter-walk.js';
2323import { DATASET_FIELD_UNKNOWN , validateDatasetReferences } from './validate-dataset-references.js' ;
2424import { MEASURE_AGGREGATE_FIELD_TYPE_REFUSED , validateDatasetMeasureAggregates } from './validate-dataset-measure-aggregates.js' ;
2525import { FIELD_NO_CONSUMERS , validateFieldConsumers } from './validate-field-consumers.js' ;
26- import { LIST_VIEW_FIELD_UNKNOWN , validateListViewFieldRefs } from './validate-list-view-field-refs.js' ;
26+ import { LIST_VIEW_FIELD_UNKNOWN , LIST_VIEW_KANBAN_LANE_UNKNOWN , validateListViewFieldRefs } from './validate-list-view-field-refs.js' ;
2727import { MAPPING_TARGET_FIELD_UNKNOWN , validateMappingTargetFields } from './validate-mapping-target-fields.js' ;
2828import { OBJECT_FIELD_REF_UNKNOWN , validateObjectFieldRefs } from './validate-object-field-refs.js' ;
2929import { PAGE_FIELD_UNKNOWN , validatePageFieldBindings } from './validate-page-field-bindings.js' ;
@@ -33,7 +33,7 @@ import { REPORT_FILTER_FIELD_UNKNOWN, validateReportRuntimeFilters } from './val
3333import { RLS_PREDICATE_UNKNOWN_FIELD , validateRlsPredicateEnforceability } from './validate-rls-predicate-enforceability.js' ;
3434import { SHARING_RULE_UNLOWERABLE_CONDITION , validateSharingRuleEnforceability } from './validate-sharing-rule-enforceability.js' ;
3535import { THANK_YOU_RECORD_FIELD , validateThankYouRecordFields } from './validate-thank-you-record-fields.js' ;
36- import { WIDGET_FILTER_FIELD_UNKNOWN , validateWidgetBindings } from './validate-widget-bindings.js' ;
36+ import { MEASURE_AGGREGATE_INCOHERENT , WIDGET_FILTER_FIELD_UNKNOWN , validateWidgetBindings } from './validate-widget-bindings.js' ;
3737// [#16340] Read back the registry's OWN definition table to assert the graph
3838// derives its injected types rather than carrying a second copy of them.
3939import { injectedSystemColumnDefs } from '@objectstack/spec/data' ;
@@ -737,22 +737,52 @@ describe('[#30383] the field-path rules read the objects as served', () => {
737737 { manifest : { id : 'mod2' , objectExtensions : [ { extend : 'xs_deal' , fields : b } ] } } ,
738738 ] ,
739739 } ) ;
740+ // The fold keeps the LAST writer at a tied priority, so each pair below
741+ // lists the definition a type arm would refuse last: an arm that read the
742+ // kept definition instead of dropping the tie goes red.
740743 const numberOrText = ( extra : Rec ) => ( { ...tie ( { score : { type : 'number' } } , { score : { type : 'text' } } ) , ...extra } ) ;
741- const dateOrText = ( extra : Rec ) => ( { ...tie ( { closed_on : { type : 'date' } } , { closed_on : { type : 'text' } } ) , ...extra } ) ;
744+ const textOrDate = ( extra : Rec ) => ( { ...tie ( { closed_on : { type : 'text' } } , { closed_on : { type : 'date' } } ) , ...extra } ) ;
745+ const numberOrPercent = ( extra : Rec ) => ( { ...tie ( { score : { type : 'number' } } , { score : { type : 'percent' } } ) , ...extra } ) ;
746+ const stage = ( values : string [ ] ) => ( { stage : { type : 'select' , options : values . map ( ( value ) => ( { value, label : value } ) ) } } ) ;
747+ const abOrAc = ( extra : Rec ) => ( { ...tie ( stage ( [ 'a' , 'b' ] ) , stage ( [ 'a' , 'c' ] ) ) , ...extra } ) ;
742748
743749 it ( 'is still a served name for the existence rules' , ( ) => {
744750 expect ( ids ( validateDatasetReferences , numberOrText ( { datasets : [ { ...dataset ( 'score' ) , include : [ ] } ] } ) ) ) . toEqual ( [ ] ) ;
745751 expect ( ids ( validateDatasetReferences , numberOrText ( { datasets : [ { ...dataset ( 'zq_absent' ) , include : [ ] } ] } ) ) ) . toEqual ( [ DATASET_FIELD_UNKNOWN ] ) ;
746752 } ) ;
747753
748- it ( 'is not judged on its type by the type arms ' , ( ) => {
754+ it ( 'is not judged on its type by measure aggregates ' , ( ) => {
749755 const sum = { datasets : [ { name : 'deals' , object : 'xs_deal' , measures : [ { name : 's' , aggregate : 'sum' , field : 'score' } ] } ] } ;
750756 expect ( ids ( validateDatasetMeasureAggregates , numberOrText ( sum ) ) ) . toEqual ( [ ] ) ;
751757 expect ( ids ( validateDatasetMeasureAggregates , { ...tie ( { score : { type : 'text' } } , { } ) , ...sum } ) )
752758 . toEqual ( [ MEASURE_AGGREGATE_FIELD_TYPE_REFUSED ] ) ;
753- expect ( ids ( validatePresetComparands , dateOrText ( widget ( { closed_on : 'last_30_days' } ) ) ) ) . toEqual ( [ ] ) ;
759+ } ) ;
760+
761+ it ( 'is not judged on its type by preset comparands' , ( ) => {
762+ const preset = widget ( { closed_on : 'last_30_days' } ) ;
763+ expect ( ids ( validatePresetComparands , textOrDate ( preset ) ) ) . toEqual ( [ ] ) ;
764+ expect ( ids ( validatePresetComparands , { ...tie ( { closed_on : { type : 'date' } } , { } ) , ...preset } ) ) . toEqual ( [ FILTER_PRESET_COMPARAND ] ) ;
765+ } ) ;
766+
767+ it ( 'is not judged on its type by sharing-rule criteria' , ( ) => {
754768 const rule = { sharingRules : [ { name : 'sr' , object : 'xs_deal' , condition : 'record.closed_on == record.name' , sharedWith : { type : 'role' , value : 'r' } , accessLevel : 'read' } ] } ;
755- expect ( ids ( validateSharingRuleEnforceability , dateOrText ( rule ) ) ) . toEqual ( [ ] ) ;
769+ expect ( ids ( validateSharingRuleEnforceability , textOrDate ( rule ) ) ) . toEqual ( [ ] ) ;
770+ expect ( ids ( validateSharingRuleEnforceability , { ...tie ( { closed_on : { type : 'date' } } , { } ) , ...rule } ) )
771+ . toEqual ( [ SHARING_RULE_UNLOWERABLE_CONDITION ] ) ;
772+ } ) ;
773+
774+ it ( 'is not judged on its type by the widget field-type map' , ( ) => {
775+ const sum = { datasets : [ { name : 'deals' , object : 'xs_deal' , measures : [ { name : 's' , aggregate : 'sum' , field : 'score' } ] } ] } ;
776+ expect ( ids ( validateWidgetBindings , numberOrPercent ( sum ) ) ) . toEqual ( [ ] ) ;
777+ expect ( ids ( validateWidgetBindings , { ...tie ( { score : { type : 'percent' } } , { } ) , ...sum } ) ) . toEqual ( [ MEASURE_AGGREGATE_INCOHERENT ] ) ;
778+ } ) ;
779+
780+ it ( 'lends no options to a kanban lane check' , ( ) => {
781+ const lanes = {
782+ views : [ { name : 'v' , object : 'xs_deal' , list : { type : 'kanban' , columns : [ 'name' ] , kanban : { groupByField : 'stage' , columns : [ 'name' ] , lanes : [ 'b' ] } } } ] ,
783+ } ;
784+ expect ( ids ( validateListViewFieldRefs , abOrAc ( lanes ) ) ) . toEqual ( [ ] ) ;
785+ expect ( ids ( validateListViewFieldRefs , { ...tie ( stage ( [ 'a' , 'c' ] ) , { } ) , ...lanes } ) ) . toEqual ( [ LIST_VIEW_KANBAN_LANE_UNKNOWN ] ) ;
756786 } ) ;
757787
758788 it ( 'is admitted on a thank-you panel only when every tied definition is engine-generated' , ( ) => {
0 commit comments