Skip to content

Process tree sibling order can shuffle between refreshes with no actual data change #91

Description

@rezdm

Problem

`DataStore::collect_data()` (src/core/services/data_store.cpp:265-271) builds `children_map[ppid]` by iterating `nodes`, which is an `std::unordered_map<int, unique_ptr>` — iteration order is unspecified and can differ between refreshes even for the exact same underlying process set (rehashing, insertion-order effects). Only root-level nodes get an explicit sort afterward (`std::ranges::sort(new_snapshot->process_tree, ...)` by pid, line 297-298); child ordering within `attach_children` just follows whatever order `children_map[ppid]` happened to be built in.

Effect: siblings under the same parent can visibly reorder from one tick to the next with nothing having actually forked/exited — distracting in the tree view, especially for processes with many children.

Fix

Sort each `children_map[ppid]` vector (e.g. by pid) after it's built, same as is already done for roots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions