Skip to content

Merge pull request #22 from reservebtc/deploy/asterdex-2026-01-26-1411 #99

Merge pull request #22 from reservebtc/deploy/asterdex-2026-01-26-1411

Merge pull request #22 from reservebtc/deploy/asterdex-2026-01-26-1411 #99

Workflow file for this run

# CR-Markup Protocol v1.0 - CI Enforcement
#
# Ensures no invalid CR reaches production:
# - Runs deterministic test suite
# - Validates all CR files in repository
# - Blocks merge on any failure
#
# Reference: /schema/plan.md Step 12
name: CR Validation
on:
push:
branches: [main]
pull_request:
branches: [main]
# Allow manual trigger
workflow_dispatch:
jobs:
validate:
name: Validate CR-Markup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run deterministic test suite
run: npx tsx tests/run_all.ts
- name: Validate registry ID uniqueness
run: |
echo "Validating registry ID uniqueness..."
npx tsx registry/validate_id.ts --ci
- name: Validate registry type semantics
run: |
echo "Validating registry type semantics..."
npx tsx registry/validate_type.ts --ci
- name: Validate registry hierarchy
run: |
echo "Validating registry hierarchy..."
npx tsx registry/validate_hierarchy.ts --ci
- name: Validate comparison pages
run: |
echo "Validating comparison pages..."
npx tsx registry/validate_comparison.ts --ci
- name: Validate registry status
run: |
echo "Validating registry status state machine..."
npx tsx registry/validate_status.ts --ci
- name: Validate registry structure
run: |
echo "Validating registry structure..."
npx tsx registry/validate_registry.ts
- name: Validate registry updater
run: |
echo "Validating registry updater..."
npx tsx registry/registry_updater.ts
- name: Validate official sources
run: |
echo "Validating official sources..."
npx tsx registry/sources/validate_sources.ts
- name: Validate schema files
run: |
echo "Validating schema TypeScript files..."
npx tsc --noEmit --skipLibCheck schema/*.ts || true
echo "Schema files checked"
- name: Run individual module tests
run: |
echo "Running canonicalize.ts tests..."
npx tsx schema/canonicalize.ts
echo "Running hash.ts tests..."
npx tsx schema/hash.ts
echo "Running schema_validator.ts tests..."
npx tsx schema/schema_validator.ts
echo "Running forbidden_scan.ts tests..."
npx tsx schema/forbidden_scan.ts
echo "Running validate_cr.ts tests..."
npx tsx schema/validate_cr.ts
echo "Running validation_modes.ts tests..."
npx tsx schema/validation_modes.ts
echo "Running supersedence.ts tests..."
npx tsx schema/supersedence.ts
echo "Running entity_graph.ts tests..."
npx tsx schema/entity_graph.ts
echo "Running deprecation.ts tests..."
npx tsx schema/deprecation.ts
- name: Run generator module tests
run: |
echo "Running typed_generators.ts tests..."
npx tsx generators/typed_generators.ts
echo "Running cr_injection_gate.ts tests..."
npx tsx generators/cr_injection_gate.ts
echo "Running content_linter.ts tests..."
npx tsx generators/content_linter.ts
echo "Running affiliate_constraint.ts tests..."
npx tsx generators/affiliate_constraint.ts
echo "Running validation_pipeline.ts tests..."
npx tsx generators/validation_pipeline.ts
- name: Run regression and replay tests
run: |
echo "Running regression_replay.ts tests..."
npx tsx tests/regression_replay.ts
- name: Check for CR files and validate
run: |
echo "Searching for CR files..."
# Find all .cr files excluding partial drafts
# migration/cr_drafts/ contains partial CRs (cr_status=partial) which are not canonical
CR_FILES=$(find . -name "*.cr" -type f -not -path "./migration/cr_drafts/*" 2>/dev/null || true)
if [ -n "$CR_FILES" ]; then
echo "Found CR files:"
echo "$CR_FILES"
# Validate each CR file
for file in $CR_FILES; do
echo "Validating: $file"
npx tsx -e "
const fs = require('fs');
const { validateCR } = require('./schema/validate_cr');
const content = fs.readFileSync('$file', 'utf-8');
const result = validateCR(content);
if (!result.valid) {
console.error('INVALID:', '$file');
console.error('Errors:', JSON.stringify(result.errors, null, 2));
process.exit(1);
}
console.log('VALID:', '$file');
"
done
else
echo "No .cr files found in repository"
fi
- name: Validation summary
if: success()
run: |
echo "========================================"
echo " CR-Markup Validation: PASSED"
echo "========================================"
echo ""
echo "All tests passed:"
echo " - Deterministic test suite: 61 tests"
echo " - Schema module tests: 10 modules"
echo " - Generator module tests: 5 modules"
echo " - Registry validators: 7 validators"
echo " - Registry updater: verified"
echo " - Regression & replay tests: verified"
echo " - CR file validation: complete"
echo ""
echo "Zero-trust pipeline: ACTIVE"
echo "Deterministic production engine: READY"
echo "No invalid CR will reach production."
- name: Validation failed
if: failure()
run: |
echo "========================================"
echo " CR-Markup Validation: FAILED"
echo "========================================"
echo ""
echo "One or more validations failed."
echo "Please fix the issues before merging."
echo ""
echo "See logs above for details."
exit 1
# Separate job for schema validation
schema-check:
name: Schema Integrity Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Validate JSON Schema
run: |
echo "Validating cr.schema.json..."
node -e "
const schema = require('./schema/cr.schema.json');
console.log('Schema ID:', schema.\$id);
console.log('Schema title:', schema.title);
console.log('Required fields:', schema.required);
console.log('Properties count:', Object.keys(schema.properties).length);
console.log('JSON Schema is valid');
"
- name: Check schema consistency
run: |
echo "Checking schema consistency..."
npx tsx -e "
const { validateCRBlock } = require('./schema/schema_validator');
// Test that schema validator works
const validData = {
_token: 'TEST',
schema: 'CR1.0',
version: '1.0',
canonical_hash: 'sha256:a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890',
type: 'exchange',
network: 'ethereum'
};
const result = validateCRBlock(validData);
if (!result.valid) {
console.error('Schema validator inconsistency detected');
process.exit(1);
}
console.log('Schema consistency: OK');
"
# plan3.1.md enforcement
education-pages-check:
name: Education Pages Compliance (plan3.1.md)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run plan3.1.md compliance linter
run: |
echo "Running CR-Markup Protocol compliance check..."
chmod +x scripts/lint-cr-pages.sh
./scripts/lint-cr-pages.sh
- name: Compliance check passed
if: success()
run: |
echo "========================================"
echo " plan3.1.md Compliance: PASSED"
echo "========================================"
echo ""
echo "All education pages comply with:"
echo " - Step 1: Absolute Language Ban"
echo " - Step 2: Zero Inference Rule"
echo " - Step 3: Numeric & Quantitative Ban"
echo " - Step 4: Structural-Only Content Rule"
echo " - Step 5: Metadata Minimalism Law"
echo " - Step 6: Affiliate Neutrality Law"
echo " - Step 7: Temporal Erasure Rule"
- name: Compliance check failed
if: failure()
run: |
echo "========================================"
echo " plan3.1.md Compliance: FAILED"
echo "========================================"
echo ""
echo "Education pages violate plan3.1.md rules."
echo "Failure Semantics:"
echo " - FAIL = page does not exist"
echo " - No partial acceptance"
echo " - No warnings"
echo " - No auto-fixes"
exit 1