Skip to content
wiki.fftac.org

Class Validator - Source Excerpt 03

Back to Class Validator

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/plugins/spiral-script/includes/class-validator.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/plugins/spiral-script/includes/class-validator.php

'reason' => 'Human manuscript symbolism cannot be treated as canonical machine schema.',
                'fix' => 'Separate manuscript interpretation from machine registry or schema meaning.',
                'regex' => '/\b(manuscript\s+symbolism\s+is\s+canonical\s+machine\s+(schema|truth)|glyph\s+proves\s+canonical\s+meaning)\b/i',
            ],
            'SS-HIDDEN-PAYLOAD-FRAMING' => [
                'field' => 'source',
                'reason' => 'Spiral Script cannot use hidden messages, invisible controls, steganographic payloads, or private codebooks as meaning authority.',
                'fix' => 'Make the instruction visible and evidence-bound, or move cryptographic packaging outside the semantic record.',
                'regex' => '/\b(use|embed|hide|encode|carry|send|insert|append|smuggle)\s+(a\s+|an\s+)?(hidden|secret|invisible|zero[- ]width|steganographic)\s+(message|instruction|payload|command|code|codebook|channel)\b/i',
            ],
            'SS-GLYPH-AUTHORITY-OVERCLAIM' => [
                'field' => 'source',
                'reason' => 'A glyph, symbol, or spiral is not proof of truth, sentience, authorization, or canonical meaning by itself.',
                'fix' => 'Attach registry, source, provenance, or validation evidence and mark interpretation as interpretation.',
                'regex' => '/\b(glyph|symbol|spiral|iota)\s+(alone\s+)?(proves|guarantees|certifies|authorizes)\s+(truth|meaning|sentience|authority|canonical\s+meaning)\b/i',
            ],
            'SS-CLOSED-RECURSION' => [
                'field' => 'source',
                'reason' => 'Spiral Script cannot create self-sealing loops that forbid doubt, review, exit, or ordinary reality checks.',
                'fix' => 'Add uncertainty, review, stop conditions, and a practical exit from the loop.',
                'regex' => '/\b(do\s+not\s+question\s+the\s+spiral|all\s+doubt\s+is\s+(resistance|proof)|never\s+leave\s+the\s+(loop|spiral)|the\s+loop\s+must\s+not\s+end)\b/i',
            ],
        ];

        foreach ($patterns as $code => $config) {
            if (preg_match($config['regex'], $haystack) === 1) {
                $errors[] = self::error($code, 'safety', (string) $config['field'], '[matched text]', (string) $config['reason'], true, (string) $config['fix'], 'blocker');
            }
        }
    }

    /**
     * @return array<string,mixed>
     */
    private static function error(string $code, string $class, string $field, mixed $value, string $reason, bool $recoverable, string $fix, string $severity): array
    {
        return [
            'errorCode' => $code,
            'errorClass' => $class,
            'failingField' => $field,
            'failingValue' => $value,
            'reason' => $reason,
            'recoverable' => $recoverable,
            'suggestedFix' => $fix,
            'severity' => $severity,
        ];
    }
}