Skip to content

Trace-flag reads decide on the newest successful run's row count, so an ordinary run no longer hides every enabled flag (#3999 follow-up) - #4032

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/3999-trace-flags-row-count
Sep 23, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
fix/3999-trace-flags-row-count

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Fixes a regression #4030 put on dev.

Why

#4030 (#3999) anchored the trace-flag display reads on the collector's newest successful run by comparing timestamps: show the newest capture only if MAX(trace_flags.capture_time) >= MAX(collection_log.collection_time) for the collector's SUCCESS rows.

The service stamps a collection_log row when the run ENDS (DarlingObservability.LogCollectionAsync uses DateTime.UtcNow at log time), after the run's capture rows. So after every ordinary run the newest SUCCESS is a few seconds newer than its own capture, and the comparison is false. Dev currently shows no trace flags on any server in get_trace_flags and the viewer's Configuration grid, even with flags on. #4030's test only seeded the all-off case, never an ordinary run in the service's real write order.

Lite stamps collection_log at run START, so the same SQL happened to hold there. No timestamp comparison means the same thing in both products.

What changes

  • All three reads now keep the newest capture unless the newest SUCCESS wrote 0 rows: DarlingCurrentConfigReader.TraceFlagsSql (MCP), ViewerDataService.TraceFlagsSql (viewer) and LocalDataService.GetLatestTraceFlagsAsync (Lite).
  • Every capture writes the full list of flags that are on (the shared TraceFlagsCollector returns its written row count in both products), so 0 means every flag was off.
  • No SUCCESS row, or a NULL count from an old row, keeps the pre-fix reading.
  • The newest SUCCESS is read with ORDER BY collection_time DESC NULLS LAST LIMIT 1, using the existing (server_id, collection_time) index. The trace-flags collector is daily, so the walk back is at most a day of that server's log.

Test plan

🤖 Generated with Claude Code

https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv

… its timestamp, so an ordinary run no longer hides every enabled flag

#4030 compared MAX(trace_flags.capture_time) against the newest SUCCESS's
collection_time. Darling stamps collection_log when a run ENDS, after its
capture rows, so that comparison was false after every ordinary run and hid
every enabled flag in get_trace_flags and the viewer grid. Lite stamps at run
START, so the same SQL meant something different there.

All three reads (Darling MCP, Darling viewer, Lite) now keep the newest capture
unless the newest SUCCESS wrote 0 rows. Every capture writes the full list of
flags that are on, so 0 means all off. No SUCCESS row, or a NULL count, keeps
the pre-fix reading.

- Darling live test seeded in the service's real write order (capture, then an
  end-stamped log): on, all off, a failed run, on again, through BOTH readers.
  Red-watched: #4030's SQL fails step 1 with Expected [1117], Actual [].
- New Lite twin, TraceFlagsLatestRunTests, seeded in Lite's order (log
  stamped at start).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv
@erikdarlingdata
erikdarlingdata enabled auto-merge (squash) September 23, 2026 12:52
erikdarlingdata added a commit that referenced this pull request Sep 23, 2026
… one after verifying it (#4033)

On 2026-09-23 three lane PRs opened ready (#4020, #4022, #4030) were merged
from the UI before the coordinator's verification finished, and #4030 put a
regression on dev (every enabled trace flag hidden; fixed in #4032). A draft
can't be merged from the UI, so a lane now opens a draft, lists anything it
didn't run as an unchecked box, and the coordinator readies it after the
checklist read (and a review round for security PRs).


Claude-Session: https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@erikdarlingdata
erikdarlingdata merged commit 61b901f into dev Sep 23, 2026
15 of 16 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/3999-trace-flags-row-count branch September 23, 2026 13:00
erikdarlingdata added a commit that referenced this pull request Sep 26, 2026
…4438)

Adds the missing [Unreleased] CHANGELOG entries for nine merged PRs. Two more need none.

- Fixed: #3588, #3886, #3889, #3900, #3911, #4016, #4032 and #4042.
- Changed: #4157. llms.txt and CITATION.cff now match the shipped product.
- None:
  - #4332 adds RawChunkIntervalPlanner without wiring it in; the later PR that wires it carries its own entry.
  - #4398 changes tests only.
- Each entry was written from its PR's diff, with a [#N] label linking the pull request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant