Skip to content

Commit 3738716

Browse files
dguidoclaude
andauthored
docs: add tests vs filters pattern for boolean checks (#14951)
Tests (`is X`) return native booleans; filters (`| X`) return data. Use tests in assert.that and when: clauses. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0160b76 commit 3738716

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ servers: "{{ servers | default([]) + [item.name] }}"
210210
loop: "{{ configs }}"
211211
```
212212

213+
**Use tests (not filters) for boolean checks:**
214+
```yaml
215+
# WRONG - filters return transformed data, not booleans
216+
that: my_ip | ansible.utils.ipv4
217+
218+
# CORRECT - tests return native booleans
219+
that: my_ip is ansible.utils.ipv4_address
220+
```
221+
213222
## DNS Architecture
214223

215224
Algo uses a randomly generated IP in 172.16.0.0/12 on the loopback interface (`local_service_ip`) for DNS. This provides consistency across WireGuard and IPsec but requires understanding systemd socket activation.

0 commit comments

Comments
 (0)