Skip to content

[codex] fix merger post-rebase CI polling#105

Merged
jonit-dev merged 1 commit into
masterfrom
codex/fix-merger-top-level-local
May 6, 2026
Merged

[codex] fix merger post-rebase CI polling#105
jonit-dev merged 1 commit into
masterfrom
codex/fix-merger-top-level-local

Conversation

@jonit-dev
Copy link
Copy Markdown
Owner

Summary

  • remove invalid top-level local declarations from the merger script post-rebase CI polling block
  • add a focused merger smoke test that exercises the eligible PR happy path after a successful rebase

Root Cause

local is only valid inside Bash functions. The merger loop used local after a successful rebase, so an otherwise eligible PR could fail before reaching gh pr merge.

Validation

  • yarn workspace @jonit-dev/night-watch-cli vitest run src/__tests__/scripts/core-flow-smoke.test.ts -t "merger should merge"
  • bash -n scripts/night-watch-merger-cron.sh
  • yarn workspace @jonit-dev/night-watch-cli vitest run src/__tests__/scripts/core-flow-smoke.test.ts src/__tests__/scripts/night-watch-helpers.test.ts src/__tests__/scripts/helpers.test.ts
  • pre-commit hook: turbo run verify and lint-staged tasks

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

DiffGuard AI Analysis

AI Review Summary

🏆 Overall Score: 88/100

This PR adds a critical smoke test for the merger success path and fixes a variable scoping issue in the shell script. The implementation is solid with a focused scope, though the test setup complexity presents minor maintainability concerns.


✅ Key Strengths

  • Bug Fix with Clear Impact: The removal of local keywords from CI polling variables in the merger script correctly fixes a scoping issue that would prevent the polling loop from functioning as intended in nested contexts.
  • Comprehensive Test Coverage: The new smoke test thoroughly validates the complete merger flow, including assertions on both exit status and the sequence of gh CLI commands executed.
  • Safe Test Isolation: The test properly uses a fake bin directory prepended to PATH and unique temporary directories to avoid side effects on the host system.

⚠️ Areas for Improvement

  • Test Readability: The gh mock script is embedded as a multi-line string literal, making it harder to read and modify; consider extracting to a helper function or separate file if more mocks are added in the future.
  • Hardcoded Wait Times: The mock sleep script only handles 15 seconds specifically, coupling the test to the implementation's poll interval; the test could break if ci_poll changes.

🐛 Bugs Found

Bug Name Affected Files Description Confidence
Variable Scoping scripts/night-watch-merger-cron.sh The local declaration on ci_waited and ci_poll inside the loop check would cause logic failures in nested function calls (subshells) where the variables would be isolated from the polling logic. High 🟢

📋 Issues Found

Issue Type Issue Name Affected Components Description Impact/Severity
Maintainability Inline Mock Complexity core-flow-smoke.test.ts The mock gh and sleep scripts are defined inline with 40+ line strings, making the test harder to scan and maintain. Low
Testing Implementation Coupling core-flow-smoke.test.ts The sleep mock explicitly checks for argument 15, tying the test to the specific ci_poll value in the script. Low

🔚 Conclusion

This is a well-structured PR that fixes a genuine bug while adding valuable test coverage. The bug fix is critical for correct polling behavior, and the test effectively validates the happy path. Merge recommended after the bug fix is confirmed, with test maintainability as a minor follow-up.


Analyzed using z-ai/glm-5

@jonit-dev jonit-dev marked this pull request as ready for review May 6, 2026 02:18
@jonit-dev jonit-dev merged commit df9cc6e into master May 6, 2026
5 checks passed
@jonit-dev jonit-dev deleted the codex/fix-merger-top-level-local branch May 6, 2026 02:21
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