Skip to content

Major/2.0.0 - #20

Merged
lupodevelop merged 10 commits into
mainfrom
major/2.0.0
Jan 24, 2026
Merged

Major/2.0.0#20
lupodevelop merged 10 commits into
mainfrom
major/2.0.0

Conversation

@lupodevelop

Copy link
Copy Markdown
Owner

This pull request is a major release (v2.0.0) that completes the transition to a unified, single-module API for the str library. It consolidates all public functionality under a single entry point, introduces a new str/advanced module for power users, and removes deprecated APIs. The internal structure has been reorganized for clarity, and documentation has been improved. This release contains breaking changes, so users should update their imports and review the new API surface.

API Consolidation and Breaking Changes

  • All public APIs from str/core, str/extra, and str/tokenize are now internal; users should import from str instead. Deprecated APIs have been removed, and types like SearchStrategy and FillPosition are re-exported directly from str. (CHANGELOG.md, src/str/internal/core.gleam) [1][2][3]
  • The internal modules have been moved to str/internal/*, and the version is bumped to 2.0.0. (gleam.toml, CHANGELOG.md) [1][2]

New Advanced Module

  • Introduced str/advanced for low-level control and benchmarking, exposing direct access to KMP and sliding-window algorithms, as well as helper types and strategy selection. (src/str/advanced.gleam, CHANGELOG.md) [1][2]

Documentation and Quality of Life

  • Improved documentation with module-level docs and comprehensive examples. (CHANGELOG.md)
  • Added a CI badge to the README.md for better project visibility. (README.md)

Deprecation and Cleanup

  • All @deprecated annotations for soon-to-be-removed APIs have been removed from internal code, as these APIs are now internal and not intended for public use. (src/str/internal/core.gleam) [1][2]

Please review the changelog for migration steps and details on new and changed APIs.

Refactored the main `str` module to re-export all public functions from internal modules, providing a unified and comprehensive API surface. Added extensive documentation, grouped functions by category, and exposed advanced features, configuration, and internal types. Deprecated annotations were removed from internal/core.gleam as those functions are now only used internally. File and directory structure was updated to move implementation modules under `str/internal/`.
Introduces src/str/advanced.gleam with low-level string search algorithms and helpers, including KMP and sliding-window implementations for power users. Also adds simple variants of index_of and count to src/str.gleam for direct algorithm access.
Included a GitHub Actions CI badge in the README to display the current status of the continuous integration workflow.
Introduces tests for smart search defaults and strategy selection in the string module, including cases for minimum pattern length and small patterns.
Prevents benchmark results from being tracked by git by adding 'benchmark/results/' to the .gitignore file.
Documents the major 2.0.0 release, highlighting the migration to a single-module architecture, breaking changes, new advanced APIs, type re-exports, and improved documentation. Notes deprecations and internal restructuring.
Update the project version from 1.2.3 to 2.0.0 to reflect new changes or a major release.
CopilotAI review requested due to automatic review settings January 24, 2026 10:00
lupodevelopand others added 3 commits January 24, 2026 11:01
Improved code formatting in src/str/advanced.gleam for readability, updated import style, and adjusted type definitions. Cleaned up imports in test/str_config_test.gleam and reformatted assertions in test/str_core_test.gleam for consistency.
@lupodevelop
lupodevelop merged commit 2371a97 into mainJan 24, 2026
1 check passed
@lupodevelop
lupodevelop deleted the major/2.0.0 branch January 24, 2026 10:02

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a major 2.0.0 release that consolidates the library behind a single str entrypoint, introduces an str/advanced module for low-level search control, and moves implementation details into str/internal/* while cleaning up deprecations and improving documentation.

Changes:

  • Unified the public API under import str, re-exporting all previous str/core, str/extra, and str/tokenize functionality (including SearchStrategy and FillPosition) and updating all tests to call through the unified module.
  • Introduced new internal modules for transliteration and decomposition (str/internal/translit, str/internal/decompose, updated str/internal/extra and str/internal/tokenize) and a new str/advanced module exposing low-level KMP/sliding search primitives and caching helpers.
  • Bumped the library to v2.0.0, documented the breaking changes and new API in CHANGELOG.md, added a CI badge, and slightly updated configuration and ignore patterns.

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
gleam.tomlBumps package version to 2.0.0, reflecting the major breaking release.
CHANGELOG.mdDocuments the 2.0.0 unified API, breaking changes, new str/advanced module, and configuration notes.
README.mdAdds a CI badge and keeps general docs aligned with the new single-module API (note: badge currently points to a CI workflow while the only defined workflow is named test).
.gitignoreIgnores benchmark/results/, isolating benchmark artifacts from version control.
src/str.gleamReplaces the old re-export shim with a full, documented public surface: defines public FillPosition and SearchStrategy types, wraps nearly all core/extra/tokenize functions, exposes advanced KMP/sliding helpers, tokenizers, and configuration getters under a single str module.
src/str/advanced.gleamNew public module exposing low-level KMP and sliding-window search APIs and KMP map caching; choose_search_strategy/2 currently returns the internal str/internal/core.SearchStrategy type rather than the public str.SearchStrategy.
src/str/config.gleamCentralizes heuristic configuration for search (KMP thresholds and a smart_search_enabled/0 flag) and is re-exposed via str.
src/str/internal/core.gleamRemoves @deprecated annotations from internal functions now re-exposed via str, keeps KMP and sliding search implementations, and retains the heuristic SearchStrategy chooser used by _auto and explicit strategy APIs.
src/str/internal/extra.gleamRefactors ASCII folding and slugification to use new internal decompose and translit modules, keeping behavior while clarifying pipeline docs and removing deprecations.
src/str/internal/tokenize.gleamCleans up the pure-Gleam grapheme tokenizer implementation by removing deprecation tags; now used via str.chars/1 and str.chars_stdlib/1.
src/str/internal/translit.gleamNew internal module containing the ASCII transliteration table and a helper to strip Unicode combining marks; lookup is used by internal extra/slug APIs.
src/str/internal/decompose.gleamNew internal module implementing limited Latin decomposition to base+combining-mark; includes a table of decompositions, although the entries for Œ/œ are currently incorrect.
test/str_unicode_test.gleamUpdates imports to use str directly for ascii_fold and truncate_preserve Unicode tests.
test/str_tokenize_compare_test.gleamSwitches from str/tokenize to str, using str.chars and str.chars_stdlib to compare tokenizer behavior.
test/str_strategy_test.gleamUses str.choose_search_strategy and str.Sliding/str.Kmp, verifying the strategy heuristics via the public API.
test/str_strategy_explicit_test.gleamSwitches most calls to str while still using str/internal/core for low-level search-all tests; checks that explicit strategy wrappers in str match the internal implementations.
test/str_sliding_test.gleamRoutes sliding-window search tests through str.sliding_search_all, validating the re-exported advanced search helpers.
test/str_normalizer_integration_test.gleamUses str.ascii_fold_with_normalizer and str.slugify_opts_with_normalizer, ensuring normalization hooks still behave correctly through the unified API.
test/str_multilingual_test.gleamUpdates to str and str/internal/decompose for multilingual ASCII folding/slug tests and direct decomposition sanity checks.
test/str_kmp_test.gleamSwitches KMP search and prefix-table tests to str’s KMP wrappers, covering the re-exported advanced search APIs.
test/str_kmp_cache_test.gleamUses str.build_kmp_maps and str.kmp_*_with_maps to validate reuse of KMP maps via the public API.
test/str_integration_test.gleamPoints all integration-style string pipelines (truncate, slugify, casing, padding, reversing) at the unified str module.
test/str_extra_test.gleamUpdates all extra usage to str, and imports str/internal/decompose and str/internal/translit for internal helper testing (e.g., remove_combining_marks, decompose_latin).
test/str_extra_full_test.gleamUses str and str/internal/decompose to exercise full ASCII fold, slugify, and truncation edge cases through the new API.
test/str_corpus_test.gleamRoutes corpus-based folding tests through str.ascii_fold.
test/str_core_test.gleamLarge test suite updated to call the new str-based API for grapheme operations, padding, searching, validation, escaping, and more; now covers the unified entrypoint instead of str/core and str/tokenize.
test/str_config_test.gleamNew tests verifying the default smart_search_enabled/0 flag and that str.choose_search_strategy/2 honors kmp_min_pattern_len/0 thresholds.
test/str_combining_test.gleamSwitches combining-mark ASCII folding tests to str.ascii_fold.
test/str_auto_test.gleamEnsures the _auto search/count routines exposed on str match the legacy index_of/count semantics across cases.

Notable issues identified:

  • In src/str/internal/decompose.gleam, the decomposition entries for Œ/œ are incorrect ("O\u{014B}E" / "o\u{014B}e" instead of decomposing to OE/oe), which can yield wrong results for direct users of decompose_latin/1.
  • In src/str/advanced.gleam, choose_search_strategy/2 returns the internal str/internal/core.SearchStrategy type rather than the public str.SearchStrategy, unintentionally exposing an internal type through the advanced API.
  • The new CI badge in README.md targets a CI workflow name, but the only defined workflow is named test in .github/workflows/ci.yml, so the badge likely won’t reflect the actual CI status until one of them is aligned.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadREADME.md
<p align="center">
<a href="https://hex.pm/packages/str"><img src="https://img.shields.io/hexpm/v/str" alt="Package Version"></a>
<a href="https://hexdocs.pm/str/"><img src="https://img.shields.io/badge/hex-docs-ffaff3" alt="Hex Docs"></a>
<a href="https://github.com/lupodevelop/str/actions"><img src="https://img.shields.io/github/workflow/status/lupodevelop/str/CI?label=ci&logo=github" alt="CI"></a>

CopilotAIJan 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI badge URL references a CI workflow (github/workflow/status/.../CI), but the only workflow defined in .github/workflows/ci.yml is named test, so this badge is unlikely to display the correct status. Consider updating the badge to target the existing test workflow (or renaming the workflow to match the badge) using the current Shields.io GitHub Actions endpoint.

Suggested change
<ahref="https://github.com/lupodevelop/str/actions"><imgsrc="https://img.shields.io/github/workflow/status/lupodevelop/str/CI?label=ci&logo=github"alt="CI"></a>
<ahref="https://github.com/lupodevelop/str/actions"><imgsrc="https://img.shields.io/github/actions/workflow/status/lupodevelop/str/ci.yml?branch=main&label=ci&logo=github"alt="CI"></a>

Copilot uses AI. Check for mistakes.
Comment on lines +60 to +64
) -> core.SearchStrategy {
core.choose_search_strategy(text, pattern)
}

/// Helper types for users building caches.

CopilotAIJan 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

choose_search_strategy/2 returns the internal str/internal/core.SearchStrategy type, which leaks an internal module type through the public str/advanced API instead of using the public str.SearchStrategy re-export. This makes it harder to use from callers who want to avoid importing internal modules; consider returning the public str.SearchStrategy (and mapping internally) for a cleaner public surface.

Suggested change
)->core.SearchStrategy{
core.choose_search_strategy(text,pattern)
}
/// Helper types for users building caches.
)->SearchStrategy{
core.choose_search_strategy(text,pattern)
}
/// Helper types for users building caches.
pubtypeSearchStrategy=
core.SearchStrategy

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

2 participants

@lupodevelop