Same as Molotov-Ribbentrop pact, signed four years later. When you sign such documents you have mutual understanding in what cases there will be war, and what - won't. And, definitely there were secret appendix's to mark the sides red lines.
Of course it wasn't just spontaneous decision. It had to be coordinated with at least, Germany, Hungary, and, highly likely - with Great Britain and France. It wasn't coordinated with Russia, which, laterly caused Russian liberation of Polish-occupied land of Western Ukraine and Western Belarus.
You don't have such reasons mostly because you don't posses information. But British government was pleased with this alliance exactly because it decreased possibility of war in the case of German remilitarisation of Rhineland.
France wanted to react (at least it was what their diplomats said), but without British and Polish support (or, at least neutrality) it would be at least bloody mess, and quite possibly - defeat.
In 1936, war between Germany from one side and French-British-Polish alliance from another side might be a merely "police operation" (as it was supposed to be), but the war between France from one side and Germany-England-Poland alliance from the other side was, quite likely, might become a catastrophe.
Germany started to build Sigfrid line only in 1936. Exactly because Poland allowed them to do it.