Skip to content

Open the sector axis on the wire - #75

Closed
LKSNDRTMLKV wants to merge 1 commit into
refactor/crate-boundariesfrom
feat/open-sector-lane
Closed

Open the sector axis on the wire#75
LKSNDRTMLKV wants to merge 1 commit into
refactor/crate-boundariesfrom
feat/open-sector-lane

Conversation

@LKSNDRTMLKV

Copy link
Copy Markdown
Member

Stacked on #74 — review that first; this diff is only the sector-lane commit.

Brings the open sector lane forward from 0.14.0 into 0.13.0, so there is one breaking release and one engine repin rather than two.

The defect

The catalog, schema registry, per-field disclosure map and plugin manifests are all string-keyed data. Sector and SectorData were plain derives — the latter internally tagged on sector — so:

  • a passport whose sector was not one of the twelve variants failed to deserialize outright;
  • SectorData::Other matched only the literal tag "other", so even the fallback discarded the real key;
  • two different unknown sectors became indistinguishable after a round trip.

The sector model was open in the catalog and closed at the front door. Adding packaging cost a core release, an engine repin and a CI matrix change.

The change

Sector::Other(String) and SectorData::Other { sector, data } now carry the tag, with hand-written Serialize/Deserialize that fall through instead of failing. The shape on the wire is unchanged — still an internally-tagged object with sector as the discriminant. Only the unknown-tag behaviour differs.

An unknown sector round-trips byte-identically, which is the property that matters: a signature is computed over those bytes, so anything less would break verification for a passport this build cannot type.

validate_sector_data_with_registry now resolves a validator by the sector's own key rather than by a literal "other" — the key is preserved precisely so dispatch can be by name.

Merge gate

crates/dpp-tests/tests/open_sector_lane.rs, 8 tests:

  • an unknown tag deserializes rather than erroring
  • it round-trips byte-identically
  • sector() reports the real key, not a placeholder
  • two unknown sectors stay distinct
  • known sectors still land on their typed variants — the open lane costs the typed lane nothing
  • both spellings (unsold-goods, unsoldGoods) resolve to the typed variant
  • a payload with no tag is still refused — opening the lane must not accept an untagged object

Full just check green: fmt, clippy, workspace tests, doctests, all ten plugins, docs with -D warnings, audit.

Deliberately not included

ADR-010 pairs this with deleting typed lanes for provisional sectors. Eight of eleven catalog sectors are provisional — including textile, which has 7 engine references, a full E2E test, its own plugin, and is the pilot sector. That is a capability decision needing an explicit call, and unlike the wire format it is not clamped to first issuance: deleting code stays free, changing the wire does not. Shipping this alone captures the whole deadline benefit.

Port signatures still take &Sector rather than a bare key. They now work for unknown sectors because the key travels inside Sector::Other, so that remaining change is ergonomic, not blocking.

Downstream

The engine repin (odal-node/dpp-engine#66) predates this and does not yet cover it. Sector is no longer Copy and Sector::Other is no longer a unit variant, so that PR needs a follow-up commit before 0.13.0 publishes.

@codacy-production

codacy-production Bot commented Jul 30, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 277 complexity · 15 duplication

Metric Results
Complexity 277
Duplication 15

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

1 participant