@fairfox/polly 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9102,6 +9102,32 @@ ${generateVerificationSection(context)}
9102
9102
  - Files outside src/ are automatically found if imported from handler files
9103
9103
  - This enables clean separation of verification code from runtime code
9104
9104
 
9105
+ # Verification Parameters Explained
9106
+
9107
+ When explaining verification configuration, help users understand what each parameter controls:
9108
+
9109
+ **maxDepth**: Maximum number of **sequential** message deliveries to check
9110
+ - Depth 4 = check sequences up to 4 messages delivered one after another
9111
+ - Depth 8 = check sequences up to 8 messages delivered one after another
9112
+ - Question to ask: "What's the longest sequence of messages that could expose a bug in my app?"
9113
+ - Most authentication/state machine bugs appear in shallow sequences (depth 2-4)
9114
+
9115
+ **maxInFlight**: Maximum number of **concurrent** messages in the system at once
9116
+ - 2 = check scenarios with up to 2 messages pending simultaneously
9117
+ - 3 = check scenarios with up to 3 messages pending simultaneously
9118
+ - Question: "How many concurrent messages can actually happen in my app?"
9119
+ - Consider different bounds per message type (auth should be 1, queries could be higher)
9120
+
9121
+ **maxTabs**: Number of concurrent contexts (tabs, workers, etc.)
9122
+ - Question: "How many concurrent contexts do I need to verify for race conditions?"
9123
+ - Most single-tab apps only need 1; multi-tab/worker apps need 2+
9124
+
9125
+ **Practical Guidance**:
9126
+ - Start conservative: maxDepth: 3-4, maxInFlight: 2, maxTabs: 1
9127
+ - Use timeouts (5-10 minutes) to prevent runaway verification
9128
+ - Don't arbitrarily exclude message types to speed up verification - tune the bounds instead
9129
+ - If verification takes hours, bounds are likely too high for regular development workflows
9130
+
9105
9131
  # Elysia/Bun Integration
9106
9132
 
9107
9133
  Polly now provides first-class support for Elysia (Bun-first web framework) with Eden type-safe client generation:
@@ -9150,6 +9176,8 @@ const app = new Elysia()
9150
9176
  'POST /todos': {
9151
9177
  queue: true,
9152
9178
  optimistic: (body) => ({ id: -Date.now(), ...body }),
9179
+ merge: 'replace', // 'replace' | custom merge function
9180
+ conflictResolution: 'last-write-wins', // 'last-write-wins' | 'server-wins' | custom function
9153
9181
  },
9154
9182
  },
9155
9183
  }))
@@ -9166,6 +9194,30 @@ const app = new Elysia()
9166
9194
  - In production: Pass-through (minimal overhead) - client effects are bundled at build time
9167
9195
  - Authorization and broadcasts work in both modes
9168
9196
 
9197
+ **Offline Behavior Configuration:**
9198
+
9199
+ The \`offline\` config enables Progressive Web App capabilities:
9200
+
9201
+ \`\`\`typescript
9202
+ offline: {
9203
+ 'POST /todos': {
9204
+ queue: true, // Queue request when offline
9205
+ optimistic: (body) => TResult, // Immediate UI update with predicted result
9206
+ merge: 'replace' | mergeFn, // How to merge optimistic with server result
9207
+ conflictResolution: 'last-write-wins' | 'server-wins' | resolveFn,
9208
+ },
9209
+ }
9210
+ \`\`\`
9211
+
9212
+ **Merge Strategies:**
9213
+ - \`'replace'\`: Replace optimistic result with server result (default)
9214
+ - \`(optimistic, server) => TResult\`: Custom merge logic
9215
+
9216
+ **Conflict Resolution** (when multiple devices edit offline):
9217
+ - \`'last-write-wins'\`: Lamport clock determines winner
9218
+ - \`'server-wins'\`: Server state always takes precedence
9219
+ - \`(client, server) => TResult\`: Custom conflict resolution
9220
+
9169
9221
  ## Client-Side Wrapper (\`@fairfox/polly/client\`)
9170
9222
 
9171
9223
  Enhances Eden treaty client with Polly features:
@@ -9544,6 +9596,32 @@ ${generateProjectSection(context, contexts2, allHandlers, messageFlows)}
9544
9596
 
9545
9597
  ${generateVerificationSection(context)}
9546
9598
 
9599
+ # Understanding Verification Parameters
9600
+
9601
+ Before suggesting optimizations, understand what each parameter actually controls:
9602
+
9603
+ **maxDepth**: Maximum number of **sequential** message deliveries to check
9604
+ - Depth 4 = check sequences up to 4 messages delivered one after another
9605
+ - Depth 8 = check sequences up to 8 messages delivered one after another
9606
+ - Question to ask: "What's the longest sequence of messages that could expose a bug in my app?"
9607
+ - Most authentication/state machine bugs appear in shallow sequences (depth 2-4)
9608
+
9609
+ **maxInFlight**: Maximum number of **concurrent** messages in the system at once
9610
+ - 2 = check scenarios with up to 2 messages pending simultaneously
9611
+ - 3 = check scenarios with up to 3 messages pending simultaneously
9612
+ - Question: "How many concurrent messages can actually happen in my app?"
9613
+ - Consider different bounds per message type (auth should be 1, queries could be higher)
9614
+
9615
+ **maxTabs**: Number of concurrent contexts (tabs, workers, etc.)
9616
+ - Question: "How many concurrent contexts do I need to verify for race conditions?"
9617
+ - Most single-tab apps only need 1; multi-tab/worker apps need 2+
9618
+
9619
+ **Practical Approach**:
9620
+ - Start conservative: maxDepth: 3-4, maxInFlight: 2, maxTabs: 1
9621
+ - Use timeouts (5-10 minutes) to prevent runaway verification
9622
+ - Don't arbitrarily exclude message types - tune the bounds instead
9623
+ - If verification takes hours, bounds are likely too high for regular development
9624
+
9547
9625
  # Your Expertise: Optimization Tiers
9548
9626
 
9549
9627
  ## Tier 1: Safe Optimizations (ZERO precision loss)
@@ -9847,4 +9925,4 @@ Goodbye!`);
9847
9925
  }
9848
9926
  main();
9849
9927
 
9850
- //# debugId=20A98BE870D3CEDD64756E2164756E21
9928
+ //# debugId=0C5B6EFE146F7BE464756E2164756E21