Skip to content

feat: Add canister-metadata-section function - #726

Open
adamspofford-dfinity wants to merge 5 commits into
mainfrom
spofford/fetch-section
Open

feat: Add canister-metadata-section function#726
adamspofford-dfinity wants to merge 5 commits into
mainfrom
spofford/fetch-section

Conversation

@adamspofford-dfinity

@adamspofford-dfinity adamspofford-dfinity commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

This PR adds a function to the sync plugin interface to fetch metadata sections from canisters. This is useful for type-checking canister calls by fetching candid:service. (Does this function need to be so specific instead of fetching state-tree content? Yes, because plugins should be usable from a canister host, and canisters cannot fetch the state tree, but rather get metadata sections by calling a management canister method only available to canisters.)

Stack created with GitHub Stacks CLIGive Feedback 💬

Copilot AI balanced review requested due to automatic review settings August 24, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds canister metadata-section reads to sync plugins, supporting direct and proxy-routed access.

Changes:

  • Extends the WIT interface and runtime host implementation.
  • Updates examples, schemas, and documentation.
  • Adds undeclared-target and integration coverage.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/icp-sync-plugin/README.md Documents metadata reads.
examples/icp-sync-plugin/plugin/src/lib.rs Demonstrates the new host function.
examples/icp-sync-plugin/icp.yaml Publishes example Candid metadata.
docs/schemas/icp-yaml-schema.json Updates plugin permissions description.
docs/schemas/canister-yaml-schema.json Updates plugin permissions description.
docs/reference/configuration.md Documents metadata access configuration.
docs/guides/writing-sync-plugins.md Adds authoring guidance and example.
docs/concepts/sync-plugins.md Defines routing and return semantics.
crates/icp/src/manifest/adapter/plugin.rs Updates manifest field documentation.
crates/icp-sync-plugin/tests/fixtures/test-plugin/src/lib.rs Adds an undeclared-target fixture.
crates/icp-sync-plugin/sync-plugin.wit Adds the metadata request and import.
crates/icp-sync-plugin/src/runtime.rs Implements direct and proxied metadata reads.
crates/icp-sync-plugin/DESIGN.md Records implementation rationale.
crates/icp-sync-plugin/Cargo.toml Adds management-canister types.
crates/icp-cli/tests/sync_tests.rs Tests absent metadata through both routes.
Cargo.lock Records the dependency update.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/icp-sync-plugin/sync-plugin.wit
Comment thread crates/icp-sync-plugin/src/runtime.rs Outdated
Comment thread crates/icp-sync-plugin/src/runtime.rs
@adamspofford-dfinity adamspofford-dfinity changed the title feat: Add get-metadata-section function feat: Add canister-metadata-section function Aug 24, 2026
@adamspofford-dfinity
adamspofford-dfinity marked this pull request as ready for review August 24, 2026 16:49
@adamspofford-dfinity
adamspofford-dfinity requested a review from a team as a code owner August 24, 2026 16:49
@adamspofford-dfinity
adamspofford-dfinity force-pushed the spofford/fetch-section branch 2 times, most recently from 17a1d28 to 0c74c79 Compare September 2, 2026 16:37
@raymondk
raymondk force-pushed the spofford/fetch-section branch from 0c74c79 to a472dc8 Compare September 3, 2026 17:17
@adamspofford-dfinity
adamspofford-dfinity force-pushed the spofford/fetch-section branch 2 times, most recently from 70fe9bd to e0c3f58 Compare September 3, 2026 21:18
/// separates the two. A canister with no module installed has no sections at
/// all, which the certificate reports as an absent path under a canister that
/// exists, and so as [`CertifiedSection::Absent`].
async fn certified_metadata_section(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this reuse icp::operations::misc::fetch_canister_metadata ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.... it would introduce a cycle....

Base automatically changed from spofford/named-files to main September 4, 2026 10:41
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.

3 participants