Skip to content

Fix #311: resolve log path against filteredRuns to support local time mode#312

Open
cj36457 wants to merge 1 commit into
MarketSquare:mainfrom
cj36457:cj36457-fix-311-log-local-time
Open

Fix #311: resolve log path against filteredRuns to support local time mode#312
cj36457 wants to merge 1 commit into
MarketSquare:mainfrom
cj36457:cj36457-fix-311-log-local-time

Conversation

@cj36457

@cj36457 cj36457 commented Jun 25, 2026

Copy link
Copy Markdown

Closes #311.

Problem

When the "convert to local timezone" toggle is on, clicking a run on any chart shows:

Log file error: this output didn't have a path in the database so the log file cannot be found!

…even though path is non-empty in the DB and log.html exists on disk.

Root cause

In js/log.js open_log_file, the lookup compared the clicked label against the raw runs global:

var output = runs.find(run => run.run_start.slice(0, 19) === runStart.slice(0, 19))

But runs[i].run_start holds the original UTC string from the DB, while chart labels (and the clicked value) come from filteredRuns, whose run_start has been rewritten by convert_timezone / remove_timezones in filter.js to match the displayed local time. The substring compare never matches → output = undefinedpath = "" → alert.

Fix

Look up against filteredRuns first (whose run_start mirrors what the chart actually shows), then fall back to the raw runs array so filtered-out runs still resolve. The downstream update_log_path_with_id path keeps using raw runs/suites/tests — they share the original UTC timestamps internally so suite/test id lookup remains consistent.

Evidence

Added tests/javascript/log.test.js with 4 cases. Reverting just log.js while keeping the new test reproduces the issue's exact alert text:

FAIL  tests/javascript/log.test.js > open_log_file (issue #311) > resolves log path against filteredRuns when timezone is converted to local time
  Received:
    1st vi.fn() call: [ "Log file error: this output didn't have a path in the database so the log file cannot be found!" ]

With the fix applied:

✓ resolves log path against filteredRuns when timezone is converted to local time
✓ still resolves correctly in UTC mode (filteredRuns == runs run_start)
✓ falls back to raw runs when the clicked run was filtered out
✓ alerts only when no matching run exists anywhere

Test Files  12 passed (12)
Tests       232 passed (232)

Full JS suite (npm run test:js) green — no regressions.

…t local time mode

When the convert-timezone toggle is on, chart labels show local-time
run_start strings but the lookup in open_log_file compared against the
raw `runs` global which still holds UTC run_start. The substring match
failed, path resolved to empty, and the user saw a 'log file cannot be
found' alert even though the log exists on disk.

Match against filteredRuns first (whose run_start has been
converted/stripped to mirror chart labels), then fall back to the raw
runs array for runs that may have been filtered out.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@timdegroot1996

Copy link
Copy Markdown
Collaborator

Ah you already started an implementation. I will look it over and add some comments if I have any. If you make any updates be sure to ping me so I can trigger the tests. Since right now you are a first time contributor I have to manually start them. The next PR will start them automatically 👍

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.

[Bug] Chart click on run shows "log file cannot be found" alert when UI is in local time mode

2 participants