Skip to content

test(portal): wait for the interpreter to run its script before reading argv - #1419

Merged
devswha merged 1 commit into
mainfrom
fix/portal-test-wait-ready
Oct 19, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/portal-test-wait-ready

Conversation

@devswha

@devswha devswha commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Change

server/portal.test.ts "does not treat an arbitrary interpreter as a Portal script" read /proc/<pid>/cmdline as soon as the child was alive. Right after Bun.spawn the child can still show the parent's argv until the interpreter has started the script, so the test failed intermittently on CI (Fast checks on #1407, #1360 and #1352 today; each passed on rerun).

The fixture script now prints READY once it runs, and the test waits for that line (bounded, 2 s) before reading argv. No production code changes.

This is the test commit from #1407 (dbdc8d1), split out so other PRs stop failing on it while #1407 is still in review.

Validation

  • HERDR_TEST_MODE=unit bun test server/portal.test.ts: 31 pass, 0 fail, three runs in a row.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfb63d92-9b30-4e7b-85b3-e24c15ff5b31
📥 Commits

Reviewing files that changed from the base of the PR and between c13aacd and 18785ab.

📒 Files selected for processing: 1
  • server/portal.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Improved coverage for resuming saved Portal state when an unrelated interpreter is running, including checks that the interpreter is ready before resumption and remains active afterward.

The unrelated-interpreter test now waits for a READY message on captured stdout before resuming saved Portal state. It then checks that the interpreter remains alive.

Changes: Unrelated interpreter startup

Layer / File(s) Summary
Wait for interpreter readiness
server/portal.test.ts
The test fixture prints READY to captured stdout. The test reads the output with a bounded wait, releases the reader lock, and removes the previous live-PID startup polling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Suggested reviewers: rabbitson87

Merge Risk: ⚪ Minimal · up to 18785

This change synchronizes a test with interpreter startup; no material merge-blocking risk is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description includes both required sections, Change and Validation. It clearly explains the intermittent test failure, the bounded READY wait, the absence of production changes, and the repeated v…
Title check Passed The title clearly and concisely describes the main test change: waiting for the interpreter to run its script before reading argv.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes both required sections, Change and Validation. It clearly explains the intermittent test failure, the bounded READY wait, the absence of production changes, and the repeated validation result.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@devswha

devswha commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

Test-only change; merged on the required checks and the merge pass's omo review (PASS, LOW notes only). CodeRabbit did not review it (allowance ran out).

@devswha
devswha merged commit a54cb4f into main Oct 19, 2026
17 checks passed
@devswha
devswha deleted the fix/portal-test-wait-ready branch October 19, 2026 20:00
devswha added a commit that referenced this pull request Oct 22, 2026
…esuming (#1638)

## Change

`server/portal.test.ts` "does not stop an unrelated process whose argv
merely mentions expose and the identity path" called `resume()` right
after `Bun.spawn`. Until the shell has exec'd, `/proc/<pid>/cmdline` can
still show the parent's argv or read empty mid-exec, so
`identifyProcess()` threw `Could not verify the identity of recorded
Portal process <pid>`.

It failed Fast checks on main twice today (runs 39733017457 after #1590
and 39734683255 after #1594; the runs in between passed). The test dates
from #746; it started showing up under today's CI load.

The shell now prints `READY` before its loop and the test waits for that
line (bounded) before resuming, the same fix #1419 made for the sibling
interpreter test. No production code changes.

## Validation

- `HERDR_TEST_MODE=unit bun test server/portal.test.ts`: 38 pass, 0
fail, three runs in a row.

Test-only change: no changelog fragment, no CodeRabbit re-review needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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