Skip to content

feat(sdl): align Go and TS parity tests with shared schema#280

Open
incu6us wants to merge 11 commits intoakash-network:mainfrom
incu6us:sdl-parity-fixes-v2
Open

feat(sdl): align Go and TS parity tests with shared schema#280
incu6us wants to merge 11 commits intoakash-network:mainfrom
incu6us:sdl-parity-fixes-v2

Conversation

@incu6us
Copy link
Copy Markdown

@incu6us incu6us commented Apr 1, 2026

📝 Description

Aligns Go and TS SDL implementations by fixing TS serialization parity (field naming, null handling, endpoint ordering, amount formatting), adding strict schema enforcement in Go (ReadStrict/ReadFileStrict) and expanding parity test coverage to include group-specs comparison, semantic/schema-only invalid categories, output schema validation and canonical equality checks. Establishes go/sdl/sdl-input.schema.yaml as the single source of truth for both implementations.

🔧 Purpose of the Change

  • New feature implementation
  • Bug fix
  • Documentation update
  • Code refactoring
  • Dependency upgrade
  • Other: Parity alignment & test infrastructure

📌 Related Issues

✅ Checklist

  • I've updated relevant documentation
  • Code follows Akash Network's style guide
  • I've added/updated relevant unit tests
  • Dependencies have been properly updated
  • I agree and adhered to the Contribution Guidelines

📎 Notes for Reviewers

Go changes (go/sdl/)

  • sdl.go: Added ReadStrict() / ReadFileStrict() - strict APIs that fail on schema violations (existing Read/ReadFile remain lenient for backward compatibility)
  • schema_validator.go: Bidirectional mismatch logging - now logs both directions (schema-pass/Go-fail AND schema-fail/Go-pass)
  • parity_test.go: Added TestSemanticOnlyInvalid for inputs valid per schema but rejected by parser; added output schema validation via specs/sdl/*.schema.yaml - strict_test.go: Tests for ReadStrict covering valid, invalid and schema-only-invalid fixtures

TypeScript changes (ts/)

  • generateManifestVersion.ts: JSON wire format field mapping (signedBysigned_by, allOfall_of, anyOfany_of during serialization only), nullable allOf/anyOf, context-aware attributes null handling, LegacyDec amount formatting
  • generateManifest.ts: Fixed endpoint sorting — per-expose sort matching Go's GetEndpoints(), removed incorrect global sort
  • manifestUtils.ts: Endpoint ordering fix - [leasedEp, defaultEp].sort() matching Go
  • sdl-parity.spec.ts: Added group-specs comparison, semantic/schema-only-invalid tests, output schema validation, canonical manifest equality checks

CI & docs

  • make/test.mk: Added TS schema drift check, expanded Go test patterns
  • .github/workflows/tests.yaml: Added Go cache-dependency-path
  • docs/sdl-parity.md: ADR documenting schema ownership and parity rules

Test fixtures

  • testdata/sdl/input/semantic-only-invalid/ - 3 new fixtures (endpoint-not-used, duplicate-mount-path, missing-compute-profile)

Test results

  • Go: 85 tests passed
  • TS: 193 tests passed (51 parity + 142 legacy SDL - no regressions)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00fb421c-fd8b-4207-b51a-c6b48549f234

📥 Commits

Reviewing files that changed from the base of the PR and between e59040a and 6bfbce8.

📒 Files selected for processing (1)
  • ts/src/sdl/manifest/generateManifestVersion.ts

Walkthrough

Adds schema-first strict SDL load paths and strict-vs-lenient parsing APIs in Go, centralizes schema compilation and parity testing, introduces output JSON Schemas and many expected group fixtures, updates TS manifest serialization/endpoint ordering, extends TS parity tests and CI to check generated validators and output schema drift.

Changes

Cohort / File(s) Summary
CI & Make
​.github/workflows/tests.yaml, make/test.mk
Adjust Go setup cache key to go/sdl/go.sum; add TS schema drift check in test-sdl-parity; include strict and semantic-only tests in Go test filter.
Docs & ADR
docs/sdl-parity.md, specs/sdl/README.md
Add SDL parity ADR and schema README describing canonical schema, fixture layout, validation scope, and strict-vs-lenient parsing expectations.
Go SDL Core
go/sdl/sdl.go, go/sdl/schema_validator.go
Add ReadStrict/ReadFileStrict; refactor post-unmarshal validation into validateSDL; wrap/annotate validation errors; improve schema-vs-Go mismatch logging.
Go Tests & Parity Suite
go/sdl/parity_test.go, go/sdl/strict_test.go
Centralize parity test suite (fixture roots, compiled schemas); compile/validate JSON schemas in tests; add strictness and semantic-only-invalid tests; update parity test drivers.
JSON Schemas (outputs)
specs/sdl/manifest-output.schema.yaml, specs/sdl/groups-output.schema.yaml
Add strict output JSON Schemas for validating generated manifest and groups outputs.
TS Manifest Generation
ts/src/sdl/manifest/generateManifest.ts, ts/src/sdl/manifest/generateManifestVersion.ts, ts/src/sdl/manifest/manifestUtils.ts
Per-resource endpoint sorting now by sequenceNumber; include nullable/allOf/anyOf handling; format amount to 18-decimal LegacyDec; map signedBy/allOf/anyOf renames and adjust attributes omission behavior.
TS Parity Tests
ts/test/functional/sdl-parity.spec.ts
Load group-specs.json; validate generated outputs against new schemas; add semantic-only and schema-only invalid suites; add canonical byte-level equality checks and extend fixture loading.
Fixtures — semantic-only invalid
testdata/sdl/input/semantic-only-invalid/*
Add three schema-valid but semantically invalid YAML fixtures (duplicate-mount-path.yaml, endpoint-not-used.yaml, missing-compute-profile.yaml).
Fixtures — Go output (v2.0 & v2.1)
testdata/sdl/output-fixtures/v2.0/*/groups.json, testdata/sdl/output-fixtures/v2.1/*/groups.json
Add many expected groups.json output fixtures across v2.0 and v2.1 for parity comparisons (various scenarios: GPU, http-options, ip-endpoint, multiple-services, persistent-storage, placement, port-ranges, pricing, simple, storage-classes, credentials).

Sequence Diagram(s)

sequenceDiagram
    actor Client as User
    participant GoLoader as Go SDL Loader
    participant SchemaVal as Schema Validator
    participant SemanticVal as Semantic Validator
    participant TSGen as TS Manifest Generator

    rect rgba(100,150,200,0.5)
    Note over Client,GoLoader: Lenient Load (Read)
    Client->>GoLoader: YAML bytes
    GoLoader->>GoLoader: yaml.Unmarshal
    GoLoader->>SemanticVal: validateSDL(obj)
    SemanticVal-->>GoLoader: ok / error
    GoLoader-->>Client: SDL object / error
    end

    rect rgba(200,100,100,0.5)
    Note over Client,SchemaVal: Strict Load (ReadStrict)
    Client->>GoLoader: YAML bytes
    GoLoader->>SchemaVal: validateInputAgainstSchema(bytes)
    alt schema fails
        SchemaVal-->>GoLoader: schema error
        GoLoader-->>Client: "strict schema validation failed: ..." error
    else schema passes
        SchemaVal-->>GoLoader: ok
        GoLoader->>GoLoader: yaml.Unmarshal
        GoLoader->>SemanticVal: validateSDL(obj)
        SemanticVal-->>GoLoader: ok / error
        GoLoader-->>Client: SDL object / error
    end
    end

    rect rgba(120,200,120,0.5)
    Note over GoLoader,TSGen: Parity test flow (compare outputs)
    GoLoader->>TSGen: Go-generated canonical JSON (manifest/groups)
    TSGen-->>GoLoader: TS-generated canonical JSON
    GoLoader->>SchemaVal: validate outputs against manifest/groups schemas
    SchemaVal-->>GoLoader: ok / schema error
    GoLoader-->>Client: parity result (match / mismatch)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hop through schemas, neat and spry,

Bytes and fixtures stacked nearby.
Go reads strict, TS sings along,
Parity hums a tidy song.
Hooray — the rabbits test and pry!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.88% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(sdl): align Go and TS parity tests with shared schema' accurately captures the main change—establishing shared schema and aligning parity tests across implementations.
Description check ✅ Passed The PR description comprehensively covers the purpose of changes, related issues, and includes detailed notes for reviewers across Go, TypeScript, CI, docs, and test infrastructure.
Linked Issues check ✅ Passed The PR satisfies the core objective from #408 by implementing schema-driven parity: establishing sdl-input.schema.yaml as the authoritative source, aligning both implementations' validation and serialization behavior, and extending test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to SDL parity alignment: Go/TS schema adoption, serialization fixes, parity test enhancements, documentation, and CI configuration—no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@incu6us incu6us marked this pull request as ready for review April 1, 2026 13:15
@incu6us incu6us requested a review from a team as a code owner April 1, 2026 13:15
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (5)
specs/sdl/README.md (1)

29-29: Minor: Clarify unknown fields handling.

The phrase "TS validates, Go rejects" could be clearer. Consider rephrasing to explicitly state the behavior, e.g., "unknown fields — TS raises validation errors, Go rejects during unmarshal."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@specs/sdl/README.md` at line 29, The README line "Parser-level checks (count
≥ 1, unknown fields — TS validates, Go rejects during unmarshal)" is ambiguous
about how unknown fields are handled; update that phrase to explicitly state
behavior, e.g., change "TS validates, Go rejects during unmarshal" to "TS raises
validation errors, Go rejects during unmarshal" (locate the phrase in the README
entry "Parser-level checks (count ≥ 1, unknown fields — ...)").
go/sdl/sdl.go (1)

183-221: Consider extracting shared validation logic to reduce duplication.

ReadStrict duplicates the post-unmarshal validation sequence from Read (lines 100-132). Extracting this into a helper function would improve maintainability.

♻️ Proposed refactor to extract common validation
+// validateAndBuild performs semantic validation on an unmarshalled SDL object.
+func validateAndBuild(obj *sdl) (SDL, error) {
+	if err := obj.validate(); err != nil {
+		return nil, err
+	}
+
+	dgroups, err := obj.DeploymentGroups()
+	if err != nil {
+		return nil, err
+	}
+
+	vgroups := make([]dtypes.GroupSpec, 0, len(dgroups))
+	for _, dgroup := range dgroups {
+		vgroups = append(vgroups, dgroup)
+	}
+
+	if err = dtypes.ValidateDeploymentGroups(vgroups); err != nil {
+		return nil, err
+	}
+
+	m, err := obj.Manifest()
+	if err != nil {
+		return nil, err
+	}
+
+	if err = m.Validate(); err != nil {
+		return nil, err
+	}
+
+	return obj, nil
+}

 func ReadStrict(buf []byte) (SDL, error) {
 	if err := validateInputAgainstSchema(buf); err != nil {
 		return nil, fmt.Errorf("strict schema validation failed: %w", err)
 	}

 	obj := &sdl{}
 	if err := yaml.Unmarshal(buf, obj); err != nil {
 		return nil, err
 	}

-	if err := obj.validate(); err != nil {
-		return nil, err
-	}
-
-	dgroups, err := obj.DeploymentGroups()
-	if err != nil {
-		return nil, err
-	}
-
-	vgroups := make([]dtypes.GroupSpec, 0, len(dgroups))
-	for _, dgroup := range dgroups {
-		vgroups = append(vgroups, dgroup)
-	}
-
-	if err = dtypes.ValidateDeploymentGroups(vgroups); err != nil {
-		return nil, err
-	}
-
-	m, err := obj.Manifest()
-	if err != nil {
-		return nil, err
-	}
-
-	if err = m.Validate(); err != nil {
-		return nil, err
-	}
-
-	return obj, nil
+	return validateAndBuild(obj)
 }

The same refactor can be applied to Read().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go/sdl/sdl.go` around lines 183 - 221, Extract the duplicated post-unmarshal
validation sequence in ReadStrict (and apply the same to Read) into a single
helper function, e.g., func runPostUnmarshalValidation(obj *sdl) error: move
calls to obj.validate(), obj.DeploymentGroups() + conversion to
[]dtypes.GroupSpec + dtypes.ValidateDeploymentGroups(...), and obj.Manifest()
followed by m.Validate() into that helper; then replace the inline validation
block in ReadStrict with a call to runPostUnmarshalValidation(obj) (and update
Read to call it too) so all shared validation logic (validateInputAgainstSchema
remains separate) is centralized and only invoked after yaml.Unmarshal into the
sdl instance.
ts/src/sdl/manifest/generateManifestVersion.ts (1)

40-50: LegacyDec formatting does not truncate amounts with >18 decimal places.

If the input amount already contains more than 18 fractional digits, this logic returns it unchanged. While unlikely in practice, for strict parity with Go's LegacyDec formatting, you may want to truncate to exactly 18 decimal places.

♻️ Optional: truncate to 18 decimal places
   if (s.includes(".")) {
     const [, frac] = s.split(".");
     const pad = 18 - (frac?.length ?? 0);
-    return pad > 0 ? s + "0".repeat(pad) : s;
+    if (pad > 0) return s + "0".repeat(pad);
+    if (pad < 0) return s.slice(0, s.length + pad); // truncate excess
+    return s;
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ts/src/sdl/manifest/generateManifestVersion.ts` around lines 40 - 50, The
amount formatting branch for LegacyDec (the if block checking key === "amount"
in generateManifestVersion.ts) currently leaves inputs with >18 fractional
digits intact; update it to truncate the fractional part to exactly 18 digits:
after splitting value on ".", if frac.length > 18 return
`${int}.${frac.slice(0,18)}` (preserving integer part and handling the case
where frac is undefined), otherwise pad as before; ensure the branch still
returns "0.000000000000000000" for empty/falsey strings and preserves existing
padding behavior when frac.length < 18.
ts/src/sdl/SDL/parity.spec.ts (1)

14-15: Ajv instantiation workaround is acceptable but consider simplifying.

The complex casting to handle Ajv's non-standard ESM/CJS export works, but the type annotation could be simplified if you import types separately.

♻️ Optional: Simplify Ajv import
-import type { ErrorObject, ValidateFunction } from "ajv";
-import AjvModule from "ajv";
+import Ajv, { type ErrorObject, type ValidateFunction } from "ajv";

-// `@ts-expect-error` - AjvModule has non-standard export, cast needed for instantiation
-const ajv: { compile: (schema: Record<string, unknown>) => ValidateFunction } = new (AjvModule as unknown as new (options?: { allErrors?: boolean }) => typeof AjvModule)({ allErrors: true });
+const ajv = new Ajv({ allErrors: true });

If the default export issue persists, the current approach is fine.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ts/src/sdl/SDL/parity.spec.ts` around lines 14 - 15, The Ajv instantiation
workaround can be simplified by importing the Ajv constructor/type and the
ValidateFunction type separately and using those types instead of the long
inline annotation; change the code so you import the constructor type (e.g.,
AjvConstructor or default as AjvCtor) and ValidateFunction from 'ajv', then cast
AjvModule to that constructor type when calling new (e.g., new (AjvModule as
unknown as AjvCtor)({ allErrors: true })) and declare ajv using the simpler
ValidateFunction-based type (referencing ajv, AjvModule, and ValidateFunction in
your change).
docs/sdl-parity.md (1)

51-51: Minor grammar: use hyphen for compound modifier.

Static analysis flagged "TS generated validator" — consider "TS-generated validator" for grammatical correctness.

-4. Keep the TS generated validator in sync with the schema (CI drift check)
+4. Keep the TS-generated validator in sync with the schema (CI drift check)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/sdl-parity.md` at line 51, Replace the phrase "TS generated validator"
with the grammatically correct hyphenated form "TS-generated validator" in
docs/sdl-parity.md (and any other occurrences), updating the line under the CI
drift check item ("Keep the TS-generated validator in sync with the schema (CI
drift check)"); search the repo for other instances of the exact string to
update consistently and run the docs linter or spellcheck before committing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/sdl-parity.md`:
- Line 51: Replace the phrase "TS generated validator" with the grammatically
correct hyphenated form "TS-generated validator" in docs/sdl-parity.md (and any
other occurrences), updating the line under the CI drift check item ("Keep the
TS-generated validator in sync with the schema (CI drift check)"); search the
repo for other instances of the exact string to update consistently and run the
docs linter or spellcheck before committing.

In `@go/sdl/sdl.go`:
- Around line 183-221: Extract the duplicated post-unmarshal validation sequence
in ReadStrict (and apply the same to Read) into a single helper function, e.g.,
func runPostUnmarshalValidation(obj *sdl) error: move calls to obj.validate(),
obj.DeploymentGroups() + conversion to []dtypes.GroupSpec +
dtypes.ValidateDeploymentGroups(...), and obj.Manifest() followed by
m.Validate() into that helper; then replace the inline validation block in
ReadStrict with a call to runPostUnmarshalValidation(obj) (and update Read to
call it too) so all shared validation logic (validateInputAgainstSchema remains
separate) is centralized and only invoked after yaml.Unmarshal into the sdl
instance.

In `@specs/sdl/README.md`:
- Line 29: The README line "Parser-level checks (count ≥ 1, unknown fields — TS
validates, Go rejects during unmarshal)" is ambiguous about how unknown fields
are handled; update that phrase to explicitly state behavior, e.g., change "TS
validates, Go rejects during unmarshal" to "TS raises validation errors, Go
rejects during unmarshal" (locate the phrase in the README entry "Parser-level
checks (count ≥ 1, unknown fields — ...)").

In `@ts/src/sdl/manifest/generateManifestVersion.ts`:
- Around line 40-50: The amount formatting branch for LegacyDec (the if block
checking key === "amount" in generateManifestVersion.ts) currently leaves inputs
with >18 fractional digits intact; update it to truncate the fractional part to
exactly 18 digits: after splitting value on ".", if frac.length > 18 return
`${int}.${frac.slice(0,18)}` (preserving integer part and handling the case
where frac is undefined), otherwise pad as before; ensure the branch still
returns "0.000000000000000000" for empty/falsey strings and preserves existing
padding behavior when frac.length < 18.

In `@ts/src/sdl/SDL/parity.spec.ts`:
- Around line 14-15: The Ajv instantiation workaround can be simplified by
importing the Ajv constructor/type and the ValidateFunction type separately and
using those types instead of the long inline annotation; change the code so you
import the constructor type (e.g., AjvConstructor or default as AjvCtor) and
ValidateFunction from 'ajv', then cast AjvModule to that constructor type when
calling new (e.g., new (AjvModule as unknown as AjvCtor)({ allErrors: true }))
and declare ajv using the simpler ValidateFunction-based type (referencing ajv,
AjvModule, and ValidateFunction in your change).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff7bd8b3-1a5c-447d-8a9a-9d091b1c8071

📥 Commits

Reviewing files that changed from the base of the PR and between 6f1a7fd and 3e51e32.

📒 Files selected for processing (30)
  • .github/workflows/tests.yaml
  • docs/sdl-parity.md
  • go/sdl/parity_test.go
  • go/sdl/schema_validator.go
  • go/sdl/sdl.go
  • go/sdl/strict_test.go
  • make/test.mk
  • specs/sdl/README.md
  • specs/sdl/groups-output.schema.yaml
  • specs/sdl/manifest-output.schema.yaml
  • testdata/sdl/input/semantic-only-invalid/duplicate-mount-path.yaml
  • testdata/sdl/input/semantic-only-invalid/endpoint-not-used.yaml
  • testdata/sdl/input/semantic-only-invalid/missing-compute-profile.yaml
  • testdata/sdl/output-fixtures/v2.0/gpu-basic/groups.json
  • testdata/sdl/output-fixtures/v2.0/http-options/groups.json
  • testdata/sdl/output-fixtures/v2.0/ip-endpoint/groups.json
  • testdata/sdl/output-fixtures/v2.0/multiple-services/groups.json
  • testdata/sdl/output-fixtures/v2.0/persistent-storage/groups.json
  • testdata/sdl/output-fixtures/v2.0/placement/groups.json
  • testdata/sdl/output-fixtures/v2.0/port-ranges/groups.json
  • testdata/sdl/output-fixtures/v2.0/pricing/groups.json
  • testdata/sdl/output-fixtures/v2.0/simple/groups.json
  • testdata/sdl/output-fixtures/v2.0/storage-classes/groups.json
  • testdata/sdl/output-fixtures/v2.1/credentials/groups.json
  • testdata/sdl/output-fixtures/v2.1/ip-endpoint/groups.json
  • ts/src/sdl/SDL/parity.spec.ts
  • ts/src/sdl/manifest/generateManifest.ts
  • ts/src/sdl/manifest/generateManifestVersion.ts
  • ts/src/sdl/manifest/manifestUtils.ts
  • ts/test/functional/sdl-parity.spec.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
docs/sdl-parity.md (1)

27-38: Add a language specifier to the fenced code block.

The directory structure code block lacks a language specifier, which triggers markdownlint MD040. Use text or plaintext for tree-like directory structures.

📝 Proposed fix
-```
+```text
 testdata/sdl/
 ├── input/                    # SDL input YAML files
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/sdl-parity.md` around lines 27 - 38, Update the fenced code block
showing the directory tree in docs/sdl-parity.md to include a language specifier
so markdownlint MD040 is satisfied: change the opening backticks for the
directory structure block from ``` to ```text (or ```plaintext) so the tree is
treated as plain text; the block is the one that begins with the lines showing
"testdata/sdl/" and the nested input/ and output-fixtures/ directories.
go/sdl/parity_test.go (1)

282-298: Consider extracting shared validation result formatting.

This function duplicates the validation result handling pattern from validateInputAgainstSchema in schema_validator.go (lines 120-130). While acceptable in test code, you could extract a common helper if this pattern spreads further.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go/sdl/parity_test.go` around lines 282 - 298, The validation-result
formatting logic in validateDataAgainstCompiledSchema duplicates the same
pattern used by validateInputAgainstSchema (schema_validator.go); extract a
shared helper (e.g., formatValidationErrors(result *gojsonschema.Result) string
or collectValidationErrors(result *gojsonschema.Result) []string) and replace
the duplicated loop in validateDataAgainstCompiledSchema to call that helper so
both validateDataAgainstCompiledSchema and validateInputAgainstSchema reuse the
same error-formatting function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/sdl-parity.md`:
- Around line 27-38: Update the fenced code block showing the directory tree in
docs/sdl-parity.md to include a language specifier so markdownlint MD040 is
satisfied: change the opening backticks for the directory structure block from
``` to ```text (or ```plaintext) so the tree is treated as plain text; the block
is the one that begins with the lines showing "testdata/sdl/" and the nested
input/ and output-fixtures/ directories.

In `@go/sdl/parity_test.go`:
- Around line 282-298: The validation-result formatting logic in
validateDataAgainstCompiledSchema duplicates the same pattern used by
validateInputAgainstSchema (schema_validator.go); extract a shared helper (e.g.,
formatValidationErrors(result *gojsonschema.Result) string or
collectValidationErrors(result *gojsonschema.Result) []string) and replace the
duplicated loop in validateDataAgainstCompiledSchema to call that helper so both
validateDataAgainstCompiledSchema and validateInputAgainstSchema reuse the same
error-formatting function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b144625b-16d7-497b-8514-9651d4cb1f47

📥 Commits

Reviewing files that changed from the base of the PR and between 3e51e32 and 7bb20c7.

📒 Files selected for processing (4)
  • docs/sdl-parity.md
  • go/sdl/parity_test.go
  • go/sdl/sdl.go
  • specs/sdl/README.md
✅ Files skipped from review due to trivial changes (1)
  • specs/sdl/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • go/sdl/sdl.go

@incu6us incu6us force-pushed the sdl-parity-fixes-v2 branch from 7bb20c7 to f7b6cb0 Compare April 1, 2026 14:55
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ts/src/sdl/manifest/generateManifestVersion.ts`:
- Around line 40-43: The amount normalization branch in
generateManifestVersion.ts only formats string amounts, but PriceCoin.amount can
be number; update the condition handling where (key === "amount") in the
function (the block using formatLegacyDec) to also accept numeric values by
converting number values to strings (e.g., String(value)) before calling
formatLegacyDec, and apply the same change to the similar block around lines
56-64 so numeric literals don't bypass LegacyDec normalization; reference the
exact condition checks using key === "amount" and formatLegacyDec to locate and
modify the code.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4e5a515e-17f7-4532-9bdc-52fd7e35d3c0

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb20c7 and 2524066.

📒 Files selected for processing (2)
  • go/sdl/sdl.go
  • ts/src/sdl/manifest/generateManifestVersion.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • go/sdl/sdl.go

@incu6us incu6us requested a review from cloud-j-luna April 2, 2026 17:15
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ts/src/sdl/manifest/generateManifestVersion.ts`:
- Around line 40-43: The formatLegacyDec function (used in the key === "amount"
branch) currently converts values with String(value) which can produce exponent
notation and returns inputs with >18 fractional digits unchanged; update
formatLegacyDec to robustly normalize numeric and string inputs into a plain
decimal string (no exponent) before validation, then enforce the 18-decimal
LegacyDec canonical form by truncating (not rounding) any fractional digits
beyond 18 and padding with trailing zeros up to 18 decimals (or throw if you
prefer strict rejection), and ensure the function always returns a validated
18-decimal string; handle numeric inputs by converting them to a non-exponential
decimal representation first (e.g., via a decimal/big-number routine or fixed
precision conversion) so inputs like 1e-7 become "0.000000100000000000".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7d7c6d1-844f-4ec1-a55d-c524a0aa65f8

📥 Commits

Reviewing files that changed from the base of the PR and between 2524066 and e59040a.

📒 Files selected for processing (1)
  • ts/src/sdl/manifest/generateManifestVersion.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDL parity tests

2 participants