Skip to content

Convert YAML boolean defaults to strings#2232

Merged
notAreYouScared merged 1 commit intopelican-dev:mainfrom
gOOvER:yamlimport
Feb 13, 2026
Merged

Convert YAML boolean defaults to strings#2232
notAreYouScared merged 1 commit intopelican-dev:mainfrom
gOOvER:yamlimport

Conversation

@gOOvER
Copy link
Contributor

@gOOvER gOOvER commented Feb 13, 2026

Problem:
When importing eggs from YAML format, boolean values (true/false) were being converted to integers (1/0) when saved to the database. This broke validation rules like in:true,false that require exact string matches.

Root Cause:
Symfony YAML parser correctly converts YAML booleans to PHP booleans
Laravel automatically converts PHP booleans to integers when saving to TEXT fields
Result: default_value: true → stored as "1" instead of "true"

Solution:
Added explicit conversion of boolean values to their string representations ("true"/"false") in EggImporterService::parse() before saving to the database.

Impact:
Variables with rules: in:true,false now work correctly after YAML import

Backwards compatible: quoted boolean strings in YAML remain unchanged
Only affects actual YAML boolean values (unquoted true/false)

When importing egg variables, convert boolean default_value entries to 'true'/'false' strings to prevent Laravel from coercing them to 1/0 when saving to TEXT fields. This preserves validation rules like "in:true,false". Implemented by mapping over parsed['variables'] in EggImporterService and normalizing boolean defaults.
Copilot AI review requested due to automatic review settings February 13, 2026 17:41
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Added a normalization step in EggImporterService::parse to convert boolean default_value entries in YAML-parsed variables to string representations ('true'/'false') to prevent Laravel from storing them as numeric 1/0 in TEXT fields.

Changes

Cohort / File(s) Summary
Variable Normalization
app/Services/Eggs/Sharing/EggImporterService.php
Added boolean-to-string normalization for variable default values during YAML parsing to ensure consistent storage in TEXT database fields.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Convert YAML boolean defaults to strings' directly reflects the main change in the pull request - converting boolean values to strings during YAML import.
Description check ✅ Passed The description clearly relates to the changeset, explaining the problem, root cause, solution, and impact of the boolean-to-string conversion in YAML egg imports.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where YAML boolean values (true/false) in egg variable default values were being incorrectly converted to integers (1/0) when saved to the database, breaking validation rules like in:true,false that require exact string matches.

Changes:

  • Added boolean-to-string conversion logic in EggImporterService::parse() to convert PHP boolean values to their string representations ("true"/"false") before saving to the database

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@notAreYouScared notAreYouScared merged commit adb6678 into pelican-dev:main Feb 13, 2026
22 of 23 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments