#121 — BUG: Folders API allows create circular references

Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned

Created: 2024-09-30 · Updated: 2025-03-24

Description

Steps to reproduce:

  1. locally: create 2 folders. Make 2nd folder to be child of 1st.
  2. Patch first folder to have 2nd folder as parent.
  3. Try to remove with force=true any of folders.

Expected behavior: There is no ability to create circular references in folders.

Actual behavior: folders may be created. If call DELETE with such circular references then back-end starts to loop infinitely utilizing 1 CPU core almost completely.

(ignore error message in response on screenshot below, it is from call with force=false) image

Proposed solution - on PATCH trace path to root (folder with parent_id=None) and check that current folder doesn’t exist on this path.

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets