Replace legacy Robocorp strategy with RCC defaults and migration logic#80
Replace legacy Robocorp strategy with RCC defaults and migration logic#80joshyorko wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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 withRCC_HOME/RCC_PRODUCT_NAMEsupport and legacy-home detection fallback (~/.robocorp→~/.rcc). - Updates platform default paths, CLI initialization (removes
--robocorp), and renames lock/header identifiers fromrobocorptorcc. - 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. |
| 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()) |
There was a problem hiding this comment.
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.
| request.Header.Add("rcc-installation-id", xviper.TrackingIdentity()) | |
| if xviper.CanTrack() { | |
| request.Header.Add("rcc-installation-id", xviper.TrackingIdentity()) | |
| } |
| func ProductLock() string { | ||
| return filepath.Join(Product.Home(), "robocorp.lck") | ||
| return filepath.Join(Product.Home(), "rcc.lck") |
There was a problem hiding this comment.
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.
| } | ||
| return ExpandPath(defaultRobocorpLocation) | ||
| legacy := ExpandPath(defaultLegacyLocation) | ||
| if _, err := os.Stat(legacy); err == nil { |
There was a problem hiding this comment.
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.
| if _, err := os.Stat(legacy); err == nil { | |
| if info, err := os.Stat(legacy); err == nil && info.IsDir() { |
|
|
||
| wont_be.Panic(func() { blobs.MustAsset("assets/robocorp_settings.yaml") }) | ||
| wont_be.Panic(func() { blobs.MustAsset("assets/rcc_settings.yaml") }) | ||
|
|
There was a problem hiding this comment.
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.
Motivation
RCC_HOME,RCC_PRODUCT_NAME) while preserving backwards compatibility withROBOCORP_HOME.--robocorpflag and ensure platform defaults point torcclocations.Description
legacyStrategywithrccStrategyand introducedRCC_HOME_VARIABLEandRCC_PRODUCT_NAME, implementingRccMode()and making product name configurable viaRCC_PRODUCT_NAMEwith defaultRCC(common/strategies.go).RCC_HOME→ROBOCORP_HOME→ existing legacy folder (~/.robocorp) if present → default~/.rcc, and updated holotree platform defaults torccpaths (common/strategies.go,common/platform_*.go).RccMode(), changed lock filename torcc.lck, removed the--robocorppersistent flag, and updated CLI help/config references to useProductAPI (common/variables.go,cmd/root.go).assets/robocorp_settings.yamltoassets/rcc_settings.yamland updated references and tests; changed community default org prefix torcc; renamed HTTP header key fromrobocorp-installation-idtorcc-installation-idin cloud/pull flows (assets/,operations/community.go,cloud/client.go,operations/pull.go,blobs/asset_test.go).common/strategies_test.go).Testing
gofmtto modified files successfully.GOARCH=amd64 go test ./commonand thecommonpackage tests (including the newcommon/strategies_test.go) passed. ✅GOARCH=amd64 go test ./...but the run fails in this environment because generated embedded assets are missing underblobs/assets(error:pattern assets/*.py: no matching files found) andinvis not installed here, so full-suite verification could not complete.inv assets(or ensureblobs/assetsare populated) and runGOARCH=amd64 go test ./...to validate the full repository and Robot acceptance tests (inv robot) if needed.Codex Task