-
Notifications
You must be signed in to change notification settings - Fork 22
Add encode-tensogram action for Tensogram message format #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tlmquintino
wants to merge
10
commits into
develop
Choose a base branch
from
feature/encode-tensogram
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
90842f7
Add encode-tensogram action for Tensogram message format encoding
tlmquintino 9b7ef61
Add CLAUDE.md with agent guidelines for the project
tlmquintino 0984d96
Add documentation for encode-tensogram action
Claude a642df9
Fix CLAUDE.md
tlmquintino 0bc2746
Address PR review: use eckit::JSON, add validation, fix CLAUDE.md
tlmquintino 00e9bb3
Second pass: harden edge cases, clean up includes, fix docs
tlmquintino c972412
Error handling and edge case hardening
tlmquintino 3dafd9d
Improve test coverage: 6 → 16 tests covering validation and edge cases
tlmquintino 797bfcf
Fix RST table formatting in processing-pipelines docs
tlmquintino f905d01
Fix RST table column width for decimal-scale-factor key
tlmquintino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # Claude and Other Agents | ||
|
|
||
| # Guidelines | ||
|
|
||
| - NOTE: When the user's request matches an available skill: | ||
| - ALWAYS invoke it using the Skill tool as your FIRST action. | ||
| - Do NOT answer directly, do NOT use other tools first. | ||
| - The skill has specialized workflows that produce better results than ad-hoc answers. | ||
|
|
||
| - CRITICAL: Always prefer the LSP tool over Grep/Read for code navigation. | ||
| - Use it to find definitions, references, and workspace symbols. | ||
|
|
||
|
|
||
| - IMPORTANT: when planning and before you do any work: | ||
| - ALWAYS mention how you would verify and validate that work is correct | ||
| - include TDD tests in your plan | ||
| - take a behaviour driven approach | ||
| - you are very much ENCOURAGED to ask questions to get the design correct | ||
| - ALWAYS seek clarifications to sort out ambiguities | ||
| - ALWAYS provide a summary of the Design and implementation Plan | ||
|
|
||
|
|
||
| - NOTE: When the user asks for "second pass", "third pass" or "N-th pass" perform: | ||
| - simplification opportunities, | ||
| - naming/comments/docs quality review, | ||
| - scan for edge-cases and logical regression, | ||
| - in C/C++ NEVER produce undefined behavior and never segfault or stop executing without returning error or exceptions | ||
| - all documentation up-to-date with changes, | ||
| - running required formatter/lint/tests | ||
|
|
||
| - NOTE: when user asks for 'error handling' checks: | ||
| - verify no panic in rust code | ||
| - verify how errors are handled across-code base, all languages | ||
| - ensure all errors handled and reported correctly with enough information reaching users | ||
|
|
||
| - NOTE: when user asks for 'edge cases': | ||
| - look specifically edge cases | ||
| - look for undefined behaviour or ambiguities | ||
| - if necessary, ask the user to clarify | ||
|
|
||
| - NOTE: when user asks for 'code coverage': | ||
| - explore all the code base looking for code that isn't yet tested. | ||
| - Look specifically for testing edge cases. | ||
| - Aim to have at least 95% test coverage. | ||
|
|
||
| - NOTE: When user asks for 'final prep' make: | ||
| - final check everything builds, all languages and all tests pass | ||
| - all examples in all languages compile and run | ||
| - all docs build | ||
| - if successful, carefully: | ||
| - select files and contributions to git add | ||
| - ignore the build files and artifacts, don't add hidden directories | ||
| - if not in a branch, create a new properly named branch | ||
| - git commit | ||
| - make a pull request to upstream github project | ||
|
|
||
| - NOTE: when user asks to do 'pr reply' or 'pull request reply': | ||
| - check github pull request reviews | ||
| - consider them with respect to the philosophy and aims of this software | ||
| - if in doubt seek user clarifications | ||
| - fix code and address the raised issues | ||
| - update the docs/ | ||
| - make a summary and push your changes to update the PR | ||
| - poll to wait for the CI to finish running | ||
| - continue iterating until all recommendations and issues were addressed | ||
|
|
||
| - NOTE: When user asks for 'make release' execute: | ||
| - check all changes are committed and pushed upstream | ||
| - final check everything builds, all languages and all tests pass | ||
| - all examples in all languages compile and run | ||
| - all docs build | ||
| - if any of the above fails STOP and prompt the user for action | ||
| - otherwise, proceed by check the latest version upstream and in VERSION file | ||
| - if needed, bump in VERSION file, commit and tag then push to upstream | ||
| - make a Github release | ||
|
|
||
| # Design & Purpose | ||
|
|
||
| - README.md -- entry level generic information | ||
| - docs/ -- full documentation in RST format | ||
|
|
||
| # Build / lint / test (required before marking done) | ||
|
|
||
| ## Languages | ||
| This project contains C, C++, Fortran and Python code | ||
|
|
||
| # Version control | ||
| - Git project in github.com/ecmwf/multio | ||
| - Use this repository's own versioning and release processes. | ||
| - REMEMBER on releases: | ||
| - check all is committed and pushed upstream, otherwise STOP and warn user | ||
| - update the VERSION file | ||
| - git tag with version | ||
| - push and create release in github | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # (C) Copyright 2025- ECMWF. | ||
| # | ||
| # This software is licensed under the terms of the Apache Licence Version 2.0 | ||
| # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
| # In applying this licence, ECMWF does not waive the privileges and immunities | ||
| # granted to it by virtue of its status as an intergovernmental organisation | ||
| # nor does it submit to any jurisdiction. | ||
|
|
||
| # Try to find the Tensogram library (N-dimensional tensor message format) | ||
| # | ||
| # Tensogram is a Rust-core library with a C FFI layer and a C++ header-only wrapper. | ||
| # This module locates the pre-built static library and the required headers. | ||
| # | ||
| # The following paths will be searched, both in the environment and as CMake variables: | ||
| # | ||
| # TENSOGRAM_ROOT | ||
| # TENSOGRAM_DIR | ||
| # TENSOGRAM_PATH | ||
| # | ||
| # If found, the tensogram::tensogram imported target will be created. | ||
| # | ||
| # Output variables: | ||
| # tensogram_FOUND - True if tensogram was found | ||
| # TENSOGRAM_INCLUDE_DIRS - Include directories (C++ wrapper + C FFI header) | ||
| # TENSOGRAM_LIBRARIES - Libraries to link against | ||
|
|
||
| # --- Locate the C++ header-only wrapper: tensogram.hpp --- | ||
|
|
||
| find_path(TENSOGRAM_CPP_INCLUDE_DIR | ||
| NAMES tensogram.hpp | ||
| HINTS | ||
| ${TENSOGRAM_ROOT} | ||
| ${TENSOGRAM_DIR} | ||
| ${TENSOGRAM_PATH} | ||
| ENV TENSOGRAM_ROOT | ||
| ENV TENSOGRAM_DIR | ||
| ENV TENSOGRAM_PATH | ||
| PATH_SUFFIXES include | ||
| ) | ||
|
|
||
| # --- Locate the C FFI header: tensogram.h --- | ||
| # This is typically in a different include path (crates/tensogram-ffi/) | ||
|
|
||
| find_path(TENSOGRAM_FFI_INCLUDE_DIR | ||
| NAMES tensogram.h | ||
| HINTS | ||
| ${TENSOGRAM_ROOT} | ||
| ${TENSOGRAM_DIR} | ||
| ${TENSOGRAM_PATH} | ||
| ENV TENSOGRAM_ROOT | ||
| ENV TENSOGRAM_DIR | ||
| ENV TENSOGRAM_PATH | ||
| PATH_SUFFIXES include crates/tensogram-ffi | ||
| ) | ||
|
|
||
| # --- Locate the Rust static library: libtensogram_ffi.a --- | ||
|
|
||
| find_library(TENSOGRAM_LIBRARY | ||
| NAMES tensogram_ffi | ||
| HINTS | ||
| ${TENSOGRAM_ROOT} | ||
| ${TENSOGRAM_DIR} | ||
| ${TENSOGRAM_PATH} | ||
| ENV TENSOGRAM_ROOT | ||
| ENV TENSOGRAM_DIR | ||
| ENV TENSOGRAM_PATH | ||
| PATH_SUFFIXES lib lib64 target/release | ||
| ) | ||
|
|
||
| # --- Aggregate results --- | ||
|
|
||
| set(TENSOGRAM_INCLUDE_DIRS ${TENSOGRAM_CPP_INCLUDE_DIR} ${TENSOGRAM_FFI_INCLUDE_DIR}) | ||
| set(TENSOGRAM_LIBRARIES ${TENSOGRAM_LIBRARY}) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(tensogram | ||
| DEFAULT_MSG | ||
| TENSOGRAM_LIBRARY | ||
| TENSOGRAM_CPP_INCLUDE_DIR | ||
| TENSOGRAM_FFI_INCLUDE_DIR | ||
| ) | ||
|
|
||
| mark_as_advanced(TENSOGRAM_CPP_INCLUDE_DIR TENSOGRAM_FFI_INCLUDE_DIR TENSOGRAM_LIBRARY) | ||
|
|
||
| # --- Create imported target --- | ||
|
|
||
| if(tensogram_FOUND AND NOT TARGET tensogram::tensogram) | ||
|
|
||
| # The Rust static library (imported) | ||
| add_library(tensogram_ffi STATIC IMPORTED GLOBAL) | ||
| set_target_properties(tensogram_ffi PROPERTIES | ||
| IMPORTED_LOCATION "${TENSOGRAM_LIBRARY}" | ||
| ) | ||
|
|
||
| # Header-only C++ wrapper (INTERFACE) linking the Rust lib + platform libs | ||
| add_library(tensogram::tensogram INTERFACE IMPORTED GLOBAL) | ||
| set_target_properties(tensogram::tensogram PROPERTIES | ||
| INTERFACE_INCLUDE_DIRECTORIES "${TENSOGRAM_CPP_INCLUDE_DIR};${TENSOGRAM_FFI_INCLUDE_DIR}" | ||
| ) | ||
| target_link_libraries(tensogram::tensogram INTERFACE tensogram_ffi) | ||
|
|
||
| # Platform-specific system libraries required by the Rust static library | ||
| if(APPLE) | ||
| target_link_libraries(tensogram::tensogram INTERFACE | ||
| "-framework CoreFoundation" | ||
| "-framework Security" | ||
| "-framework SystemConfiguration" | ||
| "-lc++" | ||
| "-lm" | ||
| ) | ||
| elseif(UNIX) | ||
| target_link_libraries(tensogram::tensogram INTERFACE | ||
| dl | ||
| pthread | ||
| m | ||
| stdc++ | ||
| ) | ||
| endif() | ||
|
|
||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| if( HAVE_TENSOGRAM ) | ||
|
|
||
| ecbuild_add_library( | ||
| TARGET multio-action-encode-tensogram | ||
|
|
||
| TYPE SHARED # Due to reliance on factory self-registration this library cannot be static | ||
|
|
||
| SOURCES | ||
| EncodeTensogram.cc | ||
| EncodeTensogram.h | ||
|
|
||
| PUBLIC_LIBS | ||
| multio | ||
| tensogram::tensogram | ||
| ) | ||
|
|
||
| endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
commited→committed.