Skip to content

fix(settings): implement proper cascade for default settings#101

Merged
TechDufus merged 1 commit into
mainfrom
task/improve-setting-detection-default-agent
Jan 23, 2026
Merged

fix(settings): implement proper cascade for default settings#101
TechDufus merged 1 commit into
mainfrom
task/improve-setting-detection-default-agent

Conversation

@TechDufus
Copy link
Copy Markdown
Owner

Summary

Fixes settings not being respected when users change global defaults. Previously, global settings were eagerly copied into project settings at creation time, causing projects to be "locked" to whatever defaults existed when they were created.

Changes

  • Remove eager-copy of global defaults in project creation (app.go, model.go)
  • Remove hardcoded defaults from NewProject() in project.go
  • Add cascade helper methods in Model that properly resolve settings:
    • getBranchPrefix(): project → config → "task/"
    • getBranchTemplate(): project → config → "{prefix}{slug}"
    • getSlugMaxLength(): project → config → 40
  • Update all call sites to use cascade helpers instead of direct Project methods

Test Plan

  • go build ./... - PASS
  • go test ./... - PASS (6 packages)
  • go vet ./... - PASS
  • Verified settings cascade: project override → global config → hardcoded fallback

Previously, when creating a project, global defaults (DefaultAgent,
BranchPrefix) were eagerly copied into project settings. This "baked in"
the defaults at creation time, so changing global settings later had no
effect on existing projects.

Changes:
- Remove eager-copy of global defaults in project creation (app.go, model.go)
- Remove hardcoded defaults from NewProject() (project.go)
- Add cascade helper methods in Model that properly resolve settings:
  - getBranchPrefix(): project → config → "task/"
  - getBranchTemplate(): project → config → "{prefix}{slug}"
  - getSlugMaxLength(): project → config → 40
- Update all call sites to use cascade helpers

The existing getDefaultAgent() already followed this pattern. Now all
string/int settings cascade consistently:
1. Check project-specific override (if non-empty)
2. Check global config default (if non-empty)
3. Fall back to hardcoded default

This ensures that changing global defaults now affects all projects
unless they have explicit per-project overrides.
@TechDufus TechDufus marked this pull request as ready for review January 23, 2026 02:21
@TechDufus TechDufus merged commit 1198aea into main Jan 23, 2026
3 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