Skip to content

Commit 2ff734b

Browse files
committed
test(flow): pin each node's declared config vocabulary; quiet the phpmd threshold trip
The coverage ratchet was right: a vocabulary declaration with no assertion is a claim nothing checks. Each node's configKeys() is now pinned against the documented set — the preflight refuses keys outside it and the editor renders one field per entry, so drift between declaration and what the node reads would make real options unreachable through both. phpmd: SynchronizationRunNode sat exactly at the complexity threshold before the one-line configKeys() tipped it; suppressed with the rationale on the class, mirroring the fleet's pattern for branchy-by-nature classes.
1 parent 88d4257 commit 2ff734b

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

lib/Flow/SynchronizationRunNode.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@
8383
* Runs a configured Synchronization as one flow step, fanning out its objects.
8484
*
8585
* @spec openspec/changes/openconnector-flow-nodes/tasks.md#task-4-synchronizationrunnode-with-bounded-fan-out-seed-data-and-a-live-end-to-end-run
86+
*
87+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity) The class sat at the
88+
* threshold before `configKeys()` — a one-line vocabulary declaration —
89+
* tipped it over. The complexity is the count of distinct ways a run
90+
* config and its fan-out can be wrong; splitting the class would move
91+
* that branching, not remove it.
8692
*/
8793
class SynchronizationRunNode implements IFlowNode, IFlowNodeConfigKeys {
8894

tests/Unit/Flow/SourceCallNodeTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,24 @@ public function testPaletteMetadata(): void {
147147

148148
}//end testPaletteMetadata()
149149

150+
151+
/**
152+
* The declared vocabulary is what the node actually reads.
153+
*
154+
* The preflight refuses keys outside this list and the flow editor renders
155+
* one field per entry, so a key the node reads but does not declare becomes
156+
* unreachable through both — this pins the two against each other.
157+
*
158+
* @return void
159+
*/
160+
public function testConfigKeysNameTheVocabularyTheNodeReads(): void {
161+
$this->assertSame(
162+
['source', 'endpoint', 'method', 'query', 'headers', 'body', 'output', 'concurrency'],
163+
$this->node->configKeys()
164+
);
165+
166+
}//end testConfigKeysNameTheVocabularyTheNodeReads()
167+
150168
/**
151169
* Scope is answered with Nextcloud's constants and false for anything else.
152170
*

tests/Unit/Flow/SynchronizationRunNodeTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,24 @@ public function testPaletteMetadata(): void {
135135

136136
}//end testPaletteMetadata()
137137

138+
139+
/**
140+
* The declared vocabulary is what the node actually reads.
141+
*
142+
* The preflight refuses keys outside this list and the flow editor renders
143+
* one field per entry, so a key the node reads but does not declare becomes
144+
* unreachable through both — this pins the two against each other.
145+
*
146+
* @return void
147+
*/
148+
public function testConfigKeysNameTheVocabularyTheNodeReads(): void {
149+
$this->assertSame(
150+
['synchronization', 'force', 'output', 'maxItems', 'onError'],
151+
$this->node->configKeys()
152+
);
153+
154+
}//end testConfigKeysNameTheVocabularyTheNodeReads()
155+
138156
/**
139157
* An inline synchronization definition is rejected at save.
140158
*

0 commit comments

Comments
 (0)