Skip to content

test: guard fresh startup release verification#147

Merged
Astro-Han merged 3 commits into
devfrom
codex/test-i144-startup-guard
Apr 22, 2026
Merged

test: guard fresh startup release verification#147
Astro-Han merged 3 commits into
devfrom
codex/test-i144-startup-guard

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds release verification coverage for fresh packaged startup logs so a build that reaches server ready but never finishes desktop initialization is caught before closing startup-blocking issues.

Why

PawWork v0.2.5 exposed a first-launch loading hang tracked by #144 and confirmed again by #145. The runtime fix is already on dev; this PR hardens the release verification path so the same startup failure mode is checked before the next release is marked done.

Related Issue

Fixes #144
Fixes #145

How To Verify

bun install --frozen-lockfile
bun test scripts/verify-release.test.ts
bun test scripts/verify-release.test.ts src/main/index-sidecar-source.test.ts src/main/server.test.ts scripts/ci-smoke.test.ts
bun run typecheck

I also ran git diff --check.

Screenshots or Recordings

Not applicable. No visible UI changes.

Checklist

  • I linked the related issue, or stated why there is no issue
  • This PR has type, scope, and priority labels, or I requested maintainer labeling
  • I listed the relevant verification steps, including tests when behavior changed
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for desktop, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, or generated/local file changes when relevant
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • Documentation

    • Added a post-release smoke verification step with platform guidance for fresh-user-data startup checks (macOS and Windows) and explicit startup-log assertions.
  • Tests

    • Expanded startup-log parsing/validation tests covering version mismatches, missing markers, legacy formats, and file-read error handling.
  • Chores

    • Added startup-log verification utilities and updated the app to emit an explicit "init done" startup marker and to isolate logs for smoke runs.

@Astro-Han Astro-Han added bug Something isn't working P1 High priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions labels Apr 22, 2026
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 14 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 14 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 27421eed-7e69-45f8-bc3b-60d2a5298e94

📥 Commits

Reviewing files that changed from the base of the PR and between fad9578 and d0083be.

📒 Files selected for processing (5)
  • .github/RELEASE_CHECKLIST.md
  • packages/desktop-electron/scripts/verify-release.test.ts
  • packages/desktop-electron/scripts/verify-release.ts
  • packages/desktop-electron/src/main/index-sidecar-source.test.ts
  • packages/desktop-electron/src/main/index.ts
📝 Walkthrough

Walkthrough

Adds startup-log verification and a post-release packaged-smoke startup step: the verify-release tool now accepts a startup log file, parses the latest "app starting" section, checks packaged: true, version match, and presence of server ready, loading task finished, and init step done; docs include macOS/Windows smoke-run guidance.

Changes

Cohort / File(s) Summary
Release Verification Documentation
.github/RELEASE_CHECKLIST.md
Added a post-release "fresh packaged startup" smoke verification step with macOS (bash) and Windows (PowerShell) commands and guidance to set PAWWORK_CI_SMOKE/PAWWORK_RELEASE_STARTUP_LOG and assert startup-log markers and version.
Startup Log Validation Implementation
packages/desktop-electron/scripts/verify-release.ts
Added startupLog?: string to VerificationInput; implemented verifyStartupLog(source, expectedTag) and readStartupLogFile(path); enhanced verifyReleasePayload to include startup-log failures; updated CLI to optionally load PAWWORK_RELEASE_STARTUP_LOG.
Startup Log Validation Tests
packages/desktop-electron/scripts/verify-release.test.ts
Added extensive tests covering tag normalization failures, successful and failing startup-log cases (missing markers, version mismatches, unpackaged runs, malformed init markers), and readStartupLogFile success/error behavior; added imports and temp-file helpers.
Runtime logging / smoke isolation
packages/desktop-electron/src/main/index.ts
When CI_SMOKE_HOME is set, route Electron logs via app.setPath("logs", ...); emit an extra "init done" log line when setInitStep observes step.phase === "done".
Sidecar/startup test assertion
packages/desktop-electron/src/main/index-sidecar-source.test.ts
Updated test to assert app.setPath("logs", ...) is present when smoke home is configured and that logger.log("init done") is produced by init completion.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • docs: add release checklist #123: Prior PR that introduced the release checklist and base verify-release script which this change extends with startup-log verification and smoke-run guidance.

Poem

🐰 I hopped through logs at break of day,
Packaged flags and versions on display,
Found "server ready" and "loading task finished" too,
I stamped "init done" with a carroted view,
Hooray—fresh smoke runs, all checks pass true! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding release verification coverage for fresh startup logs as a guard against unfinished desktop initialization.
Description check ✅ Passed The PR description includes all required sections: Summary, Why, Related Issue (fixes #144 and #145), How To Verify with test commands, Screenshots/Recordings noted as N/A, and a completed checklist.
Linked Issues check ✅ Passed The PR directly addresses #144 and #145 by implementing startup log verification to catch the hang scenario where the app reaches 'server ready' but never completes desktop initialization, preventing releases with this failure mode.
Out of Scope Changes check ✅ Passed All changes are scoped to release verification (test additions, startup log validation logic) and fresh startup smoke testing setup, directly addressing the objectives of detecting the startup hang before release.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/test-i144-startup-guard

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the implementation is solid and addresses the startup verification gap. A few minor suggestions:

Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread .github/RELEASE_CHECKLIST.md
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a startup verification mechanism to the release process by adding a smoke test script to the release checklist and updating the release verification script to validate application startup logs. The feedback suggests improving the robustness of the log verification by ensuring the log version matches the expected release version, which prevents false positives from older log entries. Additionally, reviewers recommended including Windows-specific paths in the release checklist for better cross-platform support and updating the test suite to cover version mismatch scenarios.

Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated
Comment thread .github/RELEASE_CHECKLIST.md
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
@Astro-Han Astro-Han force-pushed the codex/test-i144-startup-guard branch from 4f2d6c8 to 2f1b9c0 Compare April 22, 2026 14:15

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Good addition for catching startup hangs. Found some test strictness issues worth addressing.

P1 Issues

  • Test assertions check only specific failure messages but don't verify the complete failure set, which could miss unexpected failures

P2 Issues

  • Regex pattern edge case awareness
  • readStartupLogFile test only checks error message prefix

Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated
Comment thread packages/desktop-electron/scripts/verify-release.test.ts Outdated
@Astro-Han Astro-Han force-pushed the codex/test-i144-startup-guard branch from 2f1b9c0 to ee137b8 Compare April 22, 2026 14:34

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Overall the PR is well-structured with good test coverage. Found several issues.

P1 (suggest fixing): 3 issues
P2 (record only): 7 issues
P3 (nitpick): 2 issues

See inline comments for details.

Comment thread .github/RELEASE_CHECKLIST.md
Comment thread .github/RELEASE_CHECKLIST.md
Comment thread .github/RELEASE_CHECKLIST.md
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Overall the PR is well-structured with good test coverage. Found several issues.

P1 (suggest fixing): 3 issues
P2 (record only): 7 issues
P3 (nitpick): 2 issues

See inline comments for details.

Comment thread .github/RELEASE_CHECKLIST.md
Comment thread .github/RELEASE_CHECKLIST.md
Comment thread .github/RELEASE_CHECKLIST.md
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/RELEASE_CHECKLIST.md:
- Around line 145-146: The default startup_log points to $HOME which can read a
different profile than the smoke test (PAWWORK_CI_SMOKE_HOME), causing stale
logs to be used; update the startup_log default to respect PAWWORK_CI_SMOKE_HOME
(or the local smoke_home) so the smoke-run uses the correct profile log—modify
the startup_log assignment (the startup_log variable in the diff) to use
${PAWWORK_CI_SMOKE_HOME:-$HOME} or the equivalent smoke_home-aware expansion so
that when PAWWORK_CI_SMOKE_HOME/ smoke_home is set the log path resolves under
that directory rather than $HOME/Library/Logs/PawWork/main.log.

In `@packages/desktop-electron/scripts/verify-release.test.ts`:
- Around line 316-319: The test "reports unreadable startup log files with the
path" uses a fixed path that may exist on some machines; change the test to
generate and use a unique nonexistent temp path when calling readStartupLogFile
(e.g., build a path using os.tmpdir() plus a timestamp/pid/random suffix or
create a temporary directory with fs.mkdtemp and use a guaranteed-nonexistent
filename), ensure the path does not exist before invoking readStartupLogFile,
and keep the same expected rejects.toThrow pattern so the failure message still
includes the generated path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fe9ddfbc-e916-4c8e-9b3e-1463ea2d84ac

📥 Commits

Reviewing files that changed from the base of the PR and between 68ec9cc and ee137b8.

📒 Files selected for processing (3)
  • .github/RELEASE_CHECKLIST.md
  • packages/desktop-electron/scripts/verify-release.test.ts
  • packages/desktop-electron/scripts/verify-release.ts

Comment thread .github/RELEASE_CHECKLIST.md Outdated
Comment thread packages/desktop-electron/scripts/verify-release.test.ts Outdated
@Astro-Han Astro-Han force-pushed the codex/test-i144-startup-guard branch from ee137b8 to 8b11f72 Compare April 22, 2026 14:51

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Release verification hardening is a worthwhile goal, and the test matrix is thorough. Surfacing a few issues — one P1 where the documented macOS smoke script will not find the log file as written, one P2 alias bug in the server ready check that defeats the stated hang detection goal, plus smaller polish items. See inline.

Comment thread .github/RELEASE_CHECKLIST.md
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated
Comment thread .github/RELEASE_CHECKLIST.md Outdated
Comment thread packages/desktop-electron/scripts/verify-release.ts Outdated

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

P0 (Blocking): None - code logic is sound

P1 (Should Fix): 1 issue

  • escapeRegExp helper defined only in test file, but hasStartupVersion uses the same logic inline. Consider consolidating.

P2 (Nice to Fix): 2 issues

  • RELEASE_CHECKLIST.md: script fails silently after 60s timeout without explicit Timed out waiting for ready file message
  • cleanup() does not verify if app_pid process still exists before kill

P3 (Nit): 3 issues

  • [^\n] in regex literals - minor readability concern
  • No test for version strings containing regex special chars
  • Error message prefix inconsistency (Invalid release tag vs Latest startup log does not include)

Overall: good coverage, well-tested. P1 is a minor code organization issue, P2s are documentation/script robustness nits.

Comment thread packages/desktop-electron/scripts/verify-release.test.ts
Comment thread packages/desktop-electron/scripts/verify-release.ts
Comment thread .github/RELEASE_CHECKLIST.md
@Astro-Han Astro-Han force-pushed the codex/test-i144-startup-guard branch 2 times, most recently from fad9578 to 6047797 Compare April 22, 2026 16:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/RELEASE_CHECKLIST.md:
- Around line 185-203: Save the original values of PAWWORK_CI_SMOKE,
PAWWORK_CI_SMOKE_HOME, and PAWWORK_RELEASE_STARTUP_LOG into temporary variables
before setting them, and restore those originals in the finally block (before
removing $smokeHome and stopping $app) so the caller session environment is
returned to its prior state; update the block around the Start-Process /
try...finally (referencing $env:PAWWORK_CI_SMOKE, $env:PAWWORK_CI_SMOKE_HOME,
$env:PAWWORK_RELEASE_STARTUP_LOG, $app, and the finally cleanup) to perform the
restore unconditionally.

In `@packages/desktop-electron/src/main/index-sidecar-source.test.ts`:
- Around line 7-10: Add a raw-source guard that asserts the startup readiness
log with payload is present: update the test alongside the existing toContain
checks (the ones asserting "app.setPath(\"logs\"", "const needsMigration =
false", and 'logger.log("init done")') to also toContain the `server ready`
emission including the `{ url:` payload (the same contract `verifyStartupLog()`
expects). Keep using the raw-source toContain style and place this check near
the other expectations so future logging refactors that remove or change the
`server ready { url: ... }` line will fail the source-contract test; reference
the `verifyStartupLog` contract and the `server ready`/`url` tokens when adding
the assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b6239ae3-d781-4cd1-8cfa-d7ee54e512de

📥 Commits

Reviewing files that changed from the base of the PR and between ee137b8 and fad9578.

📒 Files selected for processing (5)
  • .github/RELEASE_CHECKLIST.md
  • packages/desktop-electron/scripts/verify-release.test.ts
  • packages/desktop-electron/scripts/verify-release.ts
  • packages/desktop-electron/src/main/index-sidecar-source.test.ts
  • packages/desktop-electron/src/main/index.ts

Comment thread .github/RELEASE_CHECKLIST.md
Comment thread packages/desktop-electron/src/main/index-sidecar-source.test.ts
@Astro-Han Astro-Han force-pushed the codex/test-i144-startup-guard branch from 6047797 to d0083be Compare April 22, 2026 16:08
@Astro-Han Astro-Han merged commit b2dcee5 into dev Apr 22, 2026
21 checks passed
@Astro-Han Astro-Han deleted the codex/test-i144-startup-guard branch April 22, 2026 16:37
@coderabbitai coderabbitai Bot mentioned this pull request Apr 23, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working P1 High priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] v0.2.5 cannot restart after first launch hang [Bug] v0.2.5 first launch hangs on loading screen

1 participant