Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #136.
Adding two sites whose folders share a name (e.g. two projects each with a
platformfolder) silently overwrote the first: the folder name becomes the site name, andConfig.Upsertreplaced the stored site by name, so only the second folder was ever served. The first site's path was lost with no warning.Change (in
internal/config/config.go):Upsertnow refuses when a linked site with the same name already points at a different folder, with an error naming the existing path and the remedy: unlink it first if the project moved, or link the folder under a different name (flock link <name>). The guard compares paths after symlink resolution, so the same folder spelled two ways still re-links.Because the guard lives in
Upsert, it covers every way a site is added:flock link, the GUI's add-site form (POST /v1/sites, which already surfacesUpserterrors as a 400), and the MCP site tools.Tests:
TestUpsertRefusesSameNameForAnotherPathininternal/config/config_test.go: same folder re-links fine; a second folder under the same name fails with an error naming the first path, and the stored site is untouched. The test fails on the old code and passes with the fix. The first version of this guard also covered parked-discovered names, which broke the existingTestAllSitesMergesParkedAndLinkedSitespromotion case — the guard now only fires for stored linked sites.go test ./internal/config/ ./internal/cli/ ./internal/api/ ./internal/mcpserver/all green;gofmtandgo vetclean.