@@ -345,3 +345,31 @@ fn test_publish_board_with_description() {
345345 let staging_dir = find_staging_dir ( & sb, "DescBoard" ) ;
346346 assert_snapshot ! ( "publish_with_description" , sb. snapshot_dir( & staging_dir) ) ;
347347}
348+
349+ /// Test that `pcb publish` works when run from the board directory with a relative .zen path.
350+ /// Regression test: previously, `pcb publish DM0002.zen` from `boards/DM0002/` would fail
351+ /// with "No lockfile found" because workspace discovery broke on the empty parent path.
352+ #[ test]
353+ fn test_publish_board_from_board_dir ( ) {
354+ let mut sb = Sandbox :: new ( ) ;
355+ sb. cwd ( "src" )
356+ . write ( "pcb.toml" , PCB_TOML )
357+ . write ( "boards/pcb.toml" , BOARD_PCB_TOML )
358+ . write ( "boards/modules/LedModule.zen" , LED_MODULE_ZEN )
359+ . write ( "boards/TestBoard.zen" , TEST_BOARD_ZEN )
360+ . hash_globs ( [ "*.kicad_mod" , "**/diodeinc/stdlib/*.zen" , "**/netlist.json" ] )
361+ . ignore_globs ( [ "layout/*" , "**/vendor/**" , "**/build/**" ] )
362+ . init_git ( )
363+ . commit ( "Initial commit" ) ;
364+
365+ // Build first to generate lockfile
366+ sb. run ( "pcb" , [ "build" , "boards/TestBoard.zen" ] )
367+ . run ( )
368+ . expect ( "build failed" ) ;
369+
370+ // Run publish from the board directory with a relative path
371+ sb. cwd ( "src/boards" )
372+ . run ( "pcb" , source_only_args ( "TestBoard.zen" ) )
373+ . run ( )
374+ . expect ( "publish from board dir with relative path should work" ) ;
375+ }
0 commit comments