zverok opened a new issue, #30895:
URL: https://github.com/apache/superset/issues/30895

   ### Bug description
   
   NB: I can’t currently run Superset 4 locally, but we backported the 
`TagDAO.create_custom_tagged_objects` to our Superset 3, and I _assume_ that 
the bug affects Superset 4 too (considering the code logic).
   
   Basically, the reproduction is to call `POST /api/v1/tags/2/<chart_id> 
{"properties": {"tags": ["<some-tag>"]}}` twice (with the same chart and the 
same tag). Superset will fail with the tag uniqueness check.
   
   The problem seems to be 
[here](https://github.com/apache/superset/blob/master/superset/daos/tag.py#L60-L74):
   * in line 60, a new TaggedObject is created unconditionally (I think this is 
wrong)
   * ...then, there is an existence check, and then in line 72, the same object 
is created conditionally.
   
   At least when ported to the Superset 3 codebase, this fails predictably. 
Maybe Superset 4 somehow prevents that on another layer, but the method looks 
wrong in any case. (Or I am missing something.)
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.10
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to