@@ -136,6 +136,39 @@ async def test_get_default_project(project_repository: ProjectRepository, test_p
136136 assert default_project .is_default is True
137137
138138
139+ @pytest .mark .asyncio
140+ async def test_get_default_project_with_false_values (project_repository : ProjectRepository ):
141+ """Test that get_default_project ignores projects with is_default=False.
142+
143+ Regression test for bug where is_not(None) matched both True and False,
144+ causing MultipleResultsFound when multiple projects had different boolean values.
145+ """
146+ # Create projects with explicit is_default values
147+ project_true = await project_repository .create ({
148+ "name" : "Default Project" ,
149+ "path" : "/default/path" ,
150+ "is_default" : True ,
151+ })
152+
153+ await project_repository .create ({
154+ "name" : "Not Default Project" ,
155+ "path" : "/not-default/path" ,
156+ "is_default" : False ,
157+ })
158+
159+ await project_repository .create ({
160+ "name" : "Null Default Project" ,
161+ "path" : "/null/path" ,
162+ "is_default" : None ,
163+ })
164+
165+ # Should return only the project with is_default=True
166+ default = await project_repository .get_default_project ()
167+ assert default is not None
168+ assert default .id == project_true .id
169+ assert default .name == "Default Project"
170+
171+
139172@pytest .mark .asyncio
140173async def test_get_active_projects (project_repository : ProjectRepository ):
141174 """Test getting all active projects."""
0 commit comments