Skip to content

Date a game's log by its newest line, not its first - #591

Open
thehobbit85 wants to merge 1 commit into
elripalda:mainfrom
thehobbit85:claude/fix-appended-log-is-not-old
Open

thehobbit85 wants to merge 1 commit into
elripalda:mainfrom
thehobbit85:claude/fix-appended-log-is-not-old

Conversation

@thehobbit85

Copy link
Copy Markdown
Contributor

What this changes

Found while auditing the crash-log reports (#356 and others).

The crash window, reports and Export Logs pick the game's newest log, but skip one that old_inside calls old: a log whose first date is more than a day before the game started, meaning a file a game renamed or copied. It read only the first date in the file's first 400 bytes. A log the game adds to on every start (an appending log file, the default for some logging libraries) begins with its first session's date. So from the day after that session, the log counted as old, and the crash written at its end was never shown.

The newest date found in the log's first 400 bytes or its last 4 KB now decides. A log the game added to today has today's date at its end. A renamed or copied log has only old dates at both ends and still counts as old.

Limits: no report in the tracker shows this directly. It's a gap in the check's own stated purpose, found while reading the crash-log code.

How you tested it

Run on macOS against eaf7ca2, with synthetic logs.

  • New test: a log that starts on 2020-01-01 and ends with today's crash line. On main it counted as old; with this change it doesn't.

  • Control test: a log with only old dates is still old.

  • Rust: 1,217 passed, 1 ignored. UI: 1,019 passed, 11 skipped. git diff --check clean.

  • npm test passes

  • node --test tests/*.test.cjs passes

  • Tried it in the launcher (npm run dev)

Checklist

  • One change per pull request
  • No version bump or patch notes (those are done at release time)
  • Does not change what developers can write in recomplauncher.json

A log the game adds to on every start begins with its first session's date. The crash log picker read only the first date, so from the day after that session such a log counted as an old renamed copy, and the crash at its end was never shown. The newest date in the log's start or end now decides; a renamed or copied log has only old dates and still counts as old.
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