Skip to content

feat(architecture): define language adapter mappings - #509

Closed
yshyn-iohk wants to merge 8 commits into
developfrom
codex/feat/issue-505
Closed

yshyn-iohk wants to merge 8 commits into
developfrom
codex/feat/issue-505

Conversation

@yshyn-iohk

@yshyn-iohk yshyn-iohk commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Pull request

Outcome

Defines a canonical, versioned Rust-to-language compatibility contract for the first SDK-TS DID adoption slice. The registry records four DID/DID URL value and error mappings while keeping identus-did values and stable error codes authoritative.

Issue and decision record

Factory contract

Scope

  • closed, versioned language-adapter mapping schema;
  • four SDK-TS 8.1.4 DID/DID URL seed mappings;
  • explicit field direction, fidelity, unsupported cases, stable errors, bounds, redaction, lifecycle, rollback, and removal gates;
  • deterministic Markdown rendering and strict offline validator;
  • mutation tests isolated from render-drift testing; and
  • factory/OpenSpec integration.

No TypeScript adapter, binding, consumer repository, Rust public API, crate dependency, target-support claim, release, or protocol behavior changes.

Local review

  • Local review: completed against the fresh origin/develop...HEAD diff.
  • Independent discovery review: Claude Code /review against PR feat(architecture): define language adapter mappings #509; six validator-completeness findings reproduced and resolved in one remediation round.
  • Findings resolved: version-window coherence, Rust-owned bound enforcement, malformed-table diagnostics, additive registry evolution, complete human rendering, redundant validation, mutation/render isolation, and deterministic Markdown whitespace.
  • Specialist review required/completed: architecture, compatibility, provenance, security/redaction, resource bounds, and maintenance reviewed locally.

Research and provenance

  • SDK-TS revision: 4bf86ebf69d5e96616a148e4c973f831f95fa38e, release line 8.1.4, Apache-2.0.
  • Rust reference revision: edf03abcc963d37703daa61192940394bdc553ca.
  • Exact SDK-TS DID, DID URL, parser, error, and test paths are retained in the machine registry.
  • The legacy DID URL shape is intentionally lossy because path arrays, a query Map, and a fragment string cannot preserve raw query order/duplicates or absent-versus-empty query and fragment state.
  • Both legacy parsing paths use InvalidDIDString; the mapping preserves distinct Rust codes did.invalid_did and did.invalid_did_url with caller-input redaction.

Constraints and limitations

Review and decomposition

Fresh-diff architecture, security, provenance, compatibility, and maintenance review completed with no unresolved blocker. The diff exceeds the generic 12-file/1,000-line attention threshold because the OpenSpec planning packet, canonical TOML registry, deterministic human projection, validator, mutation suite, and archive are one indivisible evidence contract. There is no production runtime code.

The initial local review fixed mutation/render evidence isolation and generated-Markdown whitespace. The independent discovery review then reproduced six validator-completeness gaps. One bounded remediation now parses and checks language-version windows, resolves adapter byte ceilings to public Rust constants, returns diagnostics for malformed nested values, permits additive conforming records beyond the required seed, renders every governed field, and removes a redundant error check. Mutation tests preserve each counterexample.

Validation

python3 scripts/check-language-adapter-mappings.py
python3 scripts/tests/language-adapter-mappings.py
python3 scripts/check-cross-language-vectors.py
python3 scripts/tests/cross-language-vectors.py
scripts/check-factory.sh .
scripts/factory ready establish-language-adapter-mappings
scripts/factory receipt establish-language-adapter-mappings
scripts/factory archive establish-language-adapter-mappings
nix flake check

All applicable aarch64-darwin checks passed. The local flake reports x86_64-linux as incompatible on this host; hosted fast provides the required Linux integration evidence.

Checklist

  • focused and independently reversible
  • corresponding issue exists and is linked above
  • distinct local review completed with no unresolved blocker
  • OpenSpec contract and preimplementation receipt complete
  • research and constraint readiness recorded
  • DCO and verified signatures
  • tests, negative cases, provenance, and docs updated
  • public/wire compatibility reviewed and unchanged
  • no chain, product, consumer, secret, FFI, or unsafe-code impact
  • limitations and target state are explicit
  • terminal exact-head metrics will be retained and published at closeout

Closes #505

Signed-off-by: Yurii Shynbuiev <[email protected]>

# Conflicts:
#	scripts/check-factory.sh
#	scripts/tests/factory-contract.sh
@yshyn-iohk
yshyn-iohk requested a review from a team as a code owner September 30, 2026 08:08
@yshyn-iohk

Copy link
Copy Markdown
Contributor Author

Post-remediation verification found additional reproducible contract gaps, so this PR is intentionally returned to draft and is not merge-ready.

Blocking findings:

  • a symlinked parent directory can escape the repository and bypass canonical Rust byte-bound enforcement;
  • generated canonical Rust identifiers duplicate the crate prefix and treat stable error codes as Rust symbols;
  • field direction can contradict mapping direction; and
  • lossy error mappings do not have to name the lost distinction.

The same review also identified fixture extensibility and evidence-window gaps. Because the factory permits one automatic remediation round, these will not be patched silently in this PR. #510 captures one cohesive follow-up contract, including vector-catalog resolution now that #508 is merged.

Exact reviewed head: 7e0cbf76562f15f02761fcc839929afe9a94fde7
Exact green fast run: https://github.com/hyperledger-identus/sdk-rust/actions/runs/36691950241

@yshyn-iohk

Copy link
Copy Markdown
Contributor Author

Follow-up #510 now has a frozen, validated planning contract and pre-implementation receipt on codex/fix/issue-510 (83a54607bce47336d2449057a0bddfffbc3ed27d). Implementation has not started.

This PR remains draft and blocked by the six verification gaps documented above. The intended path is a clean replacement PR to develop after #510 is implemented and independently reviewed; this PR should not be merged as-is.

Planning evidence: #510 (comment)

@yshyn-iohk

Copy link
Copy Markdown
Contributor Author

Superseded by replacement PR #511.

The replacement carries the complete mapping baseline plus the independently reviewed #510 corrections, has green exact-head fast/policy/DCO/file-hygiene checks, and its final independent verification reported no blocking finding. This draft remains intentionally unmerged so the verified containment, identity, direction, loss, version, catalog, type, uniqueness, and lifecycle corrections cannot be bypassed.

@yshyn-iohk yshyn-iohk closed this Sep 30, 2026
yshyn-iohk added a commit that referenced this pull request Sep 30, 2026
## Summary

- establish the canonical language-adapter registry and deterministic
human rendering from the reviewed #509 baseline;
- separate Cargo package, exact Rust API path, and stable public error
identity;
- reject traversal, symlink components, outside-root, non-regular,
oversized, malformed, ambiguous, or weakened canonical-bound evidence;
- enforce mapping/field direction compatibility and explicit structured
losses;
- restrict schema-v1 language compatibility to the pinned patch
interval;
- resolve mapping vectors exactly once against the canonical
cross-language catalog while allowing shared evidence; and
- make mutation fixtures discover every declared bound source and prove
an additive fifth-language mapping.

This is the clean replacement for draft #509. It changes no Rust runtime
API, generated binding, language SDK, consumer repository, release, or
publication behavior.

## Issue and decision record

- Issue: #510
- Parent: #505
- ADR: ADR 0170
- OpenSpec change: archived as
`2026-09-30-close-language-adapter-verification-gaps`
- Base SHA: `644993c859b87e2da16612fcdf7cf1868cfe5981`

## Local review

- Local review: completed; independent implementation review against
`c6f52020abe4be9504d46dbcbaf218c7f631706f` found no blocking findings
- Final exact-head delta: test assertion strengthening and OpenSpec
archival only; locally reviewed against
`224c1d4a3416a755f783a9f7a822131a565cfbb3`
- Findings resolved: all six post-remediation #509 findings plus the
three subsequent independent-review rounds
- Deferred provenance hardening: #512 (non-blocking for metadata
closure; required before adapter generation)

## Constraints and limitations

- Constraint impact: material
- Affected constraint IDs: SDK-ARCH-001, SDK-ARCH-002, SDK-SEC-003,
SDK-DELIVERY-001, SDK-LIM-005, SDK-LIM-006
- Limitations: metadata and verification only; no adapter is generated
or executed by this change
- Decision authority: issue #510 and the accepted preimplementation
receipt

## Evidence

- focused validator: 4 canonical mappings passed
- mutation suite: 2 positive and 90 negative cases passed
- factory after archival: 104 passed, 0 failed
- local Nix: all 38 compatible `aarch64-darwin` checks passed
- `git diff --check`: passed
- exact-diff review: no unresolved blocker
- signed commits and DCO trailers: verified

The OpenSpec change is archived and synchronized into the canonical
specification. Exact-head hosted CI is the remaining merge gate.

Closes #510
Closes #505
Supersedes #509

---------

Signed-off-by: Yurii Shynbuiev <[email protected]>
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.

architecture(bindings): specify canonical language adapter and error mappings

1 participant