|
| 1 | +# Post-Mortem: v0.10.1 |
| 2 | + |
| 3 | +**Branch:** `feature/v0.10.1-custom-palettes` |
| 4 | +**Type:** Feature |
| 5 | +**Duration:** 1 day (Started: 2025-12-29, Completed: 2025-12-29) |
| 6 | +**Outcome:** ✅ Success |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## Summary |
| 11 | + |
| 12 | +Implemented admin-defined custom color palettes using Dataiku's parameter set (PRESET) mechanism. The feature required significant debugging to understand how PRESET parameters work differently in webapps vs recipes/connectors. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Scope |
| 17 | + |
| 18 | +### Planned |
| 19 | +- [x] Parameter set for custom palettes |
| 20 | +- [x] Custom option in color palette dropdown |
| 21 | +- [x] PRESET selector with visibility condition |
| 22 | +- [x] Backend preset resolution |
| 23 | +- [x] Hex color validation |
| 24 | +- [x] Dynamic CSS injection with text contrast |
| 25 | + |
| 26 | +### Delivered |
| 27 | +All planned items delivered. |
| 28 | + |
| 29 | +### Deferred Items |
| 30 | +None |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## Commit Analysis |
| 35 | + |
| 36 | +| Metric | Value | Assessment | |
| 37 | +|--------|-------|------------| |
| 38 | +| Total commits | 5 | | |
| 39 | +| Feature commits | 1 | | |
| 40 | +| Fix/debug commits | 4 | | |
| 41 | +| Reverts | 0 | | |
| 42 | +| Churn ratio | 80% | 🔴 High (API discovery) | |
| 43 | + |
| 44 | +**Churn explanation:** High churn ratio due to iterative API discovery. The Dataiku PRESET mechanism works differently in webapps (raw references) vs recipes (auto-resolved). Required 4 iterations to find correct API pattern: |
| 45 | + |
| 46 | +1. Initial implementation assumed auto-resolution (wrong) |
| 47 | +2. Added debug logging to discover raw reference format |
| 48 | +3. First API attempt with wrong method names |
| 49 | +4. Final fix: `preset.config` is a property, not `preset.get_config()` |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## What Went Well |
| 54 | + |
| 55 | +- Clean architecture: CSS injection with luminance-based text contrast |
| 56 | +- Parameter set structure follows Dataiku patterns |
| 57 | +- Hex validation handles 3-digit and 6-digit formats |
| 58 | +- Graceful fallback to classic palette on errors |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## What Didn't Go Well |
| 63 | + |
| 64 | +- Assumed PRESET params auto-resolve in webapps (they don't) |
| 65 | +- Searched for wrong API methods initially |
| 66 | +- `config` is a property vs `get_config()` method distinction not obvious |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Blockers Encountered |
| 71 | + |
| 72 | +| Blocker | Impact | Resolution | Time Lost | |
| 73 | +|---------|--------|------------|-----------| |
| 74 | +| PRESET not resolving | Colors defaulted to classic | Added resolve_preset() | 1 hour | |
| 75 | +| Wrong API method | AttributeError | Found correct API path | 30 min | |
| 76 | +| Property vs method | AttributeError | Changed to `preset.config` | 30 min | |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## Technical Discoveries |
| 81 | + |
| 82 | +### Platform Behavior |
| 83 | +1. **Webapps receive raw PRESET references** - Unlike recipes where Dataiku auto-resolves PRESET params to dicts, webapps receive `{"mode": "PRESET", "name": "PRESET_3"}` and must manually resolve via API |
| 84 | + |
| 85 | +2. **DSSPluginPreset.config is a property** - Use `preset.config`, not `preset.get_config()`. The API documentation is sparse on this detail. |
| 86 | + |
| 87 | +3. **Preset resolution API path**: |
| 88 | + ```python |
| 89 | + client = dataiku.api_client() |
| 90 | + plugin = client.get_plugin("plugin-id") |
| 91 | + settings = plugin.get_settings() |
| 92 | + parameter_set = settings.get_parameter_set("param-set-id") |
| 93 | + preset = parameter_set.get_preset("PRESET_NAME") |
| 94 | + values = preset.config # Property, not method! |
| 95 | + ``` |
| 96 | + |
| 97 | +### Library Behavior |
| 98 | +- WCAG luminance formula works well for auto text contrast |
| 99 | +- CSS injection timing not critical - can inject before render |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## CLI Docs Candidates |
| 104 | + |
| 105 | +Items added to CLAUDE.md gotchas: |
| 106 | + |
| 107 | +1. **Webapp PRESET params are raw references** - Must resolve via API, not auto-resolved like in recipes |
| 108 | +2. **DSSPluginPreset.config is a property** - Not a method, don't use get_config() |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Recommendations |
| 113 | + |
| 114 | +### For Next Release |
| 115 | +- Consider adding color preview in parameter set UI (not possible with current TEXTAREA) |
| 116 | + |
| 117 | +### Process Improvements |
| 118 | +- Check Dataiku API examples before assuming behavior matches recipes |
| 119 | + |
| 120 | +### Technical Debt |
| 121 | +- Unit test collection errors need investigation (ScenarioConfiguration) |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Lessons Learned |
| 126 | + |
| 127 | +1. Dataiku has different behavior for PRESET params across component types (webapp vs recipe) |
| 128 | +2. Always check if Python attributes are properties vs methods |
| 129 | +3. Debug logging early is valuable for understanding framework behavior |
0 commit comments