Skip to content

Commit 3129490

Browse files
committed
Added a new section in CONTRIBUTING.md with an LLM prompt to validate Kotlin/Android code snippets in the web documentation against the SDK source code.
1 parent b1be2bf commit 3129490

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,55 @@ Example:
158158
// @specNotApplicable CHA-EX3a - Our API does not have a concept of "partial options" unlike the JS API which this spec item considers.
159159
```
160160

161+
## Validate website docs snippet changes
162+
163+
As part of the [release process](#release-process), you should validate that the web documentation code snippets are accurate
164+
and up-to-date with the SDK source code. This is done by running the following prompt against a locally cloned copy of the
165+
[ably/docs](https://github.com/ably/docs) repository and this SDK repository.
166+
167+
> [!IMPORTANT]
168+
> This prompt should be run with the most powerful LLM available to you (e.g. Claude Opus, GPT-4, etc.) for the best results.
169+
170+
Replace `{DOCS_PATH}` with the path to your local clone of the [ably/docs](https://github.com/ably/docs) repository, `{SDK_NAME}` with
171+
`ably-chat-swift`, and `{SDK_PATH}` with the path to your local clone of this SDK repository.
172+
173+
~~~
174+
Verify all `swift` annotated code snippets in `.mdx` files located at `{DOCS_PATH}` against the `{SDK_NAME}` source code repository at `{SDK_PATH}`.
175+
176+
### Verification Steps:
177+
178+
1. **Find all code snippets**: Search for all code blocks with the `swift` annotation in `.mdx` files.
179+
180+
2. **Understand SDK structure**: Analyze the SDK source code to understand:
181+
- Public classes and their constructors
182+
- Public methods and their signatures (parameters, return types)
183+
- Public properties and their types
184+
- Enums and their values
185+
- Namespaces and import requirements
186+
187+
3. **Cross-check each snippet** for the following issues:
188+
- **Syntax errors**: Missing keywords (e.g., `new` for constructors), missing semicolons, incorrect brackets
189+
- **Naming conventions**: Verify casing matches the language conventions (e.g., PascalCase for C# properties, camelCase for JavaScript)
190+
- **API accuracy**: Verify method names, property names, and enum values exist in the SDK
191+
- **Type correctness**: Verify correct types are used (e.g., `ConnectionEvent` vs `ConnectionState`)
192+
- **Namespace/import requirements**: Note any required imports that are missing from examples
193+
- **Wrong language**: Detect if code from another language was accidentally used
194+
195+
4. **Generate a verification report** with:
196+
- Total snippets found
197+
- List of issues found with:
198+
- File path and line number
199+
- Current (incorrect) code
200+
- Expected (correct) code
201+
- Source reference in SDK
202+
- List of verified APIs that are correct
203+
- Success rate percentage
204+
- Recommendations for fixes
205+
206+
### Output Format:
207+
Create/update a markdown report file `chat_swift_api_verification_report.md` with all findings.
208+
~~~
209+
161210
## Release process
162211

163212
For each release, the following needs to be done:
@@ -171,7 +220,10 @@ For each release, the following needs to be done:
171220
- From the newly generated changes remove everything that don't make much sense to the library user
172221
- Copy the final list of changes to the top of the `CHANGELOG.md` file. Modify as necessary to fit the existing format of this file
173222
- Commit these changes and push to the origin `git add CHANGELOG.md && git commit -m "Update change log." && git push -u origin release/x.x.x`
223+
- Run the [Validate website docs snippet changes](#validate-website-docs-snippet-changes) locally to verify that all `swift` code snippets in the [web documentation](https://github.com/ably/docs) are accurate and up-to-date with the SDK source code. Review the generated report and fix any issues found.
224+
- Create a PR on the [website docs](https://github.com/ably/docs) that updates the SDK version in the setup/installation guide. Additionally, include fixes for any documentation issues identified in the previous step. Even if there are no public API changes, a PR must still be created to update the SDK version.
174225
- Make a pull request against `main` and await approval of reviewer(s)
175226
- Once approved and/or any additional commits have been added, merge the PR
176227
- After merging the PR, wait for all CI jobs for `main` to pass.
177228
- Publish your drafted release (refer to previous releases for release notes format)
229+
- Merge any [website docs](https://github.com/ably/docs) PRs related to the changes.

0 commit comments

Comments
 (0)