docs: verify and update README examples for latest releases #387#391
Closed
NiKrause wants to merge 6 commits intostoracha:mainfrom
NiKrause:clean/readme-examples-387
Closed
docs: verify and update README examples for latest releases #387#391NiKrause wants to merge 6 commits intostoracha:mainfrom NiKrause:clean/readme-examples-387
NiKrause wants to merge 6 commits intostoracha:mainfrom
NiKrause:clean/readme-examples-387
Conversation
Fixes #387 - Update ed25519.Signer.parse/ed25519.Verifier.parse to ed25519.parse() - Fix capability invocation structure to use nb: { link: ... } format - Fix typos and variable name inconsistencies - Add missing proofs parameter to invocations - Fix server reference in HTTP listener example - Add missing await keyword for async operations - Update service handler to properly access context.store All examples now work with: - @ucanto/server v11.0.0 - @ucanto/client v9.0.1 - Latest @ucanto/principal API Verified with successful build and test runs.
Addresses issue #387 by adding tests for README code snippets. Tests verify that: - README examples use correct ed25519.parse() API (not deprecated APIs) - Capability definitions work with current API - Service definitions with provide() work correctly - Client invocations have correct structure These tests ensure README examples stay up-to-date with API changes and prevent regressions in documentation code.
- Add packages/server/test/readme-full-integration.spec.js with full end-to-end tests - Test 1: Complete workflow integration with server-as-channel pattern * Capability definition with custom file/link capability * Service handler using Server.provide() pattern * Server setup with CAR codec and authorization * Client connection using recommended server-as-channel approach * Full invocation execution and result validation * Data store verification to ensure handler execution - Test 2: Delegation example with proof-based invocations * Capability delegation between users (Alice → Bob) * Proof-based invocation workflow * URI path hierarchy validation * Complete delegation and execution flow - Uses proper Schema.struct() for nb field validation - Implements correct derives function with URI path constraints - Includes canIssue authorization logic for DID-based file access - Validates complete data flow from definition to storage - Achieves 100% README example coverage Resolves #387: test all examples and code snippets in READMEs
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.
Fixes the #387 Issue with:
The examples in the Readme (main, client, server README) were updated to latest API version and tests added accordingly
Test coverage should be 100% and Readme was restructured starting with client implementation
Comments from this PR were respected: #388
e.g. "Note: in tests, you don't even need a HTTP server running - a Ucanto server is a channel, so you can pass it to the client as the channel to use." and
"IMHO the README should shown how to use the library against an already running server - i.e. just the code you'd need to use the client. I'd link to the server README for actually setting up and running a server component."