Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline

<!-- changelog -->

## [v0.2.3](https://github.com/diffo-dev/diffo/compare/v0.2.2..v0.2.3) (2026-05-22)

### Maintenance:
* updated to diffo 0.4.1 (issue #48)
* refreshed agent guidance via `mix usage_rules.sync`

### Refactors:
* adopted upstream `Diffo.Provider.Changes.{Define,Relate,Assign}` across 11 instance resources; deleted the local `DiffoExample.Changes.*` trio now that the same modules ship in diffo proper ([diffo#170](https://github.com/diffo-dev/diffo/pull/170))
* slimmed 16 `BaseCharacteristic`-derived resources by relying on the auto-generated `:create`/`:update` actions ([diffo#171](https://github.com/diffo-dev/diffo/pull/171)) — ~360 lines removed; custom `:update` retained on `cable`, `path`, `circuit`, `constraints` where unit/bandwidth-profile composition is needed
* `Cable.relate` inline `after_action` (which referenced an unaliased `Relationship` module) folded into `change Diffo.Provider.Changes.Relate`

### Resolved workarounds:
* `DslAccess.qualify_result` now transitions to `:feasibilityChecked` — restores correct TMF form following [diffo#168](https://github.com/diffo-dev/diffo/pull/168) broadening the Assigner lifecycle gate to include `:feasibilityChecked`
* `Util.summarise_characteristics/2` no longer called from tests — typed characteristic + pool records now surface in TMF JSON by default ([diffo#169](https://github.com/diffo-dev/diffo/pull/169)). The projection function is retained in [lib/diffo_example/util.ex](lib/diffo_example/util.ex) for future projection demonstrations. Expected JSON strings updated across `cable`, `card`, `cable`, `path`, `shelf`, `dsl_access`, `nbn_ethernet` tests to reflect the real typed/pool surfacing

## [v0.2.2](https://github.com/diffo-dev/diffo/compare/v0.2.1..v0.2.2) (2026-05-21)

### Maintenance:
Expand Down
10 changes: 3 additions & 7 deletions lib/access/resources/cable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,21 @@ defmodule DiffoExample.Access.Cable do
argument :characteristic_value_updates, {:array, :term}

change set_attribute(:resource_state, :operating)
change DiffoExample.Changes.Define
change Diffo.Provider.Changes.Define
end

update :relate do
description "relates the cable with other instances"
argument :relationships, {:array, :struct}

change after_action(fn changeset, result, _context ->
with {:ok, result} <- Relationship.relate_instance(result, changeset),
{:ok, result} <- Access.get_cable_by_id(result.id),
do: {:ok, result}
end)
change Diffo.Provider.Changes.Relate
end

update :assign_pair do
description "relates the cable with an instance by assigning a pair"
argument :assignment, :struct, constraints: [instance_of: Assignment]

change {DiffoExample.Changes.Assign, pool: :pairs}
change {Diffo.Provider.Changes.Assign, pool: :pairs}
end
end
end
6 changes: 3 additions & 3 deletions lib/access/resources/card.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ defmodule DiffoExample.Access.Card do
argument :characteristic_value_updates, {:array, :term}

change set_attribute(:resource_state, :operating)
change DiffoExample.Changes.Define
change Diffo.Provider.Changes.Define
end

update :relate do
description "relates the card with other instances"
argument :relationships, {:array, :struct}

change DiffoExample.Changes.Relate
change Diffo.Provider.Changes.Relate
end

update :assign_port do
description "relates the card with an instance by assigning a port"
argument :assignment, :struct, constraints: [instance_of: Assignment]

change {DiffoExample.Changes.Assign, pool: :ports}
change {Diffo.Provider.Changes.Assign, pool: :ports}
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ defmodule DiffoExample.Access.CableCharacteristic do
end

actions do
create :create do
accept [:name, :pairs, :length_amount, :length_unit, :loss_amount, :loss_unit, :technology]
argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:pairs, :technology, :length_amount, :length_unit, :loss_amount, :loss_unit]
argument :length, :term, allow_nil?: true
Expand Down
14 changes: 0 additions & 14 deletions lib/access/resources/characteristic_values/card_characteristic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ defmodule DiffoExample.Access.CardCharacteristic do
plural_name :card_characteristics
end

actions do
create :create do
accept [:name, :family, :model, :technology]
argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:family, :model, :technology]
end
end

attributes do
attribute :family, :atom, public?: true
attribute :model, :string, public?: true
Expand Down
18 changes: 0 additions & 18 deletions lib/access/resources/characteristic_values/path_characteristic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,6 @@ defmodule DiffoExample.Access.PathCharacteristic do
end

actions do
create :create do
accept [
:name,
:device_name,
:sections,
:length_amount,
:length_unit,
:loss_amount,
:loss_unit,
:technology
]

argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [
:device_name,
Expand Down
14 changes: 0 additions & 14 deletions lib/access/resources/characteristic_values/shelf_characteristic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ defmodule DiffoExample.Access.ShelfCharacteristic do
plural_name :shelf_characteristics
end

actions do
create :create do
accept [:name, :device_name, :family, :model, :technology]
argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:device_name, :family, :model, :technology]
end
end

attributes do
attribute :device_name, :string, public?: true
attribute :family, :atom, public?: true
Expand Down
4 changes: 2 additions & 2 deletions lib/access/resources/path.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ defmodule DiffoExample.Access.Path do
description "defines the path"
argument :characteristic_value_updates, {:array, :term}

change DiffoExample.Changes.Define
change Diffo.Provider.Changes.Define
end

update :relate do
description "relates the path with other instances"
argument :relationships, {:array, :struct}

change DiffoExample.Changes.Relate
change Diffo.Provider.Changes.Relate
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/access/resources/shelf.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ defmodule DiffoExample.Access.Shelf do
argument :characteristic_value_updates, {:array, :term}

change set_attribute(:resource_state, :operating)
change DiffoExample.Changes.Define
change Diffo.Provider.Changes.Define
end

update :relate do
description "relates the shelf with cards"
argument :relationships, {:array, :struct}

change DiffoExample.Changes.Relate
change Diffo.Provider.Changes.Relate
end

update :assign_slot do
description "relates the shelf with an instance by assigning a slot"
argument :assignment, :struct, constraints: [instance_of: Assignment]

change {DiffoExample.Changes.Assign, pool: :slots}
change {Diffo.Provider.Changes.Assign, pool: :slots}
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@ defmodule DiffoExample.Access.AggregateCharacteristic do
plural_name :aggregate_characteristics
end

actions do
create :create do
accept [
:name,
:interface_name,
:physical_interface,
:physical_layer,
:link_layer,
:svlan_id,
:vpi
]

argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:interface_name, :physical_interface, :physical_layer, :link_layer, :svlan_id, :vpi]
end
end

attributes do
attribute :interface_name, :string, public?: true
attribute :physical_interface, :string, public?: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,6 @@ defmodule DiffoExample.Access.CircuitCharacteristic do
end

actions do
create :create do
accept [
:name,
:circuit_id,
:cvlan_id,
:vci,
:encapsulation,
:bp_downstream,
:bp_upstream,
:bp_units
]

argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:circuit_id, :cvlan_id, :vci, :encapsulation]
argument :bandwidth_profile, :term, allow_nil?: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ defmodule DiffoExample.Access.ConstraintsCharacteristic do
end

actions do
create :create do
accept [:name, :max_latency, :mp_downstream, :mp_upstream, :mp_units]
argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:max_latency]
argument :min_profile, :term, allow_nil?: true
Expand Down
14 changes: 0 additions & 14 deletions lib/access/services/characteristic_values/dslam_characteristic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ defmodule DiffoExample.Access.DslamCharacteristic do
plural_name :dslam_characteristics
end

actions do
create :create do
accept [:name, :device_name, :family, :model, :technology]
argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:device_name, :family, :model, :technology]
end
end

attributes do
attribute :device_name, :string, public?: true
attribute :family, :atom, public?: true
Expand Down
14 changes: 0 additions & 14 deletions lib/access/services/characteristic_values/line_characteristic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ defmodule DiffoExample.Access.LineCharacteristic do
plural_name :line_characteristics
end

actions do
create :create do
accept [:name, :port, :slot, :standard, :profile]
argument :instance_id, :uuid
argument :feature_id, :uuid
change manage_relationship(:instance_id, :instance, type: :append)
change manage_relationship(:feature_id, :feature, type: :append)
end

update :update do
accept [:port, :slot, :standard, :profile]
end
end

attributes do
attribute :port, :integer, public?: true
attribute :slot, :integer, public?: true
Expand Down
8 changes: 4 additions & 4 deletions lib/access/services/dsl_access.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ defmodule DiffoExample.Access.DslAccess do

state_machine do
transitions do
transition action: :qualify_result, from: :initial, to: :inactive
transition action: :design_result, from: [:initial, :inactive], to: :reserved
transition action: :qualify_result, from: :initial, to: :feasibilityChecked
transition action: :design_result, from: [:initial, :feasibilityChecked], to: :reserved
end
end

Expand All @@ -76,7 +76,7 @@ defmodule DiffoExample.Access.DslAccess do
argument :places, {:array, :struct}
require_atomic? false

change transition_state(:inactive)
change transition_state(:feasibilityChecked)

validate argument_in(:service_operating_status, [
nil,
Expand All @@ -99,7 +99,7 @@ defmodule DiffoExample.Access.DslAccess do
argument :characteristic_value_updates, {:array, :term}

change transition_state(:reserved)
change DiffoExample.Changes.Define
change Diffo.Provider.Changes.Define
end
end
end
43 changes: 0 additions & 43 deletions lib/diffo_example/changes/assign.ex

This file was deleted.

Loading
Loading