fix: restore real cwd in release-gates tests (backport of #3340) - #3343
Conversation
Backport of the cwd-hygiene half of #3340 (the moduleNameMapper regex issue does not apply to develop — this branch already disables the mapper and relies on moduleFileExtensions instead). Several describe blocks reset cwd via process.chdir("/") after each test instead of the real starting directory. Jest reuses one worker process across multiple test files, so this left cwd at filesystem root for whatever test file ran next in that worker, breaking any relative-path resolution downstream (e.g. EACCES on a relative mkdir). Also adds the missing afterEach reset for GATE 5 and GATE 7, which had none at all. Refs #3340
|
Warning Review limit reachedNext included review available in 49 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
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. Comment |
📋 Changelog Quality ValidationSummary
Status✅ Validation PASSED - All entries meet quality standards How to FixRun locally: cd agents/changelog
npm run validate:changelogSee Changelog Quality Audit for details. |
PR Template RoutingBranch Type: This PR was automatically routed based on the branch naming strategy. |
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 26 seconds in the queue, including 2 seconds running CI. Required conditions to merge |
Linked issues
Refs #3340 (backport)
Summary
Backport of the
release-gates.test.jscwd-hygiene fix from PR #3341 (main).The
moduleNameMapperhalf of #3340 does not apply here —developalready disables the mapper entirely and resolves.cjs/.mjsviamoduleFileExtensionsinstead, so that part of the bug doesn't exist on this branch. Thegit tagsigning/$EDITORhang also doesn't apply —develop's tag test already uses-mand--no-sign.What does still apply: several
describeblocks inrelease-gates.test.jsresetcwdviaprocess.chdir("/")after each test instead of the real starting directory. Jest reuses one worker process across multiple test files, so this leaves the cwd at filesystem root for whatever test file runs next in that worker, breaking any relative-path resolution downstream (surfaces as e.g.EACCESon a relativemkdir). Fixed by capturing and restoring the real original cwd. Also added theafterEachreset thatGATE 5: AuthorizationandGATE 7: Approval Enforcementwere missing entirely (every other gate block had one).Verification
41 passed, 41 total(was previously observed hanging/leaving cwd corrupted in the equivalent state onmainbefore the parallel fix there).npm run teston this branch still does not complete cleanly, but for reasons unrelated to this change: this repo has a broader pre-existing pattern of scripts callingprocess.exit()at module-import time (163 files referenceprocess.exit(underscripts/), several of which arerequire()d directly by their own test files and kill the whole Jest process when their unguarded top-level logic runs in this offline environment (e.g.metrics-collection-orchestrator.cjs,validate-branch-name.js,validate-agent-specs.test.js). That's a separate, much larger audit — out of scope here. Issue #3342 tracks the first instance found; worth broadening to a repo-wide sweep rather than fixing one at a time.Changelog
Added to
CHANGELOG.mdunder[Unreleased] > Fixed.