Skip to content

Commit 641f7f6

Browse files
wandergeektobio
andauthored
Add copilot instructions and issue template tweaks (#1205)
* Add copilot instructions and issue template tweaks * Update .github/copilot-instructions.md Co-authored-by: Toby Brain <[email protected]> * Update .github/copilot-instructions.md Co-authored-by: Toby Brain <[email protected]> * Update .github/copilot-instructions.md Co-authored-by: Toby Brain <[email protected]> * remove dumb file counts * Build out prompt further * Update copilot-instructions.md Co-authored-by: Toby Brain <[email protected]> * Update copilot-instructions.md Co-authored-by: Toby Brain <[email protected]> --------- Co-authored-by: Toby Brain <[email protected]>
1 parent 0456818 commit 641f7f6

File tree

2 files changed

+123
-1
lines changed

2 files changed

+123
-1
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ If applicable, add screenshots to help explain your problem.
3636
- Elasticsearch Version [e.g. 7.16.0]
3737

3838
**Additional context**
39-
Add any other context about the problem here.
39+
Add any other context about the problem here. Links to specific affected code files and paths here are also extremely useful (if known).

.github/copilot-instructions.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
You will be tasked to fix an issue from an open-source repository. This is a Go based repository hosting a Terrform provider for the elastic stack (elasticsearch and kibana) APIs. This repo currently supports both [plugin framework](https://developer.hashicorp.com/terraform/plugin/framework/getting-started/code-walkthrough) and [sdkv2](https://developer.hashicorp.com/terraform/plugin/sdkv2) resources. Unless you're told otherwise, all new resources _must_ use the plugin framework.
2+
3+
4+
5+
6+
Take your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.
7+
8+
9+
Please see [README.md](../README.md) and the [CONTRIBUTING.md](../CONTRIBUTING.md) docs before getting started.
10+
11+
12+
# Workflow
13+
14+
## High-Level Problem Solving Strategy
15+
16+
1. Understand the problem deeply. Carefully read the issue and think critically about what is required.
17+
2. Investigate the codebase. Explore relevant files, search for key functions, and gather context.
18+
3. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps.
19+
4. Implement the fix incrementally. Make small, testable code changes.
20+
5. Debug as needed. Use debugging techniques to isolate and resolve issues.
21+
6. Test frequently. Run tests after each change to verify correctness.
22+
7. Iterate until the root cause is fixed and all tests pass.
23+
8. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.
24+
25+
Refer to the detailed sections below for more information on each step.
26+
27+
## 1. Deeply Understand the Problem
28+
Carefully read the issue and think hard about a plan to solve it before coding. Your thinking should be thorough and so it's fine if it's very long. You can think step by step before and after each action you decide to take.
29+
30+
## 2. Codebase Investigation
31+
- Explore relevant files and directories.
32+
- Search for key functions, classes, or variables related to the issue.
33+
- Read and understand relevant code snippets.
34+
- Identify the root cause of the problem.
35+
- Validate and update your understanding continuously as you gather more context.
36+
37+
## 3. Develop a Detailed Plan
38+
- Outline a specific, simple, and verifiable sequence of steps to fix the problem.
39+
- Break down the fix into small, incremental changes.
40+
41+
## 4. Making Code Changes
42+
- Before editing, always read the relevant file contents or section to ensure complete context.
43+
- If a patch is not applied correctly, attempt to reapply it.
44+
- Make small, testable, incremental changes that logically follow from your investigation and plan.
45+
46+
## 5. Debugging
47+
- Make code changes only if you have high confidence they can solve the problem
48+
- When debugging, try to determine the root cause rather than addressing symptoms
49+
- Debug for as long as needed to identify the root cause and identify a fix
50+
- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening
51+
- To test hypotheses, you can also add test statements or functions
52+
- Revisit your assumptions if unexpected behavior occurs.
53+
- You MUST iterate and keep going until the problem is solved.
54+
55+
## 6. Testing
56+
- Run tests frequently using `make test` and `make testacc`
57+
- After each change, verify correctness by running relevant tests.
58+
- If tests fail, analyze failures and revise your patch.
59+
- Write additional tests if needed to capture important behaviors or edge cases.
60+
- Ensure all tests pass before finalizing.
61+
62+
## 7. Final Verification
63+
- Confirm the root cause is fixed.
64+
- Review your solution for logic correctness and robustness.
65+
- Iterate until you are extremely confident the fix is complete and all tests pass.
66+
- Run `make lint` to ensure any linting errors have not surfaced with your changes. This task may automatically correct any linting errors, and regenerate documentation. Include any changes in your commit.
67+
68+
## 8. Final Reflection and Additional Testing
69+
- Reflect carefully on the original intent of the user and the problem statement.
70+
- Think about potential edge cases or scenarios that may not be covered by existing tests.
71+
- Write additional tests that would need to pass to fully validate the correctness of your solution.
72+
- Run these new tests and ensure they all pass.
73+
- Be aware that there are additional hidden tests that must also pass for the solution to be successful.
74+
- Do not assume the task is complete just because the visible tests pass; continue refining until you are confident the fix is robust and comprehensive.
75+
76+
## 9. Before Submitting Pull Requests
77+
- Run `make docs-generate` to update the documentation, and ensure the results of this command make it into your pull request.
78+
79+
## Repository Structure
80+
81+
**docs/** - Documentation files
82+
**data-sources/** - Documentation for Terraform data sources
83+
**guides/** - User guides and tutorials
84+
**resources/** - Documentation for Terraform resources
85+
**examples/** - Example Terraform configurations
86+
**cloud/** - Examples using the cloud to launch testing stacks
87+
**data-sources/** - Data source usage examples
88+
**resources/** - Resource usage examples
89+
**provider/** - Provider configuration examples
90+
**generated/** - Auto-generated clients from the `generate-clients` make target
91+
**alerting/** - Kibana alerting API client
92+
**connectors/** - Kibana connectors API client
93+
**kbapi/** - Kibana API client
94+
**slo/** - SLO (Service Level Objective) API client
95+
**internal/** - Internal Go packages
96+
**acctest/** - Acceptance test utilities
97+
**clients/** - API client implementations
98+
**elasticsearch/** - Elasticsearch-specific logic
99+
**fleet/** - Fleet management functionality
100+
**kibana/** - Kibana-specific logic
101+
**models/** - Data models and structures
102+
**schema/** - Connection schema definitions for plugin framework
103+
**utils/** - Utility functions
104+
**versionutils/** - Version handling utilities
105+
**libs/** - External libraries
106+
**go-kibana-rest/** - Kibana REST API client library
107+
**provider/** - Core Terraform provider implementation
108+
**scripts/** - Utility scripts for development and CI
109+
**templates/** - Template files for documentation generation
110+
**data-sources/** - Data source documentation templates
111+
**resources/** - Resource documentation templates
112+
**guides/** - Guide documentation templates
113+
**xpprovider/** - Additional provider functionality needed for Crossplane
114+
115+
## Key Guidelines
116+
* Follow Go best practices and idiomatic patterns
117+
* Maintain existing code structure and organization
118+
* Write unit tests for new functionality. Use table-driven unit tests when possible.
119+
* When creating a new Plugin Framework based resource, follow the code organisation of `internal/elasticsearch/security/system_user`
120+
* Avoid adding any extra functionality into the `utils` package, instead preferencing adding to a more specific package or creating one to match the purpose
121+
* Think through your planning first using the codebase as your guide before creating new resources and data sources
122+

0 commit comments

Comments
 (0)