fix(settings): implement proper cascade for default settings#101
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
NewProject()in project.gogetBranchPrefix(): project → config → "task/"getBranchTemplate(): project → config → "{prefix}{slug}"getSlugMaxLength(): project → config → 40Test Plan
go build ./...- PASSgo test ./...- PASS (6 packages)go vet ./...- PASS