|
1 | | -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. |
| 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 | 2 |
|
3 | | -For further information, please see [README.md](../README.md) and the [CONTRIBUTING.md](../CONTRIBUTING.md) docs. |
4 | 3 |
|
5 | | -## Code Standards |
6 | 4 |
|
7 | | -### Required Before Each Commit |
8 | | -- Run `make fmt` before committing any changes to ensure proper code formatting, this will run gofmt on all Go files to maintain consistent style. |
| 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` |
| 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. |
9 | 66 | - Run `make lint` to ensure any linting errors have not surfaced with your changes |
| 67 | +- Run `make fmt` before committing any changes to ensure proper code formatting, this will run gofmt on all Go files to maintain consistent style. |
10 | 68 |
|
11 | | -### Required Before Pull Request |
12 | | -- Run `make docs-generate` to update the documentation. |
| 69 | +## 8. Final Reflection and Additional Testing |
| 70 | +- Reflect carefully on the original intent of the user and the problem statement. |
| 71 | +- Think about potential edge cases or scenarios that may not be covered by existing tests. |
| 72 | +- Write additional tests that would need to pass to fully validate the correctness of your solution. |
| 73 | +- Run these new tests and ensure they all pass. |
| 74 | +- Be aware that there are additional hidden tests that must also pass for the solution to be successful. |
| 75 | +- 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. |
13 | 76 |
|
14 | | -### Development Flow |
15 | | -- Develop feature or fix bug |
16 | | -- Write tests to validate behavior |
17 | | -- Run `make test` to run test suite |
| 77 | +## 9. Before Submitting Pull Requests |
| 78 | +- Run `make docs-generate` to update the documentation, and ensure the results of this command make it into your pull request. |
18 | 79 |
|
19 | 80 | ## Repository Structure |
20 | 81 |
|
|
0 commit comments