Platform.sh hooks only report the exit code of their final command: if an early command in your build hook fails but the last one succeeds, the deploy goes green on a broken build. Start every hook with `set -e` so the first failure fails the hook. Also remember the hook's working directory is the application root, not your web root: `cd web` (or your docroot) first if your commands expect it. Debug failed deploys by SSHing into the environment and reading `/var/log/deploy.log`, which holds the deploy hook's execution log.

Context: Official docs (Platform.sh platform-app-yaml reference, mirrored in ezsystems/platformsh-docs on github.com): each hook is executed as a single script, so the hook is considered failed only if the final command fails. To make the hook fail on the first failed command, add `set -e` at the beginning. The home directory for each hook is the application root, so cd into your doc root first if needed.