Skip to content

Replace legacy Robocorp strategy with RCC defaults and migration logic#80

Open
joshyorko wants to merge 2 commits into
mainfrom
jyorko-agent/implement-feature-from-issue-76
Open

Replace legacy Robocorp strategy with RCC defaults and migration logic#80
joshyorko wants to merge 2 commits into
mainfrom
jyorko-agent/implement-feature-from-issue-76

Conversation

@joshyorko
Copy link
Copy Markdown
Owner

Motivation

  • Move the codebase off hardcoded "Robocorp" branding to a configurable RCC-first product strategy and provide a smooth migration path for existing users.
  • Provide environment-variable overrides to support multi-tenant/custom deployments (RCC_HOME, RCC_PRODUCT_NAME) while preserving backwards compatibility with ROBOCORP_HOME.
  • Simplify CLI UX by removing the unused --robocorp flag and ensure platform defaults point to rcc locations.

Description

  • Replaced legacyStrategy with rccStrategy and introduced RCC_HOME_VARIABLE and RCC_PRODUCT_NAME, implementing RccMode() and making product name configurable via RCC_PRODUCT_NAME with default RCC (common/strategies.go).
  • Implemented home resolution priority: RCC_HOMEROBOCORP_HOME → existing legacy folder (~/.robocorp) if present → default ~/.rcc, and updated holotree platform defaults to rcc paths (common/strategies.go, common/platform_*.go).
  • Switched global initialization to always use RccMode(), changed lock filename to rcc.lck, removed the --robocorp persistent flag, and updated CLI help/config references to use Product API (common/variables.go, cmd/root.go).
  • Renamed default embedded settings asset from assets/robocorp_settings.yaml to assets/rcc_settings.yaml and updated references and tests; changed community default org prefix to rcc; renamed HTTP header key from robocorp-installation-id to rcc-installation-id in cloud/pull flows (assets/, operations/community.go, cloud/client.go, operations/pull.go, blobs/asset_test.go).
  • Added unit tests for the new strategy behavior covering default naming, env var overrides, home resolution priority, legacy-folder migration, and fresh-install defaults (common/strategies_test.go).

Testing

  • Applied formatting with gofmt to modified files successfully.
  • Ran GOARCH=amd64 go test ./common and the common package tests (including the new common/strategies_test.go) passed. ✅
  • Attempted GOARCH=amd64 go test ./... but the run fails in this environment because generated embedded assets are missing under blobs/assets (error: pattern assets/*.py: no matching files found) and inv is not installed here, so full-suite verification could not complete. ⚠️
  • Notes for reviewers: regenerate assets with inv assets (or ensure blobs/assets are populated) and run GOARCH=amd64 go test ./... to validate the full repository and Robot acceptance tests (inv robot) if needed.

Codex Task

Copy link
Copy Markdown
Contributor

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 migrates the codebase from a legacy Robocorp-oriented strategy to an RCC-default strategy, adding configurable product/home resolution behavior and updating assets/docs to match the new defaults while preserving a legacy-home fallback.

Changes:

  • Introduces RccMode() strategy with RCC_HOME / RCC_PRODUCT_NAME support and legacy-home detection fallback (~/.robocorp~/.rcc).
  • Updates platform default paths, CLI initialization (removes --robocorp), and renames lock/header identifiers from robocorp to rcc.
  • Adds a new embedded default settings asset (assets/rcc_settings.yaml) and unit tests for the new strategy behavior.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
operations/pull.go Renames installation-id header to rcc-installation-id for pull/download flow.
operations/community.go Updates default community org prefix from robocorp to rcc.
docs/changelog.md Updates changelog note to reference rcc_settings.yaml.
common/variables.go Switches product initialization to RccMode() and renames product lockfile to rcc.lck.
common/strategies_test.go Adds unit tests covering RCC strategy defaults, env overrides, and legacy/fresh home resolution.
common/strategies.go Replaces legacy strategy with rccStrategy and implements RCC-first home resolution + legacy fallback.
common/platform_windows.go Updates default home/holotree locations to rcc (with legacy location preserved).
common/platform_linux.go Updates default home/holotree locations to rcc (with legacy location preserved).
common/platform_darwin.go Updates default home/holotree locations to rcc (with legacy location preserved).
cmd/root.go Removes persistent --robocorp flag and updates help text to use Product API.
cloud/client.go Renames installation-id header to rcc-installation-id in cloud client requests.
blobs/asset_test.go Updates embedded-asset test to expect assets/rcc_settings.yaml.
assets/rcc_settings.yaml Adds new default settings asset for RCC-branded deployments.
README.md Updates docs reference from robocorp_settings.yaml to rcc_settings.yaml.

Comment thread operations/pull.go
fail.On(err != nil, "Failed create request to %q failed, reason: %v", url, err)

request.Header.Add("robocorp-installation-id", xviper.TrackingIdentity())
request.Header.Add("rcc-installation-id", xviper.TrackingIdentity())
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

downloadMissingEnvironmentParts always calls xviper.TrackingIdentity() and sends the installation-id header even though tracking is disabled in this fork (xviper.CanTrack() always returns false). This also generates/persists a tracking identity unnecessarily. Gate adding this header (and calling TrackingIdentity()) behind xviper.CanTrack() like cloud/internalClient.does does.

Suggested change
request.Header.Add("rcc-installation-id", xviper.TrackingIdentity())
if xviper.CanTrack() {
request.Header.Add("rcc-installation-id", xviper.TrackingIdentity())
}

Copilot uses AI. Check for mistakes.
Comment thread common/variables.go
Comment on lines 133 to +134
func ProductLock() string {
return filepath.Join(Product.Home(), "robocorp.lck")
return filepath.Join(Product.Home(), "rcc.lck")
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Changing the product lock filename to rcc.lck can break mutual exclusion with older versions that still use robocorp.lck when the home directory resolves to the legacy location (e.g., existing ~/.robocorp). That can allow concurrent operations against the same folders during upgrade/downgrade and risk corruption. Consider maintaining backward compatibility by also locking on the legacy lockfile (or using a shared lockfile name independent of branding) when operating in/migrating from the legacy home.

Copilot uses AI. Check for mistakes.
Comment thread common/strategies.go
}
return ExpandPath(defaultRobocorpLocation)
legacy := ExpandPath(defaultLegacyLocation)
if _, err := os.Stat(legacy); err == nil {
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The legacy-home detection uses os.Stat(legacy) and treats any existing path as a legacy home. If ~/.robocorp exists but is a file (or an unreadable path yields a non-nil error), this can select an invalid home and cause downstream failures. Prefer checking that the path exists and is a directory (and handle non-IsNotExist errors explicitly) before returning it.

Suggested change
if _, err := os.Stat(legacy); err == nil {
if info, err := os.Stat(legacy); err == nil && info.IsDir() {

Copilot uses AI. Check for mistakes.
Comment thread blobs/asset_test.go
Comment on lines 31 to 33

wont_be.Panic(func() { blobs.MustAsset("assets/robocorp_settings.yaml") })
wont_be.Panic(func() { blobs.MustAsset("assets/rcc_settings.yaml") })

Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This repo’s guidance treats blobs/ as generated/read-only (AGENTS.md:184) and recommends updating assets/ then regenerating via inv assets. If this file is part of the generated blobs set, it should not be edited manually; regenerate instead. If it’s intentionally hand-maintained, consider relocating the test out of blobs/ so the “generated” directory remains fully machine-managed.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants