Skip to content

fix(automata): correct URL validation in AutomataPath::from_remote() - #733

Merged
AlexMikhalev merged 1 commit into
mainfrom
task/139-fix-url-validation
Mar 30, 2026
Merged

AlexMikhalev merged 1 commit into
mainfrom
task/139-fix-url-validation

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Summary

  • Fix De Morgan's law logic bug in AutomataPath::from_remote() URL validation: !a || !b (always true) changed to !a && !b
  • Add scheme-specific prefixes (http://, https://) instead of bare http/https
  • Add 5 unit tests covering valid HTTP/HTTPS URLs and rejection of FTP, file paths, and empty strings

Impact

Remote thesaurus loading was completely broken -- all URLs were rejected by the validator.

Fixes #139

Test plan

  • cargo test -p terraphim_automata test_from_remote -- 5/5 pass
  • cargo test -p terraphim_automata -- all 50 tests pass
  • cargo clippy -p terraphim_automata -- clean
  • cargo fmt -- clean

Generated with Terraphim AI

…ote()

The condition used `||` (OR) instead of `&&` (AND), causing De Morgan's law
to make the check always evaluate to true -- rejecting all URLs including
valid http:// and https:// ones. Also adds scheme-specific prefixes
(http:// and https://) instead of bare "http"/"https".

Fixes #139

Co-Authored-By: Terraphim AI <noreply@anthropic.com>
@AlexMikhalev
AlexMikhalev merged commit e7eb709 into main Mar 30, 2026
29 checks passed
@AlexMikhalev
AlexMikhalev deleted the task/139-fix-url-validation branch March 30, 2026 11:25
AlexMikhalev added a commit that referenced this pull request Apr 25, 2026
…ote() (#733)

The condition used `||` (OR) instead of `&&` (AND), causing De Morgan's law
to make the check always evaluate to true -- rejecting all URLs including
valid http:// and https:// ones. Also adds scheme-specific prefixes
(http:// and https://) instead of bare "http"/"https".

Fixes #139

Co-authored-by: Terraphim AI <noreply@anthropic.com>
AlexMikhalev added a commit that referenced this pull request May 1, 2026
…ote() (#733)

The condition used `||` (OR) instead of `&&` (AND), causing De Morgan's law
to make the check always evaluate to true -- rejecting all URLs including
valid http:// and https:// ones. Also adds scheme-specific prefixes
(http:// and https://) instead of bare "http"/"https".

Fixes #139

Co-authored-by: Terraphim AI <noreply@anthropic.com>
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