Skip to content

Extend refresh with new options#464

Merged
dmitry-lyfar merged 2 commits into
mainfrom
feature/refresh-restore
Aug 29, 2025
Merged

Extend refresh with new options#464
dmitry-lyfar merged 2 commits into
mainfrom
feature/refresh-restore

Conversation

@dmitry-lyfar
Copy link
Copy Markdown
Collaborator

@dmitry-lyfar dmitry-lyfar commented Aug 27, 2025

Description

  • workshop refresh will skip the change if no updates to the SDKs, interface connections or the base were found by the resolver.

  • workshop refresh --restore will restore the workshop from the latest snapshot made after the last successful setup-base run.

Self-review quick check

  • Make decisions that cost a lot to reverse explicit in the PR description.
  • Avoid nested conditions.
  • Delete dead code and redundant comments.
  • Normalise symmetries by sticking to doing identical things identically.
// one way to handle errors
if err := f(); err != nil {
   ...
}

// one way to handle multiple returns
val, err := f()
if err != nil {
   ...
}
...
  • Check that coupled code elements, files, and directories are adjacent. For example, test data is stored as close as possible to a test.
  • Put variable declaration and initialisation together.
  • Divide large expressions into digestable and self-explanatory ones. Use multiple variables if required.
  • Put a blank line between two logically different chunks of code.
  • Follow the style guide for new error messages.

Docs

  • I have checked and added or updated relevant documentation.
  • I have checked and added or updated relevant release notes.
  • I have included the technical author in the review.

Or:

  • I confirm the PR has no implications for documentation.

@dmitry-lyfar dmitry-lyfar requested a review from Copilot August 27, 2025 08:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a refresh-restore feature that allows workshops to be refreshed in two modes: update mode (default) that applies changes from workshop definitions, and restore mode that reverts workshops to their last successful snapshot state. The feature includes new CLI options, API parameters, and logic to detect when no updates are available.

Key changes:

  • Adds --restore flag to refresh command for reverting to snapshot state
  • Implements refresh option validation in API with "update" and "restore" modes
  • Introduces "no-updates-available" error handling to prevent unnecessary operations

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/overlord/conflict/conflict.go Defines RefreshOption enum with update/restore modes and parsing logic
internal/overlord/workshopstate/request.go Implements refresh option handling and update detection logic in RefreshMany method
internal/daemon/api_workshops.go Adds refresh option validation and no-updates-available response handling
cmd/workshop/refresh.go Adds --restore flag and integrates refresh options into CLI
cmd/workshop/sketch.go Handles no-updates-available errors in sketch refresh workflow
client/projects.go Updates Refresh API call to include refresh option parameter
Multiple test files Updates test expectations to include new refresh-option parameter

Comment thread internal/overlord/workshopstate/request.go Outdated
Comment thread internal/overlord/workshopstate/request.go Outdated
Comment thread internal/overlord/sdkstate/handlers.go Outdated
Comment thread internal/overlord/sdkstate/handlers.go Outdated
Comment thread internal/overlord/sdkstate/handlers.go Outdated
@dmitry-lyfar dmitry-lyfar force-pushed the feature/refresh-restore branch 4 times, most recently from fca30b1 to a88f55b Compare August 27, 2025 10:06
@dmitry-lyfar dmitry-lyfar self-assigned this Aug 27, 2025
@dmitry-lyfar dmitry-lyfar requested review from akcano and removed request for akcano August 27, 2025 10:09
@dmitry-lyfar dmitry-lyfar changed the title Feature/refresh restore Extend refresh with new options Aug 27, 2025
@dmitry-lyfar dmitry-lyfar requested a review from akcano August 27, 2025 10:19
@dmitry-lyfar dmitry-lyfar marked this pull request as ready for review August 27, 2025 10:47
@dmitry-lyfar dmitry-lyfar force-pushed the feature/refresh-restore branch 3 times, most recently from ed350bd to 526bfc8 Compare August 27, 2025 22:01
@dmitry-lyfar dmitry-lyfar force-pushed the feature/refresh-restore branch from 526bfc8 to 36671f8 Compare August 27, 2025 23:19
Copy link
Copy Markdown
Contributor

@jonathan-conder jonathan-conder left a comment

Choose a reason for hiding this comment

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

Looks good and seems to be working well for the most part

Comment thread client/client.go Outdated
Comment thread cmd/workshop/sketch.go Outdated
Comment thread internal/daemon/api_workshops_test.go Outdated
Comment thread internal/daemon/response.go Outdated
Comment thread internal/overlord/conflict/conflict.go
Comment thread internal/overlord/workshopstate/request.go
Comment thread cmd/workshop/sketch.go Outdated
Comment thread cmd/workshop/sketch.go Outdated
@dmitry-lyfar dmitry-lyfar force-pushed the feature/refresh-restore branch from 7ed97a8 to cccaa47 Compare August 29, 2025 03:43
* workshop refresh --restore will restore the
workshop from the latest snapshot made after
the last successful setup-base run.

* workshop refresh will skip the change if
no updates to the SDKs, interface connections and
the base were found by the resolver.
@dmitry-lyfar dmitry-lyfar force-pushed the feature/refresh-restore branch from cccaa47 to 3d1eb87 Compare August 29, 2025 03:56
@github-actions
Copy link
Copy Markdown

TICS Quality Gate

✔️ Passed

workshop

All conditions passed

See the results in the TICS Viewer

The following files have been checked for this project
  • client/client.go
  • client/projects.go
  • cmd/workshop/refresh.go
  • cmd/workshop/sketch.go
  • internal/daemon/api_workshops.go
  • internal/daemon/response.go
  • internal/overlord/conflict/conflict.go
  • internal/overlord/sdkstate/handlers.go
  • internal/overlord/workshopstate/request.go

Automatic-tests / code-coverage / TICS GitHub Action

@dmitry-lyfar dmitry-lyfar merged commit 9d6fcea into main Aug 29, 2025
11 checks passed
@dmitry-lyfar dmitry-lyfar deleted the feature/refresh-restore branch August 29, 2025 04:53
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.

4 participants