Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Dec 17, 2025

Summary

This PR adds a full Rust implementation of the lino-objects-codec library, providing feature parity with the existing Python and JavaScript implementations, along with comprehensive CI/CD and release infrastructure.

Implementation Details

  • New LinoValue enum: Custom value type supporting all serializable types:

    • Null, Bool(bool), Int(i64), Float(f64), String(String)
    • Array(Vec<LinoValue>), Object(Vec<(String, LinoValue)>)
    • Note: Using a custom type instead of serde_json::Value because JSON doesn't support NaN/Infinity
  • Full API parity:

    • encode() and decode() convenience functions
    • ObjectCodec struct for direct usage
    • Helper methods like LinoValue::object(), LinoValue::array(), accessor methods
  • Features:

    • All basic types (null, bool, int, float, string)
    • Special float values (NaN, Infinity, -Infinity) - unlike JSON!
    • Collections (array, object)
    • Circular reference detection and handling
    • UTF-8 string support via base64 encoding
    • Comprehensive error handling with CodecError

CI/CD Infrastructure (Following Templates Best Practices)

  • New rust.yml workflow:

    • Lint job with cargo fmt and clippy
    • Test job on multi-OS (ubuntu, macos, windows)
    • Build job for release builds
    • Changelog fragment validation
    • Auto-release on main branch push
    • Manual release via workflow dispatch
  • Release management scripts (Node.js, using use-m):

    • create-github-release.mjs - Create GitHub releases from CHANGELOG.md
    • version-and-commit.mjs - Bump version and commit
    • bump-version.mjs - Bump version in Cargo.toml
    • collect-changelog.mjs - Collect changelog fragments
    • get-bump-type.mjs - Determine bump type from fragments
  • Changelog fragment system (rust/changelog.d/):

    • Similar to JavaScript changesets and Python scriv
    • Fragment-based changelog to prevent merge conflicts
    • Automatic collection during releases
  • Removed redundant test.yml: Tests are now integrated into language-specific workflows (js.yml, python.yml, rust.yml)

Files Added/Modified

New Files:

  • .github/workflows/rust.yml - Rust CI/CD workflow
  • rust/Cargo.toml - Updated with clippy lint configuration
  • rust/CHANGELOG.md - Rust changelog
  • rust/changelog.d/README.md - Changelog fragment documentation
  • rust/scripts/*.mjs - Release management scripts
  • rust/src/lib.rs - Main implementation with tests
  • rust/examples/basic_usage.rs - Usage example
  • rust/README.md - Rust-specific documentation

Removed:

  • .github/workflows/test.yml - Redundant, now in language-specific workflows

Test Plan

  • All 18 unit tests pass (cargo test)
  • All 3 doc tests pass
  • Code formatted with cargo fmt --check
  • No clippy warnings (cargo clippy -- -D warnings)
  • Example runs successfully (cargo run --example basic_usage)
  • JavaScript tests pass (npm test)
  • Python tests pass (pytest tests/ -v)
  • CI workflows configured for all languages

Fixes #8

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #8
@konard konard self-assigned this Dec 17, 2025
Implements a full Rust version of the Links Notation objects codec with:
- LinoValue enum supporting all types (Null, Bool, Int, Float, String, Array, Object)
- Full support for special float values (NaN, Infinity, -Infinity)
- encode() and decode() functions matching Python/JS API
- ObjectCodec struct for direct usage
- Comprehensive test coverage (18 tests)
- Basic usage example
- Documentation with rustdoc comments

Also updates:
- CI workflow to include Rust tests (cargo test, fmt, clippy)
- Main README with Rust documentation and examples

Fixes #8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Support Rust Support Rust Dec 17, 2025
@konard konard marked this pull request as ready for review December 17, 2025 18:12
@konard
Copy link
Member Author

konard commented Dec 17, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $7.755386 USD
  • Calculated by Anthropic: $5.403860 USD
  • Difference: $-2.351526 (-30.32%)
    📎 Log file uploaded as GitHub Gist (1151KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 31, 2025

Get latest changes from default branch.

And also make sure we fully support all best practices from templates:

Note that for each language we should have separate .changeset (or similar) folder.

But we can share .mjs scripts in root ./scripts folder if possible.

We should have no test.yml (it should be merged to the language versions), so end result would be 3 GitHub Workflows:

  • js.yml
  • python.yml
  • rust.yml

@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-31T08:46:42.059Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

@konard konard marked this pull request as draft December 31, 2025 08:46
konard and others added 2 commits December 31, 2025 09:47
- Add rust.yml workflow with CI/CD pipeline:
  - Lint job (cargo fmt, clippy)
  - Test job (multi-OS: ubuntu, macos, windows)
  - Build job
  - Changelog fragment check
  - Auto-release on main branch push
  - Manual release via workflow dispatch
- Add rust/changelog.d/ folder for changelog fragments
- Add Rust release management scripts (Node.js):
  - create-github-release.mjs
  - version-and-commit.mjs
  - bump-version.mjs
  - collect-changelog.mjs
  - get-bump-type.mjs
- Add CHANGELOG.md for Rust package
- Update Cargo.toml with clippy lint configuration
- Fix CodecError to derive Eq
- Remove redundant test.yml (tests are now in js.yml, python.yml, rust.yml)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@konard konard changed the title Support Rust Support Rust with CI/CD and Release Infrastructure Dec 31, 2025
@konard konard marked this pull request as ready for review December 31, 2025 09:08
@konard
Copy link
Member Author

konard commented Dec 31, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $5.123404 USD
  • Calculated by Anthropic: $3.458312 USD
  • Difference: $-1.665092 (-32.50%)
    📎 Log file uploaded as GitHub Gist (740KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit 0ef1366 into main Dec 31, 2025
8 checks passed
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.

Support Rust

2 participants