Repository navigation
API update - #2
Merged
Merged
Conversation
…xt support to `Plan` interface, update documentation, and add related tests
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The API contracts, fixtures, tests, and documentation are consistently updated.
Review effort: Balanced
Findings: None
What changed in this PR
Adds context-aware metadata retrieval for plans and runtimes.
Changes:
- Updates
Plan.Paramsto accept a context. - Adds
Runtime.Versionand the opaqueVersiontype. - Updates documentation, contract tests, and fixtures.
| File | Description |
|---|---|
version.go |
Defines Version and its string representation. |
version_test.go |
Tests preservation of opaque version values. |
runtime.go |
Adds context-aware version retrieval. |
runtime_contract_test.go |
Verifies the new runtime method signature. |
plan.go |
Makes parameter retrieval context-aware. |
plan_contract_test.go |
Verifies the updated plan method signature. |
output_contract_fixture_test.go |
Updates the runtime test fixture. |
README.md |
Documents metadata retrieval semantics. |
doc.go |
Extends package-level API documentation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces two new metadata retrieval methods to the API:
Plan.Params(ctx)andRuntime.Version(ctx). Both methods now require a non-nil context and may involve remote I/O, with clear semantics for cancellation and error handling. Additionally, a new opaqueVersiontype is defined for version reporting, and the documentation and tests are updated accordingly.API Additions and Changes:
Plan.Params(ctx context.Context) ([]string, error)to thePlaninterface, replacing the old parameterlessParamsmethod. This new method requires a non-nil context, supports cancellation, and distinguishes between empty parameter lists and metadata retrieval errors. [1] [2] [3] [4]Runtime.Version(ctx context.Context) (Version, error)to theRuntimeinterface. This method reports the runtime's version (as an opaque value), requires a non-nil context, and supports cancellation. [1] [2] [3] [4]Type and Implementation Updates:
Versiontype as an opaque string-backed value, with aString()method that preserves the original value.Params(ctx)andVersion(ctx)methods, ensuring context-awareness and error handling. [1] [2] [3] [4]Documentation Improvements:
README.mdanddoc.goto clarify the semantics, error handling, and context requirements for the new metadata methods. [1] [2] [3] [4] [5]These changes make the API more robust and future-proof by standardizing metadata retrieval and version reporting with clear context and error semantics.