Skip to content

fix: CI test isolation, audio-tts path, and version bump flow#14

Merged
nbucic merged 4 commits into
masterfrom
claude/android-interval-timer-app-JYhZc
Jul 13, 2026
Merged

fix: CI test isolation, audio-tts path, and version bump flow#14
nbucic merged 4 commits into
masterfrom
claude/android-interval-timer-app-JYhZc

Conversation

@nbucic

@nbucic nbucic commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Three independent fixes accumulated on this branch after the previous PR (#13) was merged.

1. Test isolation failures (SettingsTest, TimerProgramTest)

Root cause: 2026_04_16_081129_initial_program_seed.php is a seed migration that ran during migrate:fresh and pre-populated the settings and programs tables. Transaction rollback (used by RefreshDatabase for file-based SQLite) only undoes test-created rows — migration-seeded rows survived across tests, causing spurious count mismatches.

Fix:

  • Seed migration skips when app()->environment('testing') — tables start empty for every test
  • Setting::current() changed from self::first() to firstOrCreate([], [...defaults...]) to match its docblock ("creating it with defaults on first run") and the test that asserts count 0→1
  • phpunit.xml uses /tmp/laravel-test.sqlite (file-based) so RefreshDatabase can use real transaction rollback rather than the broken PDO-reference snapshot used for :memory:
  • tests/Pest.php drops the redundant RefreshDatabase::class from uses() (TestCase already carries it)

2. nbucic/audio-tts hardcoded dev path

Root cause: composer.json pointed the path repository to an absolute local path (/home/nikola/projects/.../packages/nbucic/audio-tts). CI couldn't resolve it, requiring a jq patching step to strip the package before composer install.

Fix:

  • Repository URL changed to ./packages/nbucic/audio-tts (relative, works in any checkout)
  • jq patching step removed from run-tests.yml
  • Replaced with composer update nbucic/audio-tts --no-install --no-interaction --quiet which re-locks the package from the relative path before install — one legitimate Composer operation, no shell munging

3. Version bump blocked by protected master branch

Root cause: bump-version.yml checked out master, bumped version.json, and git push-ed directly to master. GITHUB_TOKEN cannot bypass branch protection rules, so the push was always rejected.

Fix — shift the bump upstream into the PR:

  • New prepare-pr.yml fires on pull_request (opened / synchronize / reopened) targeting master
  • Compares version.json on the PR branch vs master; if unchanged, bumps patch version and commits to the PR branch (unprotected — no bypass needed)
  • Two independent loop guards: if: github.actor != 'github-actions[bot]' on the job + the version-comparison check in the step
  • bump-version.yml demoted to workflow_dispatch only (emergency manual escape hatch); it now opens a PR instead of pushing directly, so it also respects branch protection

No changes to branch protection rules.


Generated by Claude Code

nbucic and others added 4 commits July 13, 2026 22:48
composer.json: change repository URL from hardcoded absolute dev path to
./packages/nbucic/audio-tts so it resolves correctly in any checkout.

run-tests.yml: replace the jq patching step with a single
`composer update nbucic/audio-tts --no-install` which re-locks the
package from the relative path before install. No jq calls needed.
prepare-pr.yml: fires on PR open/sync targeting master, compares
version.json on PR branch vs master and bumps patch if unchanged. Commits
to the unprotected PR branch so no bypass of master protection is needed.
The actor check (github-actions[bot]) plus the version comparison provide
two independent guards against infinite loops.

bump-version.yml: demoted to workflow_dispatch only. Now creates a PR
instead of pushing directly, so it is also compatible with branch
protection rules.
composer update fires post-update-cmd (artisan vendor:publish) which
needs a bootstrapped app. Add --no-scripts so the hook is skipped.
@nbucic nbucic merged commit 0b32489 into master Jul 13, 2026
2 checks passed
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