fix(opencode): use relative SDD prompt paths#1252
Conversation
|
Maintainers, please add the |
📝 WalkthroughWalkthroughSDD profile overlays and OpenCode prompt injection now generate settings-relative ChangesPortable prompt reference generation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Inject
participant GenerateProfileOverlay
participant SharedPromptFileRef
participant OpenCodeSettings
Inject->>GenerateProfileOverlay: pass settingsPath
GenerateProfileOverlay->>SharedPromptFileRef: build phase reference
SharedPromptFileRef-->>GenerateProfileOverlay: return relative {file:...}
GenerateProfileOverlay->>OpenCodeSettings: write overlay
Inject->>SharedPromptFileRef: build inlined prompt reference
SharedPromptFileRef-->>Inject: return relative {file:...}
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ff49243 to
2242051
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/components/sdd/profiles_test.go (1)
778-797: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert portability independently of the production helper.
The test computes
expectedRefwith the sameSharedPromptFileRefused byGenerateProfileOverlay, so a regression that reintroduces absolute home paths can make both sides agree. Also assert that generated references are relative and contain nohomepath.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/components/sdd/profiles_test.go` around lines 778 - 797, Update the test around GenerateProfileOverlay and its phase loop to validate portability independently of SharedPromptFileRef: assert each generated prompt reference is relative and does not contain the home path before or alongside comparing expectedRef. Keep the existing expected-reference comparison, but ensure the assertions would fail if GenerateProfileOverlay emits an absolute home-based path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@internal/components/sdd/profiles_test.go`:
- Around line 778-797: Update the test around GenerateProfileOverlay and its
phase loop to validate portability independently of SharedPromptFileRef: assert
each generated prompt reference is relative and does not contain the home path
before or alongside comparing expectedRef. Keep the existing expected-reference
comparison, but ensure the assertions would fail if GenerateProfileOverlay emits
an absolute home-based path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 917aaee2-f391-4db7-843a-71f771119398
⛔ Files ignored due to path filters (1)
testdata/golden/sdd-opencode-multi-settings.goldenis excluded by!testdata/**
📒 Files selected for processing (9)
internal/cli/sync_test.gointernal/components/golden_test.gointernal/components/sdd/inject.gointernal/components/sdd/inject_test.gointernal/components/sdd/profiles.gointernal/components/sdd/profiles_lifecycle_test.gointernal/components/sdd/profiles_test.gointernal/components/sdd/prompts.gointernal/components/sdd/prompts_test.go
Linked Issue
Closes #723
PR Type
type:bug- Bug fix (non-breaking change that fixes an issue)type:feature- New feature (non-breaking change that adds functionality)type:docs- Documentation onlytype:refactor- Code refactoring (no functional changes)type:chore- Build, CI, or tooling changestype:breaking-change- Breaking change (fix or feature that changes existing behavior)Summary
Changes
internal/components/sddinternal/components/golden_test.gotestdata/golden/sdd-opencode-multi-settings.goldenTest Plan
Passed:
go test ./internal/components/sdd/...go test ./internal/components -run '^TestGoldenSDD_OpenCode_Multi$'go test ./internal/componentsgit diff --checkRuntime validation: N/A. The affected output is deterministic generated JSON and is covered by focused unit and golden tests; there is no separate runtime boundary.
Automated Checks
The repository checks will run on this PR.
Contributor Checklist
status:approvedtype:*label is appliedCo-Authored-BytrailersNotes for Reviewers
Size: 9 files, +128/-50 (178 changed lines), under the 400-line review budget.
Summary by CodeRabbit
Bug Fixes
{file:...}paths in generatedopencode.jsonoverlays and inline prompts.homedirectory paths from being embedded, improving cross-environment consistency across OpenCode and Kilocode settings layouts.Tests