Skip to content

Add ucanlib (from libforge) and fixed test identities to testutil - #57

Draft
Peeja wants to merge 2 commits into
mainfrom
claude/forge-consolidation
Draft

Add ucanlib (from libforge) and fixed test identities to testutil#57
Peeja wants to merge 2 commits into
mainfrom
claude/forge-consolidation

Conversation

@Peeja

@Peeja Peeja commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

[From Claude:]

Two additive commits that let libforge's ucan and testutil packages be retired as part of consolidating libforge into the forge monorepo. Nothing existing changes; the full module builds, vets and tests clean standalone (GOWORK=off).

ucanlib/ — invoker-side proof chain assembly

libforge's ucan package (Go package name ucanlib) moved here as ucanlib/. It is the invoker-side counterpart to validator/: validator walks a proof chain already attached to a token and checks it; ucanlib searches a delegation store and assembles one, in the order an invocation's prf list expects — DelegationMatcherFunc, ProofChain, ProofStore, and the container-backed ContainerProofStore. Both traverse the same Container type from opposite ends, which is why it belongs in this module rather than in a Forge-specific library.

The directory is ucanlib (the package's own name) because ucan/ is taken here. Source is byte-identical to libforge's ucan/proof_chain.go and ucan/proof_store.go apart from a package doc comment; the tests differ only in import paths.

Deliberately not included from libforge's ucan/ directory: ucan/retrieval (an HTTP transport binding used by Forge services, staying in the monorepo) and ucan/zapucan (depends on go.uber.org/zap, which this module's dependency policy excludes).

testutil/Must2 and fixed identities

Every symbol libforge/testutil exports is already a re-export of this package except two things dependents actually use: Must2 (the two-value form of Must) and six fixed identities — Alice, Bob, Carol, Mallory, Service, WebService — for tests that need stable DIDs. Both are added here (same throwaway ed25519 test keys as libforge's fixtures, so tests that hard-code the DIDs keep passing after switching imports). With these in place, dependents can import ucantone/testutil directly and libforge/testutil can be deleted rather than moved.

Verification

GOWORK=off go build ./... && GOWORK=off go vet ./... && GOWORK=off go test ./...

AGENTS.md gained a bullet for each addition. No other files touched.


Part of the forge consolidation; the forge PRs that consume this pin github.com/fil-forge/ucantone@v0.0.0-20260904190501-7fca40e13941 (this branch's head) and should be re-pinned to main once this merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CGAGAib517Ae1kg8SCdcEt


Generated by Claude Code

Adds the two things dependents have been getting from libforge/testutil
that this package did not have: Must2, the two-value form of Must, and
six fixed identities (Alice, Bob, Carol, Mallory, Service, WebService)
for tests that need stable DIDs rather than fresh random ones. Every
other symbol libforge/testutil exports is already a re-export of this
package, so with these in place dependents can import ucantone/testutil
directly.

The identities are the same throwaway ed25519 keys libforge's fixtures
use, so tests that hard-code their DIDs keep passing after switching
import paths. WebService is Service under a did:web identity.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGAGAib517Ae1kg8SCdcEt
Moves libforge's ucan package (Go package name ucanlib) into ucantone.
It is the invoker-side counterpart to validator: validator walks a proof
chain already attached to a token and checks it; ucanlib searches a
delegation store and assembles one — DelegationMatcherFunc, ProofChain,
ProofStore, and the container-backed ContainerProofStore — in the order
an invocation's prf list expects. Both traverse the same Container type
from opposite ends, so they belong in the same module.

The directory is ucanlib rather than ucan (the package's own name, and
ucan/ is taken here). Source is byte-identical to libforge's apart from
a package doc comment and the import paths in the tests, which now use
this module's testutil for the fixed identities they rely on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGAGAib517Ae1kg8SCdcEt
Peeja pushed a commit to fil-forge/forge that referenced this pull request Sep 4, 2026
github.com/fil-forge/forge/protocol carries what libforge published as
the network's wire contract, taken from libforge main (81372e7) plus its
feat/hilt-s3-client branch (928cf2a, libforge PR #52): commands/** (every
command binding except ucan/attest, which belongs with attestation),
blobindex, receipt, retrieval (was ucan/retrieval), and the two small
helpers they depend on, bytemap and digestutil. Import paths change from
github.com/fil-forge/libforge/<pkg> to
github.com/fil-forge/forge/protocol/<pkg>; the code does not, with one
exception: commands/s3/bucket/errors.go is hilt main's newer copy of the
bucket error sentinels (it adds ErrBucketAlreadyOwned), not PR #52's.

The module depends only on ucantone and third-party libraries — on none
of the other in-repo modules — so anything can consume it. ucantone is
pinned to the branch that took libforge's ucan package
(fil-forge/ucantone#57); re-pin to main once that merges.

Codecs are generated (cbor-gen + dag-json-gen): `make gen` regenerates,
`make codegen-build gen-check` is the CI gate. Both pass here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGAGAib517Ae1kg8SCdcEt
Peeja pushed a commit to fil-forge/forge that referenced this pull request Sep 4, 2026
github.com/fil-forge/forge/protocol carries what libforge published as
the network's wire contract, taken from libforge main (81372e7) plus its
feat/hilt-s3-client branch (928cf2a, libforge PR #52): commands/** (every
command binding except ucan/attest, which belongs with attestation),
blobindex, receipt, retrieval (was ucan/retrieval), and the two small
helpers they depend on, bytemap and digestutil. Import paths change from
github.com/fil-forge/libforge/<pkg> to
github.com/fil-forge/forge/protocol/<pkg>; the code does not, with one
exception: commands/s3/bucket/errors.go is hilt main's newer copy of the
bucket error sentinels (it adds ErrBucketAlreadyOwned), not PR #52's.

The module depends only on ucantone and third-party libraries — on none
of the other in-repo modules — so anything can consume it. ucantone is
pinned to the branch that took libforge's ucan package
(fil-forge/ucantone#57); re-pin to main once that merges.

Codecs are generated (cbor-gen + dag-json-gen): `make gen` regenerates,
`make codegen-build gen-check` is the CI gate. Both pass here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGAGAib517Ae1kg8SCdcEt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants