refactor(workflow): Dont strip html tags in object summary#6324
refactor(workflow): Dont strip html tags in object summary#6324tanmoysrt wants to merge 2 commits into
Conversation
|
@tanmoysrt, thanks for the contribution, but we do not accept pull requests on a master. Please close this PR and raise PR on an develop branch. |
|
| Filename | Overview |
|---|---|
| press/workflow_engine/doctype/press_workflow_object/press_workflow_object.py | Removes the HTML-bracket sanitisation guard for summary; the field is still DF.Data, so Frappe may silently strip angle-bracket content and leave summary empty. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["store(obj)"] --> B["summary = str(obj)"]
B --> C{Exception?}
C -->|Yes| D["summary = repr(type(obj))"]
C -->|No| E["summary is set"]
D --> E
E --> F{len > 512?}
F -->|Yes| G["summary = summary[:500] + '...'"]
F -->|No| H["doc.summary = summary"]
G --> H
H --> I["doc.insert()"]
I --> J{Frappe strips HTML from DF.Data?}
J -->|Yes - angle-bracket strings| K["summary silently becomes empty string"]
J -->|No / field type changed| L["summary saved correctly"]
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
press/workflow_engine/doctype/press_workflow_object/press_workflow_object.py:80-82
**Removed HTML-stripping guard may leave `summary` empty**
The deleted block existed specifically because Frappe silently strips content that looks like an HTML tag from `DF.Data` fields on `doc.insert()`. The `summary` field is still typed as `DF.Data` (line 47), so any object whose `str()` or `repr()` produces a string entirely enclosed in angle brackets (e.g. the default `<module.ClassName object at 0x…>`) will be saved as an empty string after Frappe's sanitisation pass — with no fallback. Before landing this change, confirm whether Frappe's behaviour for `DF.Data` fields has actually changed, or whether the field type has been migrated; otherwise the `summary` column will silently be blank for those objects.
Reviews (1): Last reviewed commit: "Merge branch 'master' into chore_Workflo..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6324 +/- ##
===========================================
- Coverage 82.33% 49.65% -32.69%
===========================================
Files 109 936 +827
Lines 17374 77681 +60307
Branches 527 355 -172
===========================================
+ Hits 14305 38572 +24267
- Misses 3041 39085 +36044
+ Partials 28 24 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
(cherry picked from commit 16d1b6c)