[PR #14637] [CLOSED] envconfig: fallback to default for invalid boolean env values #77052

Closed
opened 2026-05-05 09:46:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14637
Author: @siewcapital
Created: 3/5/2026
Status: Closed

Base: mainHead: envconfig/bool-default-fallback


📝 Commits (1)

  • 4357f4b envconfig: fallback to default for invalid boolean env values

📊 Changes

3 files changed (+37 additions, -5 deletions)

View changed files

📝 app/server/server_test.go (+2 -2)
📝 envconfig/config.go (+1 -1)
📝 envconfig/config_test.go (+34 -2)

📄 Description

Summary

  • fix BoolWithDefault to return the caller-provided default when an env var has an invalid boolean value
  • add focused tests for BoolWithDefault covering valid, empty, and invalid values
  • update existing behavior tests that depended on invalid values being treated as true

Why

Issue #14389 reports that invalid values (for example yes, enabled) currently behave like true, which can silently enable features. This change makes invalid input fall back to the declared default as expected.

Testing

  • go test ./envconfig ./app/server
  • go test ./... (fails locally only for app/ui and app/cmd/app due to missing generated app/dist assets; unaffected by this change)

Closes #14389


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14637 **Author:** [@siewcapital](https://github.com/siewcapital) **Created:** 3/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `envconfig/bool-default-fallback` --- ### 📝 Commits (1) - [`4357f4b`](https://github.com/ollama/ollama/commit/4357f4b3c051c8988a59763cd3d442274ff79462) envconfig: fallback to default for invalid boolean env values ### 📊 Changes **3 files changed** (+37 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `app/server/server_test.go` (+2 -2) 📝 `envconfig/config.go` (+1 -1) 📝 `envconfig/config_test.go` (+34 -2) </details> ### 📄 Description ## Summary - fix `BoolWithDefault` to return the caller-provided default when an env var has an invalid boolean value - add focused tests for `BoolWithDefault` covering valid, empty, and invalid values - update existing behavior tests that depended on invalid values being treated as `true` ## Why Issue #14389 reports that invalid values (for example `yes`, `enabled`) currently behave like `true`, which can silently enable features. This change makes invalid input fall back to the declared default as expected. ## Testing - `go test ./envconfig ./app/server` - `go test ./...` (fails locally only for `app/ui` and `app/cmd/app` due to missing generated `app/dist` assets; unaffected by this change) Closes #14389 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 09:46:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77052