Skip to content

Fix import docs, add WorkloadRule docs, cover import lifecycle w/ test - #58

Open
Rupam-It wants to merge 3 commits into
mainfrom
full-fidelity-resource-import
Open

Fix import docs, add WorkloadRule docs, cover import lifecycle w/ test#58
Rupam-It wants to merge 3 commits into
mainfrom
full-fidelity-resource-import

Conversation

@Rupam-It

@Rupam-It Rupam-It commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix every resource doc's pulumi import example — all five used the wrong
    token format (devzero:index/x:X) instead of the actual registered token
    (devzero:resources:X, per schema.json/generated SDKs), so every
    documented import command in the repo would have failed.
  • Fix cluster.md's stale claim that token auto-rotates on import/update —
    the provider deliberately stopped doing that (see
    TestCluster_Update_DoesNotRotateToken) since it was silently invalidating
    a live in-cluster agent's credential on unrelated updates.
  • Add docs/resources/workload_rule.md, which didn't exist — includes an
    import note on how autoGenerate is inferred from current_source on
    every Read, not stored as its own field.
  • Add TestImport_* for all six resource types (Cluster, NodePolicy,
    NodePolicyTarget, WorkloadPolicy, WorkloadPolicyTarget, WorkloadRule),
    simulating the actual pulumi import code path — Read() called with a
    bare ID and zero-value Inputs/State against a resource seeded directly
    into the backend (as if created outside Pulumi). Each test asserts full
    attribute hydration, a clean/idempotent plan (Diff() for WorkloadRule,
    fixed-point Read() for the rest), and that a post-import Update()
    reaches the backend.
  • Add the missing UpdateWorkloadRecommendationPolicy handler to
    fakeBackendWorkloadPolicy.Update() had no test coverage against it
    until now.

Test plan

  • go build ./...
  • go vet ./...
  • go test ./... (all packages pass, including the new TestImport_*)
  • Manual staging smoke test (pulumi importpulumi preview → edit →
    pulumi up) against a real DevZero environment for at least one
    resource of each type — not run in this PR, follow-up

| `autoGenerate` | `boolean` | When `true`, the engine fills all rule fields from observed usage; manual field overrides below are ignored. |
| `cpuRule` | `ResourceRuleConfigArgs` | CPU vertical scaling rule. |
| `memoryRule` | `ResourceRuleConfigArgs` | Memory vertical scaling rule. |
| `gpuRule` | `ResourceRuleConfigArgs` | GPU vertical scaling rule (units: GPU millicores). |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: Contradictory GPU unit description in workload_rule.md

In docs/resources/workload_rule.md the gpuRule row states units are "GPU millicores" (line 100), while the ResourceRuleConfigArgs.minRequest row says "bytes for memory/GPU" (line 133). These two statements contradict each other for GPU. Pick the correct unit and make both rows agree so users don't misconfigure GPU requests.

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Fixes broken pulumi import examples across all five resource docs by correcting token format from devzero:index/x:X to the registered devzero:resources:X, removes stale token auto-rotation claim from cluster.md, adds WorkloadRule documentation with import guidance, and introduces comprehensive import lifecycle tests for all six resource types including the previously untested UpdateWorkloadRecommendationPolicy handler. Consider clarifying GPU unit descriptions in workload_rule.md—gpuRule states "GPU millicores" while ResourceRuleConfigArgs.minRequest says "bytes for memory/GPU", which conflict for GPU requests.

💡 Quality: Contradictory GPU unit description in workload_rule.md

📄 docs/resources/workload_rule.md:100 📄 docs/resources/workload_rule.md:133

In docs/resources/workload_rule.md the gpuRule row states units are "GPU millicores" (line 100), while the ResourceRuleConfigArgs.minRequest row says "bytes for memory/GPU" (line 133). These two statements contradict each other for GPU. Pick the correct unit and make both rows agree so users don't misconfigure GPU requests.

🤖 Prompt for agents
Code Review: Fixes broken `pulumi import` examples across all five resource docs by correcting token format from `devzero:index/x:X` to the registered `devzero:resources:X`, removes stale token auto-rotation claim from cluster.md, adds WorkloadRule documentation with import guidance, and introduces comprehensive import lifecycle tests for all six resource types including the previously untested `UpdateWorkloadRecommendationPolicy` handler. Consider clarifying GPU unit descriptions in workload_rule.md—`gpuRule` states "GPU millicores" while `ResourceRuleConfigArgs.minRequest` says "bytes for memory/GPU", which conflict for GPU requests.

1. 💡 Quality: Contradictory GPU unit description in workload_rule.md
   Files: docs/resources/workload_rule.md:100, docs/resources/workload_rule.md:133

   In docs/resources/workload_rule.md the `gpuRule` row states units are "GPU millicores" (line 100), while the `ResourceRuleConfigArgs.minRequest` row says "bytes for memory/GPU" (line 133). These two statements contradict each other for GPU. Pick the correct unit and make both rows agree so users don't misconfigure GPU requests.

Was this helpful? React with 👍 / 👎 | Gitar

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.

1 participant