Skip to content

feat: allow to manage display_order value for building block definiti…#218

Merged
j0g3sc merged 5 commits into
mainfrom
feature/building-block-definition-IO-order
Jul 9, 2026
Merged

feat: allow to manage display_order value for building block definiti…#218
j0g3sc merged 5 commits into
mainfrom
feature/building-block-definition-IO-order

Conversation

@j0g3sc

@j0g3sc j0g3sc commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

…on I/O without affecting the calculated hash for change detection

CU-86cabn76y


Summary

Added a manageable display_order field to building block definition version inputs and outputs.

Implementation:

Client
DisplayOrder int64 with json:"displayOrder,omitempty" on both MeshBuildingBlockDefinitionInput and MeshBuildingBlockDefinitionOutput.

Schema
display_order Int64Attribute on inputs and outputs, Optional + Computed + Default(0) — the Default is what keeps re-plans clean given the backend returns 0 when unset.

Content hash
stripped to 0 before hashing, so reordering never changes content_hash or forces a new version

Released immutability
displayOrdersDiffer guard in Update — needed because display_order is outside the hash, so this restores the "released versions are immutable" behavior with a clear error.

Mock
mirrors input→output display_order for manual BBDs.


⚠️ depends on meshfed-api released with https://github.com/meshcloud/meshfed-release/pull/10263

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

📊 Test Coverage

Scope Coverage
Unit tests (mock client) 74.9%
Combined (unit + acceptance) 80.0% — ❌ acceptance failed

Acceptance tests failed (advisory — the job runs against the last merged meshfed-release backend, so a change needing a companion backend PR fails here until that backend merges; the real gate is meshfed-release's terraform-provider-acceptance job).

Uncovered functions (combined run)
github.com/meshcloud/terraform-provider-meshstack/client/api_key_permissions.go:225:							AllApiKeyPermissions					0.0%
github.com/meshcloud/terraform-provider-meshstack/client/buildingblock.go:89:								Read							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/buildingblock.go:93:								Create							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/buildingblock.go:97:								Delete							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/client.go:48:									NewApiTokenAuthorization				0.0%
github.com/meshcloud/terraform-provider-meshstack/client/internal/logging.go:27:							Debug							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/internal/logging.go:31:							Info							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/internal/logging.go:35:							Warn							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/internal/retry.go:228:								Close							0.0%
github.com/meshcloud/terraform-provider-meshstack/client/internal/retry.go:249:								Write							0.0%

Combined with go tool covdata merge over the unit and acceptance coverage data. The acceptance suite runs ./internal/provider against the live backend; coverage is attributed across all packages (-coverpkg=./...).

@j0g3sc
j0g3sc force-pushed the feature/building-block-definition-IO-order branch from 5321918 to 49e6c12 Compare July 3, 2026 19:41
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ Acceptance tests failed on the latest run. This is advisory and does not block merge — the job runs against the last merged meshfed-release backend images. If this change needs a companion backend change, validate the pair via meshfed-release's terraform-provider-acceptance job; otherwise this is a regression to fix.

🔗 View the failing acceptance job

@j0g3sc
j0g3sc requested a review from grubmeshi July 3, 2026 19:48

@grubmeshi grubmeshi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have a look at my proposal of implementing it differently. I think only addressing this inside the resource is not enough and it must be handled inside versionContentHash itself.

Comment thread internal/provider/building_block_definition_resource.go Outdated
Comment thread internal/provider/building_block_definition_resource_schema.go Outdated
@j0g3sc
j0g3sc force-pushed the feature/building-block-definition-IO-order branch 2 times, most recently from 816cdbc to 72737b4 Compare July 7, 2026 14:06
j0g3sc added 3 commits July 7, 2026 17:06
…on I/O without affecting the calculated hash for change detection

CU-86cabn76y
…nd checks. Include BB definition version input and output displayOrder field into hashsum calculation as they cannot be changed on released versions.
@j0g3sc
j0g3sc force-pushed the feature/building-block-definition-IO-order branch from 8b73bcd to 249a384 Compare July 7, 2026 15:06

@grubmeshi grubmeshi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address my review comments, in general, the approach is sound I think.

Comment thread internal/provider/building_block_definition_version_content_hash.go Outdated
Comment thread internal/provider/building_block_definition_version_content_hash.go Outdated
Comment thread internal/provider/building_block_definition_version_content_hash.go Outdated
Comment thread internal/provider/building_block_definition_version_content_hash.go Outdated
Comment thread CHANGELOG.md
Comment thread internal/provider/building_block_definition_resource_model_test.go Outdated
Comment thread internal/provider/building_block_definition_resource_model_test.go
Comment thread internal/provider/building_block_definition_resource.go
@j0g3sc
j0g3sc force-pushed the feature/building-block-definition-IO-order branch from 249a384 to bf6305c Compare July 8, 2026 14:49
@j0g3sc
j0g3sc requested a review from grubmeshi July 8, 2026 14:51
@j0g3sc
j0g3sc marked this pull request as ready for review July 8, 2026 14:51
…ulated by an older hash algorithm version

Fixes #209
@j0g3sc
j0g3sc force-pushed the feature/building-block-definition-IO-order branch from bf6305c to 8f569e8 Compare July 9, 2026 07:18
@j0g3sc
j0g3sc force-pushed the feature/building-block-definition-IO-order branch from f482f99 to 15f7b81 Compare July 9, 2026 12:23
@j0g3sc
j0g3sc merged commit 117107a into main Jul 9, 2026
5 checks passed
@j0g3sc
j0g3sc deleted the feature/building-block-definition-IO-order branch July 9, 2026 15:10
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