A worker that is spawned has arguments, not runtime modes
This commit is contained in:
+24
-7
@@ -83,7 +83,8 @@ done
|
|||||||
# and handled as soft checks — see OPERATIONAL MODEL.
|
# and handled as soft checks — see OPERATIONAL MODEL.
|
||||||
spec_for() {
|
spec_for() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
sh|tools) echo "PURPOSE|OPERATIONAL MODEL|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|RUNTIME MODES" ;;
|
sh) echo "PURPOSE|OPERATIONAL MODEL|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|RUNTIME MODES" ;;
|
||||||
|
tools) echo "PURPOSE|OPERATIONAL MODEL|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|RUNTIME MODES/ARGUMENTS" ;;
|
||||||
api) echo "PURPOSE|OPERATIONAL MODEL|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|REQUEST|RESPONSE|DEPENDS ON" ;;
|
api) echo "PURPOSE|OPERATIONAL MODEL|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|REQUEST|RESPONSE|DEPENDS ON" ;;
|
||||||
include) echo "PURPOSE|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|EXPORTS" ;;
|
include) echo "PURPOSE|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|EXPORTS" ;;
|
||||||
pages) echo "PURPOSE|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|RENDERS|DEPENDS ON" ;;
|
pages) echo "PURPOSE|DESIGN PRINCIPLES|OPERATIONAL SAFEGUARDS|RENDERS|DEPENDS ON" ;;
|
||||||
@@ -91,6 +92,13 @@ spec_for() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
role_for() {
|
role_for() {
|
||||||
|
# A PHP file that refuses to run outside the CLI is a script, wherever it is filed.
|
||||||
|
# api/docker_pull_worker.php lives beside the endpoints because docker_action.php spawns it,
|
||||||
|
# but it takes argv and never a request — judging it on REQUEST and RESPONSE would mean
|
||||||
|
# inventing a contract it does not have.
|
||||||
|
if [[ "$1" == *.php ]] && grep -q "PHP_SAPI !== 'cli'" "$1" 2>/dev/null; then
|
||||||
|
echo "tools"; return
|
||||||
|
fi
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*.sh) echo "sh" ;;
|
*.sh) echo "sh" ;;
|
||||||
*/Plugin/*/Tools/*.php) echo "tools" ;;
|
*/Plugin/*/Tools/*.php) echo "tools" ;;
|
||||||
@@ -130,12 +138,21 @@ while IFS= read -r f; do
|
|||||||
present=()
|
present=()
|
||||||
missing=()
|
missing=()
|
||||||
for s in "${want[@]}"; do
|
for s in "${want[@]}"; do
|
||||||
n=$(grep -c "^$m $s\$" "$f")
|
# A spec entry may name alternatives with "/". RUNTIME MODES/ARGUMENTS is the only one:
|
||||||
case "$n" in
|
# a worker that is spawned rather than run has no modes an operator can choose, and both
|
||||||
0) missing+=("$s") ;;
|
# spawned workers in the tree document ARGUMENTS instead. Demanding RUNTIME MODES there
|
||||||
1) present+=("$s") ;;
|
# would mean writing an invocation nobody performs.
|
||||||
*) present+=("$s"); problems+=("duplicate section: $s appears $n times") ;;
|
found=""
|
||||||
esac
|
IFS='/' read -ra alts <<< "$s"
|
||||||
|
for a in "${alts[@]}"; do
|
||||||
|
n=$(grep -c "^$m $a\$" "$f")
|
||||||
|
if [[ "$n" -gt 1 ]]; then
|
||||||
|
present+=("$a"); problems+=("duplicate section: $a appears $n times"); found="$a"; break
|
||||||
|
elif [[ "$n" -eq 1 ]]; then
|
||||||
|
present+=("$a"); found="$a"; break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[[ -z "$found" ]] && missing+=("${s//\// or }")
|
||||||
done
|
done
|
||||||
if [[ ${#missing[@]} -gt 0 ]]; then
|
if [[ ${#missing[@]} -gt 0 ]]; then
|
||||||
problems+=("missing: $(IFS=', '; echo "${missing[*]}")")
|
problems+=("missing: $(IFS=', '; echo "${missing[*]}")")
|
||||||
|
|||||||
Reference in New Issue
Block a user