Repository navigation
Top: fixes false showTypes mismatch when baseline was not prepared - #2776
Merged
CarterLi merged 1 commit intoDec 2, 2026
Merged
Conversation
When ffPrepareTopProcesses() is skipped (for instance, when a top module is gated by condition.succeeded), startTick and preparedTypes remain 0. Previously ffDetectTopProcesses() checked options->showTypes != preparedTypes before checking startTick == 0, causing even a single top module to fail and leaving the lazy ffPrepareTopProcesses() fallback unreachable. Move the mismatch check into the else branch of if (startTick == 0) so lazy preparation runs when no baseline exists while real mismatches across modules still error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ffDetectTopProcesses()currently checksoptions->showTypes != preparedTypesunconditionally before checkingstartTick == 0.When baseline preparation is skipped — for instance, when a
topmodule is gated by"condition": {"succeeded": true}inprintJsonConfig()— bothstartTickandpreparedTypesstay0. That caused even a singletopmodule requesting CPU or disk counters to fail immediately with:and made the lazy
if (startTick == 0) { ffPrepareTopProcesses(options->showTypes); }fallback below it unreachable.Moving the
options->showTypes != preparedTypescheck into theelsebranch ofif (startTick == 0)lets an unpreparedtopmodule initialize its baseline on first use while still rejecting genuineshowTypesmismatches across modules.Before (on
devef7c04e38, config{"modules":["os",{"type":"top","waitTime":50,"condition":{"succeeded":true}}]}):After:
AI-assisted development disclosure: prepared with AI assistance; all builds, tests, and live scenarios were verified locally on CachyOS x86_64.
Changes
options->showTypes != preparedTypesguard inffDetectTopProcesses()(src/detection/top/top.c) into theelsebranch ofif (startTick == 0).Bugfixes:entry inCHANGELOG.md.Testing
cmake --build build -j(local CMake configured with-DENABLE_VULKAN=OFFbecausevulkan-headersis not installed): clean build, 0 warnings/errors.ctest --test-dir build --output-on-failure:21/21tests passed../build/fastfetch:topwithcondition.succeeded: printsOSand realTop Processesrows cleanly.condition.succeededtopmodules with differentshowTypes(["cpu"]then["disk"]): first prints processes, second reportsTop Processes: `top` modules with different `showTypes` cannot share a run.topmodules (["cpu"]then["disk"]): mismatch error preserved.["memory"]topfollowed bycondition.succeeded["cpu"]top: both print cleanly.presets/ci.jsoncexited0(excluding environment-unavailable Vulkan/DBus/network checks) and-s os:top --format jsonoutput valid JSON.Checklist