Carry the level everywhere a position is drawn, and gate it per occurrence
This commit is contained in:
@@ -169,21 +169,44 @@ fi
|
||||
# whether all of them travel with their level, because reading them by eye is
|
||||
# how the twentieth gets missed.
|
||||
echo "==> Checking that emitted map positions carry their level (ADR-017)..."
|
||||
POSITION_FILES=$(grep -rln "'mapx':" --include='*.py' shopdb/ plugins/ 2>/dev/null \
|
||||
| grep -v '/tests\?/' || true)
|
||||
# PER OCCURRENCE, not per file. The file-level form passed a module that emitted
|
||||
# 'mapx' six times and 'levelid' once, and two payloads shipped without a level:
|
||||
# the toner report and the enforcement report, both feeding a hover preview that
|
||||
# then said "no level". Every 'mapx' must have a 'levelid' in the same literal -
|
||||
# the window is wide enough for a comment between them, and no wider.
|
||||
MISSING_LEVEL=""
|
||||
for candidate in $POSITION_FILES; do
|
||||
if ! grep -q "'levelid'" "$candidate"; then
|
||||
MISSING_LEVEL="$MISSING_LEVEL$candidate"$'\n'
|
||||
while IFS= read -r hit; do
|
||||
[ -z "$hit" ] && continue
|
||||
file=${hit%%:*}
|
||||
line=${hit#*:}; line=${line%%:*}
|
||||
if ! sed -n "${line},$((line + 8))p" "$file" | grep -q "'levelid'"; then
|
||||
MISSING_LEVEL="$MISSING_LEVEL$file:$line"$'\n'
|
||||
fi
|
||||
done
|
||||
done <<EOF
|
||||
$(grep -rn "'mapx':" --include='*.py' shopdb/ plugins/ scripts/ 2>/dev/null | grep -v '/tests\?/' || true)
|
||||
EOF
|
||||
if [ -n "$MISSING_LEVEL" ]; then
|
||||
echo "FAIL: these emit 'mapx' but never 'levelid' - a position with no level"
|
||||
echo " cannot be rendered on the right drawing:"
|
||||
echo "FAIL: these emit 'mapx' with no 'levelid' beside it - a position with no"
|
||||
echo " level cannot be drawn on the right floor plan (ADR-017):"
|
||||
echo "$MISSING_LEVEL" | sed 's/^/ /'
|
||||
VIOLATIONS=$((VIOLATIONS + 1))
|
||||
fi
|
||||
|
||||
# The same rule for the hover preview: binding coordinates into
|
||||
# LocationMapTooltip without a level makes it report "no level" for every asset,
|
||||
# which is exactly what shipped in 0.11.0 - all seven call sites missed it.
|
||||
TOOLTIP_MISSING=""
|
||||
for candidate in $(grep -rl "LocationMapTooltip" --include='*.vue' frontend/src plugins/ 2>/dev/null | grep -v plugins-staged || true); do
|
||||
grep -q ':left=' "$candidate" || continue
|
||||
grep -q ':levelid=' "$candidate" || TOOLTIP_MISSING="$TOOLTIP_MISSING$candidate"$'\n'
|
||||
done
|
||||
if [ -n "$TOOLTIP_MISSING" ]; then
|
||||
echo "FAIL: these bind LocationMapTooltip coordinates without :levelid, so the"
|
||||
echo " preview cannot know which drawing to use (ADR-017):"
|
||||
echo "$TOOLTIP_MISSING" | sed 's/^/ /'
|
||||
VIOLATIONS=$((VIOLATIONS + 1))
|
||||
fi
|
||||
|
||||
# ENFORCING. It was report-only while the backlog was worked off, and the hit
|
||||
# count then did not move for weeks - a rule that only prints is read as no rule.
|
||||
# Set SITE_LITERALS_ENFORCE=0 to drop back to reporting for a local run.
|
||||
|
||||
Reference in New Issue
Block a user