Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Describe the fixed parent in comments and maps

Guido Boyke94041074cb79
diff --git a/app/controllers/api/v1/tickets_controller.rb b/app/controllers/api/v1/tickets_controller.rb
index 783e0f5..21e1be2 100644
--- a/app/controllers/api/v1/tickets_controller.rb
+++ b/app/controllers/api/v1/tickets_controller.rb
@@ -231,8 +231,9 @@ module Api
}
mapped[:content] = attrs[:description] if attrs[:description].present?
mapped[:assignee_ids] = attrs[:assignee_ids] if attrs[:assignee_ids]
- # parent_id is attacker-controllable; the same-project / one-level / cross-tenant
- # guards live in the Ticket model validations (as for the web path), not here.
+ # parent_id is attacker-controllable; the Ticket model validations guard it (as for
+ # the web path), not here: the parent is in the same project (so never in another
+ # tenant), and a saved ticket's parent is fixed.
mapped[:parent_id] = attrs[:parent_id] if attrs[:parent_id].present?
mapped
end
diff --git a/app/controllers/organisations/tickets_controller.rb b/app/controllers/organisations/tickets_controller.rb
index db9b10c..5a1265c 100644
--- a/app/controllers/organisations/tickets_controller.rb
+++ b/app/controllers/organisations/tickets_controller.rb
@@ -1124,8 +1124,9 @@ class Organisations::TicketsController < Organisations::BaseController
end
def ticket_params
- # Get base permitted params. parent_id is attacker-controllable; the same-project /
- # one-level guards live in the Ticket model validations, not in this filter.
+ # Get base permitted params. parent_id is attacker-controllable; the Ticket model
+ # validations guard it (parent in the same project, a saved ticket's parent is fixed),
+ # not this filter.
permitted = [:title, :content, :tag_list, :ticket_type, :parent_id, { assignee_ids: [] }]
# Ticket document handling
diff --git a/app/models/CLAUDE.md b/app/models/CLAUDE.md
index de628a0..2deda0b 100644
--- a/app/models/CLAUDE.md
+++ b/app/models/CLAUDE.md
@@ -1,4 +1,4 @@
-# Karte: app/models (Stand: 2026-10-29)
+# Karte: app/models (Stand: 2026-10-31)
~80 Modelle liegen flach in diesem Verzeichnis; Namespaces existieren nur für `admin/`,
`knowledge/`, `overview/`, `smart_folders/`, `time_sessions/`, `user/`. Die Domänen-Zugehörigkeit ist am
@@ -46,6 +46,10 @@ Verzeichnis-Layout nicht ablesbar — diese Karte gruppiert sie:
Ein Rückgängig nimmt die Personen seines Laufs an, legt aber nicht mehr Zuweisbare nicht
zurück (`AddRemoveBase#restorable`); der Rest des Tickets wird zurückgesetzt.
Titel: höchstens `Ticket::TITLE_MAX_LENGTH` (255), geprüft nur bei geändertem Titel.
+ Unteraufgaben (seit 31.10.2026 in beliebiger Tiefe): die Eltern liegen im selben Projekt und
+ stehen nach dem Anlegen fest (`Ticket#parent_unchanged`), darum kein Kreis. Vorfahren liest
+ nur `Tickets::Ancestry`. Fortschritt und Spalte „Subs“ zählen nur direkte Kinder; ein
+ Ticket in einem Baum lehnt `Tickets::Mover` weiter ab.
⚠️ Wer eine Beziehung SEHEN darf, entscheidet nur `TicketRelation.visible_to(user, org, token:)`:
beide Enden lesbar (`TicketPolicy::Scope`), mit Token zusätzlich in dessen Reichweite. Titel,
Nummer und Projekt eines Tickets ohne Leserecht erscheinen nirgends (Plan §4).
diff --git a/app/services/CLAUDE.md b/app/services/CLAUDE.md
index baafd75..cb80c1e 100644
--- a/app/services/CLAUDE.md
+++ b/app/services/CLAUDE.md
@@ -589,7 +589,10 @@ Bekannte Doppel-Verortungen (Altbestand; Boy-Scout-Regel: bei Berührung konsoli
Ticket-Beziehungen (30.09.2026, `doc/ticket_relations_plan.md`): `tickets/waiting.rb` ist der
EINE Besitzer von „wartet“/„hält auf“ (`waiting`, `blocking`, `counts_for` mit fester
Abfragezahl, `for`), `tickets/cycle_check.rb` die Erreichbarkeit über eine feste Kantenliste
- (rekursive CTE, gibt nur IDs aus, endet auch bei Altbestand-Kreisen). Geschrieben wird über
+ (rekursive CTE, gibt nur IDs aus, endet auch bei Altbestand-Kreisen), und zwar NUR für
+ Warte-Kanten: die Hierarchie braucht keine, weil die Eltern nach dem Anlegen feststehen.
+ `tickets/ancestry.rb` ist der EINE Leser der Vorfahren eines Tickets (Brotkrumen): eine
+ Abfrage, endet bei Kreisen in den Daten, bleibt in Projekt und Organisation. Geschrieben wird über
`actors/create_ticket_relation.rb` (Advisory-Lock je Organisation, dann Kreis-Prüfung, dann
`save!`) und `actors/destroy_ticket_relation.rb`; beide prüfen keine Rechte, das tut der Aufrufer
(`Organisations::Tickets::RelationsController`). Seit PR 2 (Ticketseite): `tickets/waiting.rb`
diff --git a/app/services/tickets/cycle_check.rb b/app/services/tickets/cycle_check.rb
index 912dbe1..45aeb90 100644
--- a/app/services/tickets/cycle_check.rb
+++ b/app/services/tickets/cycle_check.rb
@@ -16,7 +16,9 @@
# for the organisation across this check and its write.
module Tickets
class CycleCheck
- # :parent_hierarchy joins here with deeper sub-tasks (plan §14).
+ # The sub-task hierarchy has no edge set here on purpose: a new ticket has no
+ # descendants and a saved ticket's parent is fixed (Ticket#parent_unchanged), so no
+ # parent link can close a cycle. Waiting relations are the only edges that can.
EDGES = {
waiting_relations: lambda {
TicketRelation.waiting_edges.select('ticket_relations.source_ticket_id AS from_id',