Skip to content

Commit 7f1908f

Browse files
feat: add error handler cooldown and Power Fx gotchas reference
Error Handler Improvements: - Add fxErrorEmailCooldownSeconds config (default 10s) - Add LastEmailSentTime field for cooldown tracking - Same error can trigger new email after cooldown elapses - Add Mermaid flowchart and timeline examples to docs Power Fx Reference: - Create Reference/power-fx-gotchas.md for syntax quirks - Document date formatting (lowercase mmm, not MMM) - Document m/mm context-sensitivity (month vs minutes) - Add official docs link and verification workflow Also includes: - Environment variables & ALM guide for SharePoint - Updated CLAUDE.md with mandatory verification workflow - Updated README.md with gotchas link 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 746fc79 commit 7f1908f

5 files changed

Lines changed: 286 additions & 86 deletions

File tree

CLAUDE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ PowerFxSnippets/
3636
├── Controls/ # Control-specific implementations
3737
├── Data Sources/ # Database schemas and SQL patterns
3838
├── Data Samples/ # Sample data files (CSV, JSON)
39+
├── Reference/ # Power Fx gotchas, syntax differences, tips
3940
├── SVGs/ # SVG graphics and icons
4041
├── Fonts/ # Font resources and configurations
4142
├── Icons/ # Icon collections
@@ -53,6 +54,21 @@ PowerFxSnippets/
5354

5455
## Working with Power Fx Code
5556

57+
### ⚠️ MANDATORY: Check Gotchas Before Writing Code!
58+
Before giving advice OR writing ANY Power Fx code (especially date formatting, function behavior, etc.):
59+
- **ALWAYS read** `Reference/power-fx-gotchas.md` FIRST
60+
- Power Fx is NOT the same as .NET, Excel, or JavaScript — don't assume!
61+
- This applies to: code snippets, examples, fixes, refactors — ALL Power Fx output
62+
63+
### 🔍 Power Fx Verification Workflow
64+
When uncertain about ANY Power Fx syntax or function behavior:
65+
1. **Check local gotchas first:** Read `Reference/power-fx-gotchas.md`
66+
2. **Verify with official docs:** Use `ref_search_documentation` with query like `"Power Fx [function name]"`
67+
3. **Read the result:** Use `ref_read_url` on the returned URL
68+
4. **Official docs base:** https://learn.microsoft.com/en-us/power-platform/power-fx/overview
69+
70+
**Never guess confidently about Power Fx syntax — verify first!**
71+
5672
### Formula Patterns
5773
- Power Fx formulas are typically stored in `.yaml` files or documented in `.md` files
5874
- Named formulas use the prefix `fx` (e.g., `fxMenuItems.yaml`)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ The existing organization remains functional during migration:
5656
- [**📋 Contribution Guide**](./CONTRIBUTING.md) - How to add your own snippets
5757
- [**🔧 Tools & Utilities**](./tools/) - Helper scripts and utilities
5858
- [**📚 Documentation**](./docs/) - Detailed guides and references
59+
- [**⚠️ Power Fx Gotchas**](./Reference/power-fx-gotchas.md) - Syntax quirks that differ from .NET/Excel/JavaScript
5960
- [**🏛️ Code of Conduct**](./CODE_OF_CONDUCT.md) - Community standards
6061

6162
## 🔥 Popular Snippets

RESUME.md

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,53 @@
66

77
## Current State
88

9-
Added comprehensive Environment Variables & ALM Guide for SharePoint solutions. All remotes in sync.
9+
Added time-based cooldown to error handler, created Power Fx gotchas reference doc, and established verification workflow for Power Fx syntax. All remotes in sync.
1010

1111
**Branch:** `main`
1212

1313
## What Was Accomplished This Session (2025-12-18)
1414

15-
### 1. Created Environment Variables & ALM Guide
16-
- **File:** `app-lifecycle/environment-variables-sharepoint-alm-guide.md`
17-
- **Purpose:** Complete step-by-step checklist for setting up environment variables and deploying Power Platform solutions across environments and tenants
18-
- **Content includes:**
19-
- Prerequisites checklist
20-
- Environment variable types explained (Text, Number, Data Source, Secret, etc.)
21-
- Connection References vs Environment Variables comparison
22-
- SharePoint-specific environment variables setup (Site URL + List)
23-
- Canvas app integration (automatic and manual methods)
24-
- Power Automate flow integration
25-
- Complete deployment checklist (export/import)
26-
- Cross-tenant deployment checklist
27-
- Naming conventions and best practices
28-
- Troubleshooting common issues
29-
- Quick reference cards
30-
31-
### 2. Updated app-lifecycle README
32-
- Added new "Environment & Deployment" subcategory
33-
- Added guide to complete snippet index
34-
- Updated Recent Updates section
35-
- Incremented snippet count to 26
36-
37-
### Commits Made
38-
- `[pending]` - docs: add comprehensive environment variables & ALM guide for SharePoint
15+
### 1. Error Handler Cooldown Feature
16+
- **File:** `errors/catch-all-errors.md`
17+
- **New config:** `fxErrorEmailCooldownSeconds = 10` (configurable)
18+
- **New field:** `LastEmailSentTime` in collection for cooldown tracking
19+
- **Behavior:** Same error can trigger new email after cooldown elapses
20+
- **Documentation:** Added Mermaid flowchart, timeline examples, behavior matrix
21+
22+
### 2. Created Power Fx Gotchas Reference
23+
- **File:** `Reference/power-fx-gotchas.md`
24+
- **Purpose:** Document Power Fx quirks that differ from .NET/Excel/JavaScript
25+
- **Key content:**
26+
- Date formatting rules (lowercase `mmm` not `MMM`)
27+
- CRITICAL: `m`/`mm` is context-sensitive (month vs minutes based on position)
28+
- Official docs link and verification workflow
29+
30+
### 3. Updated CLAUDE.md with Verification Workflow
31+
- Added mandatory check for gotchas before writing ANY Power Fx code
32+
- Added 4-step verification workflow using `ref_search_documentation`
33+
- Added official docs URL
34+
35+
### 4. Updated README.md
36+
- Added link to Power Fx Gotchas in Repository Tools section
37+
38+
### 5. Updated User Profile (~/.claude/CLAUDE.md)
39+
- Added rule: "Lead with recommended option first when presenting choices"
40+
41+
### Key Decisions
42+
- PDF docs (54MB) exceeds 32MB limit - cannot be used
43+
- URL-based verification via `ref_search_documentation` is the best approach
44+
- Custom MCP deemed overkill - existing tools work well
3945

4046
---
4147

42-
## Previous Session (2025-12-17 late night)
48+
## Previous Session (2025-12-18 earlier)
4349

44-
### Fixed Snippet Validator & Folder Casing
45-
- Fixed validator scanning documentation directories
46-
- Corrected 12 folder casings for Git consistency
47-
- Commits: `4e3d81f`, `32933eb`, `8d9c38c`
50+
### Created Environment Variables & ALM Guide
51+
- **File:** `app-lifecycle/environment-variables-sharepoint-alm-guide.md`
52+
- Complete deployment checklist for Power Platform solutions
4853

4954
---
5055

51-
## Previous Sessions
52-
53-
See git log for full history of reorganization work.
54-
5556
## Folder Structure
5657

5758
```
@@ -61,6 +62,7 @@ PowerFxSnippets/
6162
├── functions/ # Algorithms, built-in, user-defined
6263
├── integrations/ # Connectors, Power Automate
6364
├── learning/ # Best practices, certification, tutorials
65+
├── Reference/ # Power Fx gotchas and syntax references (NEW)
6466
├── ui-controls/ # Gallery, buttons, inputs, etc.
6567
├── ui-patterns/ # Components, dialogs, menus, theming
6668
├── utilities/ # Tools and scripts
@@ -69,9 +71,10 @@ PowerFxSnippets/
6971

7072
## Next Steps (Pick Up Here)
7173

72-
1. **Continue Phase 2 migrations** from spec kit tasks
73-
2. **Fix broken internal links** (T202)
74-
3. **Add more ALM/deployment content** as needed
74+
1. **Add more gotchas** to `Reference/power-fx-gotchas.md` as discovered
75+
2. **Test error handler cooldown** in a real Power App
76+
3. **Continue Phase 2 migrations** from spec kit tasks
77+
4. **Fix broken internal links** (T202)
7578

7679
## Git Remotes
7780

Reference/power-fx-gotchas.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Power Fx Gotchas
2+
3+
> **Purpose:** Document Power Fx behaviors that differ from common assumptions (Excel, JavaScript, .NET, etc.). This file helps AI assistants and developers avoid incorrect assumptions.
4+
5+
📚 **Official Documentation:** https://learn.microsoft.com/en-us/power-platform/power-fx/overview
6+
7+
🔍 **To verify syntax:** Use `ref_search_documentation` with query like "Power Fx Text function" then `ref_read_url` on the result.
8+
9+
---
10+
11+
## Date & Time Formatting
12+
13+
Power Fx date formatting is **NOT the same as .NET/C#**. Many uppercase formats that work in .NET **do not exist** in Power Fx.
14+
15+
### ⚠️ CRITICAL: `m`/`mm` is Context-Sensitive!
16+
17+
The `m` and `mm` placeholders mean **different things** depending on position:
18+
19+
| Position in Format String | Meaning | Example |
20+
|---------------------------|---------|---------|
21+
| After `h` or `hh` | **Minutes** | `"hh:mm"``"02:30"` |
22+
| Before `ss` | **Minutes** | `"mm:ss"``"30:45"` |
23+
| Anywhere else | **Month** | `"mm/dd"``"12/18"` |
24+
25+
```powerfx
26+
// Same placeholder, different meaning!
27+
Text(Now(), "mm/dd/yyyy") // mm = MONTH → "12/18/2025"
28+
Text(Now(), "hh:mm AM/PM") // mm = MINUTES → "02:30 PM"
29+
Text(Now(), "hh:mm:ss") // mm = MINUTES → "02:30:45"
30+
```
31+
32+
This is VERY different from .NET where `M` = month and `m` = minutes (always).
33+
34+
### Month Formats
35+
36+
| Format | Power Fx Result | Notes |
37+
|----------|-----------------|--------------------------------|
38+
| `m` | `1` - `12` | Month number (no leading zero) |
39+
| `mm` | `01` - `12` | Month number (with leading zero) |
40+
| `mmm` | `Jan` - `Dec` | Month abbreviation |
41+
| `mmmm` | `January`... | Full month name |
42+
| `MMM` | **ERROR** | Does NOT exist in Power Fx |
43+
| `MMMM` | **ERROR** | Does NOT exist in Power Fx |
44+
45+
### Day Formats
46+
47+
| Format | Power Fx Result | Notes |
48+
|----------|-----------------|------------------------------|
49+
| `d` | `1` - `31` | Day number (no leading zero) |
50+
| `dd` | `01` - `31` | Day number (with leading zero) |
51+
| `ddd` | `Mon` - `Sun` | Day abbreviation |
52+
| `dddd` | `Monday`... | Full day name |
53+
54+
### Time Formats
55+
56+
| Format | Power Fx Result | Notes |
57+
|----------|-----------------|--------------------------------|
58+
| `h` | `1` - `12` | Hour 12-hour (no leading zero) |
59+
| `hh` | `01` - `12` | Hour 12-hour (with leading zero) |
60+
| `H` | `0` - `23` | Hour 24-hour (no leading zero) |
61+
| `HH` | `00` - `23` | Hour 24-hour (with leading zero) |
62+
| `ss` | `00` - `59` | Seconds |
63+
| `AM/PM` | `AM` or `PM` | Meridiem indicator |
64+
65+
### Year Formats
66+
67+
| Format | Power Fx Result | Notes |
68+
|----------|-----------------|------------------|
69+
| `yy` | `25` | 2-digit year |
70+
| `yyyy` | `2025` | 4-digit year |
71+
72+
### Working Examples
73+
74+
```powerfx
75+
// ✅ CORRECT - These work in Power Fx
76+
Text(Now(), "mm/dd/yyyy") // "12/18/2025"
77+
Text(Now(), "mmm dd, yyyy") // "Dec 18, 2025"
78+
Text(Now(), "mmmm d, yyyy") // "December 18, 2025"
79+
Text(Now(), "dddd, mmmm d, yyyy") // "Wednesday, December 18, 2025"
80+
Text(Now(), "hh:mm:ss AM/PM") // "02:30:45 PM"
81+
Text(Now(), "mm/dd/yyyy hh:mm AM/PM") // "12/18/2025 02:30 PM"
82+
83+
// ❌ WRONG - These cause errors in Power Fx
84+
Text(Now(), "MMM dd, yyyy") // ERROR - MMM doesn't exist
85+
Text(Now(), "MMMM d, yyyy") // ERROR - MMMM doesn't exist
86+
Text(Now(), "MM/DD/YYYY") // ERROR - uppercase doesn't work
87+
```
88+
89+
### Inside String Interpolation
90+
91+
When using `$"..."` syntax, escape quotes by doubling them:
92+
93+
```powerfx
94+
// Inside $"..." - double the quotes
95+
$"Date: {Text(Now(), ""mmm dd, yyyy"")}"
96+
97+
// Outside $"..." - single quotes work
98+
"Date: " & Text(Now(), "mmm dd, yyyy")
99+
```
100+
101+
---
102+
103+
## More Gotchas
104+
105+
*Add more Power Fx-specific behaviors here as they're discovered.*
106+
107+
---
108+
109+
## History
110+
111+
| Date | Author | Changes |
112+
|------------|-----------------|----------------------------------------------------------------|
113+
| 2025-12-18 | Claude Opus 4.5 | Added m/mm context-sensitivity rule, official docs link |
114+
| 2025-12-18 | Claude Opus 4.5 | Created with date formatting rules |

0 commit comments

Comments
 (0)