Skip to content

fix: test breaking caused by race in non-idempotent create folder op#1346

Merged
leonardmq merged 1 commit intomainfrom
leonard/kil-614-fix-ci-failing-for-main
Apr 24, 2026
Merged

fix: test breaking caused by race in non-idempotent create folder op#1346
leonardmq merged 1 commit intomainfrom
leonard/kil-614-fix-ci-failing-for-main

Conversation

@leonardmq
Copy link
Copy Markdown
Collaborator

What does this PR do?

Non-idempotent folder creation op seems to break tests on main due to a race.

Checklists

  • Tests have been run locally and passed
  • New tests have been added to any work in /lib

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 18d0d0c8-2fe9-4895-820b-86b8737a9e4e

📥 Commits

Reviewing files that changed from the base of the PR and between 8df3e3d and c7a7375.

📒 Files selected for processing (1)
  • libs/core/kiln_ai/utils/config.py

Walkthrough

A minor refactor of the Config.settings_dir() method that removes an explicit os.path.exists() check and instead relies on os.makedirs() with exist_ok=True for cleaner, more idempotent directory creation logic.

Changes

Cohort / File(s) Summary
Config Directory Creation
libs/core/kiln_ai/utils/config.py
Simplified settings_dir(create=True) to use os.makedirs(..., exist_ok=True) directly instead of conditional existence check, making the call idempotent without behavior changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • scosman
  • sfierro

Poem

🐰 A tiny hop through config land,
No more double-checks on hand!
With exist_ok=True, so clean and neat,
Our settings directory can't be beat! 🎩✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the specific issue being fixed: a race condition in a non-idempotent folder creation operation that breaks tests, directly matching the actual change of making the operation idempotent.
Description check ✅ Passed The PR description covers the main issue and includes completed checklists, but is missing the 'Related Issues' section and the 'Contributor License Agreement' confirmation required by the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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 leonard/kil-614-fix-ci-failing-for-main

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 and usage tips.

Copy link
Copy Markdown
Contributor

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

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 updates the configuration utility to use os.makedirs with exist_ok=True for creating the settings directory, simplifying the logic. A review comment suggests enhancing security by explicitly setting the directory permissions to 0o700 to protect sensitive data like API keys.

Comment thread libs/core/kiln_ai/utils/config.py
@github-actions
Copy link
Copy Markdown

📊 Coverage Report

Overall Coverage: 45%

Diff: origin/main...HEAD

  • libs/core/kiln_ai/utils/config.py (0.0%): Missing lines 285-286

Summary

  • Total: 2 lines
  • Missing: 2 lines
  • Coverage: 0%

Line-by-line

View line-by-line diff coverage

libs/core/kiln_ai/utils/config.py

Lines 281-290

  281 
  282     @classmethod
  283     def settings_dir(cls, create=True) -> str:
  284         settings_dir = os.path.join(Path.home(), ".kiln_ai")
! 285         if create:
! 286             os.makedirs(settings_dir, exist_ok=True)
  287         return settings_dir
  288 
  289     @classmethod
  290     def settings_path(cls, create=True) -> str:


@tawnymanticore tawnymanticore self-requested a review April 24, 2026 16:29
@leonardmq leonardmq merged commit f89d6b7 into main Apr 24, 2026
14 checks passed
@leonardmq leonardmq deleted the leonard/kil-614-fix-ci-failing-for-main branch April 24, 2026 16:30
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.

2 participants