Skip to content

feat(core): migrate ReScript to AffineScript with 66-test suite#25

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/gallant-shannon-82193p
Jun 14, 2026
Merged

feat(core): migrate ReScript to AffineScript with 66-test suite#25
hyperpolymath merged 2 commits into
mainfrom
claude/gallant-shannon-82193p

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

  • Migrates all source modules from ReScript (.res) to AffineScript (.affine)
  • Adds tests/ directory with 66 passing tests covering ByteDetector, PathHandler, SafeWhitespace, and TextTransform
  • Adds scripts/build-all.sh for reproducible builds (deno task shell lacks POSIX for-loop)

Technical notes

Compiler workaround (issue #122): AffineScript alpha does not inline zero-arg enum variant constructors or non-imported transitive dependencies across module boundaries. scripts/build-all.sh post-patches TextTransform.deno.js after compilation to inject the three missing symbols (LF/CRLF/CR, is_invisible, concat). Tracked in upstream AffineScript issue #122.

Transform ordering fix: moved normalize_line_endings to run after trim_lines_fn; the previous ordering caused JS .trim() to strip \r from CRLF line endings (splitting on \n leaves a trailing \r per line which .trim() removes, discarding the normalization result).

Test plan

  • deno task build-all compiles all .affine.deno.js and injects workaround
  • deno test --allow-read --allow-write tests/ → 66 passed, 0 failed
  • deno task build-all && deno task test — end-to-end pipeline clean

🤖 Generated with Claude Code

@hyperpolymath
hyperpolymath enabled auto-merge (rebase) June 14, 2026 02:24
hyperpolymath and others added 2 commits June 14, 2026 03:26
- Add tests/ covering ByteDetector (17), PathHandler (17),
  SafeWhitespace (13), TextTransform (19) — all 66 pass
- Fix byte_to_hex to handle multi-byte codepoints (>0xFF)
- Move normalize_line_endings to run after trim_lines_fn so JS
  .trim() cannot strip \r from CRLF-normalized lines
- Add scripts/build-all.sh; deno.json build-all delegates to it
  (deno task shell does not support POSIX for-in loops)
- Inject missing cross-module symbols into TextTransform.deno.js
  via post-compile Python patch (compiler issue #122 workaround):
  LF/CRLF/CR constants, is_invisible helper, concat alias

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… build-all.sh

Tests (4 SonarCloud issues):
- TextTransform_test.js: remove unused `assertNotEquals` import; replace
  `assertEquals(x.length > 0, true)` with `assert(x.length > 0)` for the
  three check_constraints tests (S1128 + boolean-literal smell)
- ByteDetector_test.js: remove tautological `|| report.length > 0` clause
  from the generate_report assertion (always true for non-empty output)

Build script:
- Replace `python3 - << PYEOF` heredoc with awk + POSIX shell; python3
  is banned in this repo (CLAUDE.md) and unavailable in the Deno deploy env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hyperpolymath
hyperpolymath force-pushed the claude/gallant-shannon-82193p branch from 7b33a65 to d80aa61 Compare June 14, 2026 02:27
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 42 issues detected

Severity Count
🔴 Critical 0
🟠 High 31
🟡 Medium 11
View findings
[
  {
    "reason": "Belt.Array deprecated -- use Array (12 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/TextTransform.res",
    "action": "module_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Js.Array2 deprecated -- use Array (1 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/TextTransform.res",
    "action": "search_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Js.String2 deprecated -- use String (9 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/TextTransform.res",
    "action": "search_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Belt.Array deprecated -- use Array (11 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/ByteDetector.res",
    "action": "module_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Js.Array2 deprecated -- use Array (2 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/ByteDetector.res",
    "action": "search_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Js.String2 deprecated -- use String (25 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/ByteDetector.res",
    "action": "search_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Belt.Array deprecated -- use Array (2 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/PathHandler.res",
    "action": "module_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Js.String2 deprecated -- use String (13 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/core/PathHandler.res",
    "action": "search_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Belt.Array deprecated -- use Array (6 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/bindings/Deno.res",
    "action": "module_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  },
  {
    "reason": "Js.Array2 deprecated -- use Array (2 occurrences)",
    "type": "deprecated_api",
    "file": "/home/runner/work/empty-linter/empty-linter/src/bindings/Deno.res",
    "action": "search_replace",
    "rule_module": "migration_rules",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath disabled auto-merge June 14, 2026 02:28
@hyperpolymath
hyperpolymath merged commit e036fb7 into main Jun 14, 2026
14 checks passed
@hyperpolymath
hyperpolymath deleted the claude/gallant-shannon-82193p branch June 14, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant