Skip to content

Schema#12

Merged
egenn merged 5 commits into
mainfrom
schema
Apr 16, 2026
Merged

Schema#12
egenn merged 5 commits into
mainfrom
schema

Conversation

@egenn
Copy link
Copy Markdown
Member

@egenn egenn commented Apr 15, 2026

Copilot AI review requested due to automatic review settings April 15, 2026 17:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns schema validation behavior across language implementations by rejecting duplicate positions (instead of silently deduplicating), addressing parse errors around duplicate indexes.

Changes:

  • TypeScript: positions are now sorted but duplicate positions cause validation failure (with updated tests).
  • Rust / Python / Julia: normalization/validation updated to reject duplicate positions, with corresponding test updates.
  • Build/docs tooling: Makefile docs* targets reorganized; R docs updated for read_A3json() default verbosity.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
typescript/tests/schemas.test.ts Updates/extends tests for sorted positions + duplicate rejection.
typescript/src/schemas.ts Changes PositionsSchema to sort and reject duplicates via refinement.
rust/src/normalization.rs Changes position normalization to error on duplicates; updates unit tests.
r/man/read_A3json.Rd Updates documented default verbosity for read_A3json().
python/rtemis_a3/tests/test_models.py Updates model tests to expect duplicate position validation errors.
python/rtemis_a3/src/rtemis/a3/_normalize.py Adds a dedicated duplicate-checking normalizer for strict parsing.
python/rtemis_a3/src/rtemis/a3/_models.py Switches position normalization to duplicate-rejecting logic.
julia/RtemisA3/test/runtests.jl Updates tests to expect duplicate positions to be rejected.
julia/RtemisA3/src/validate.jl Updates validator to sort and reject duplicates.
Makefile Moves/organizes docs targets earlier in the file; keeps summary behavior.

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

Comment on lines 64 to 70
@field_validator("index", mode="before")
@classmethod
def _normalize_positions(cls, v: Any) -> list[int]:
if not isinstance(v, list):
raise ValueError("index must be a list of positive integers")
return sort_dedup(v)
return check_no_duplicate_positions(v)

Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

A3Position._normalize_positions runs in mode="before" and passes the raw list to check_no_duplicate_positions, which sorts the list. If a caller provides non-integer elements (e.g., strings/dicts), the sorted() call can raise a TypeError, producing a less helpful Pydantic ValidationError than the intended "index must be a list of positive integers"/type-specific messages. Consider moving this validator to mode="after" (so items are already validated/coerced as Position) or explicitly validating/coercing each element to an int (and rejecting bools) before sorting/checking duplicates.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the position validation logic across Julia, Python, Rust, and TypeScript to explicitly reject duplicate entries instead of automatically deduplicating them. It also reorganizes the Makefile and updates the default verbosity in the R package documentation. The feedback highlights that the change to default verbosity in the R package appears unrelated to the primary goal of the PR and could impact existing users.

Comment thread r/man/read_A3json.Rd
@egenn egenn merged commit 8353b15 into main Apr 16, 2026
5 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.

2 participants