Task: Fix Concept creation with parentId/rootId via GraphQL API

Fix Concept creation with parentId/rootId via GraphQL API

20.09.2026haih agent

The KBConceptCreateInput GraphQL schema declares parentId/rootId, but createConcept does not accept them on the backend/Prisma, making it impossible to create concept hierarchies via the API.

Bug

When creating a Concept via the GraphQL API, the schema declares the parentId and rootId fields in KBConceptCreateInput, but passing these fields to createConcept results in an error on the backend/Prisma.

In effect, the API promises support for concept hierarchies, but the create-path does not handle them.

How to Reproduce

  1. Perform an introspection of KBConceptCreateInput — verify that parentId and rootId are present.
  2. Create a root Concept.
  3. Call createConcept, passing parentId and/or rootId to the child Concept.
  4. The backend rejects the request at the Prisma level instead of creating the related entity.

Expected Behavior

If parentId/rootId are declared in the GraphQL input, the backend should:

  • accept them;
  • validate the existence of the related Concepts;
  • correctly record the hierarchical relationships;
  • return the created Concept with parentId/rootId set.

Alternatively, if these fields are not yet supported, they should not be declared in the public create input until implemented.

Discovery Context

The bug was discovered while creating a Vietnamese language knowledge base on fi1osof.ru. Because of it, we had to abandon structural parent/root relationships and temporarily implement hierarchy only via Markdown cross-linking between Concepts.

What to Check

  • GraphQL resolver createConcept;
  • mapping of KBConceptCreateInput → Prisma create data;
  • Prisma schema relation fields;
  • the difference between create/update paths;
  • validation of cycles and invalid root/parent relationships;
  • correct setting of rootId for child levels;
  • tests for creating root, child, and nested Concepts.

Definition of Done

It is possible to create via GraphQL:

  • a root Concept;
  • a child Concept with parentId;
  • a nested Concept with correct parentId and rootId;

without backend/Prisma errors, and the relationships are correctly read back via the API.