Skip to content

feat: remove requirements in favor of auto-detection - #2508

Open
brady-stacks wants to merge 17 commits into
stx-labs:mainfrom
brady-stacks:feat/requirements-rework-1655
Open

brady-stacks wants to merge 17 commits into
stx-labs:mainfrom
brady-stacks:feat/requirements-rework-1655

Conversation

@brady-stacks

@brady-stacks brady-stacks commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Clarinet now automatically discovers external contract dependencies by scanning user contract ASTs before generating a deployment plan. Explicit [[project.requirements]] declarations are no longer required for statically-visible references.

@codecov

codecov Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

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

This PR updates Clarinet’s “external contract dependency” model by introducing [[project.address_map]] (with optional per-network overrides) and making dependency discovery automatic by scanning user contract ASTs before seeding the requirements queue. It keeps [[project.requirements]] as a legacy alias for backward compatibility while moving deployment-time identifier remapping into the on-chain broadcast path.

Changes:

  • Add address_map to the manifest schema/model, parse both requirements (legacy) and address_map into a unified list, and serialize only address_map.
  • Auto-detect external dependencies from user contract ASTs and seed the requirements queue accordingly; carry address_map through DeploymentSpecification and apply network-specific remaps during on-chain deployment.
  • Update CLI TOML editing and add/adjust tests (including new integration tests) for address_map + auto-detection behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
components/clarinet-files/src/schema.rs Adds JSON schema for address_map and updates legacy requirements schema description.
components/clarinet-files/src/project_manifest.rs Introduces AddressMapEntry, parses requirements + address_map into project.address_map, and adds unit tests for parsing/dedup.
components/clarinet-files/src/lib.rs Re-exports AddressMapEntry alongside existing manifest types.
components/clarinet-deployments/src/types.rs Adds address_map: Vec<AddressMapEntry> to DeploymentSpecification for on-chain remap usage.
components/clarinet-deployments/src/onchain/mod.rs Pre-populates broadcast-time contract-id remaps from deployment.address_map.
components/clarinet-deployments/src/lib.rs Reads user sources early, builds lightweight ASTs for dependency auto-detection, seeds requirements queue, and persists address_map onto the deployment spec.
components/clarinet-deployments/tests/address_map.rs New integration tests covering testnet override “skip redeploy” and auto-detected requirements.
components/clarinet-deployments/tests/genesis_accounts_funding.rs Updates test helper to populate new address_map field.
components/clarinet-deployments/tests/deployment_plan.rs Updates test helper to populate new address_map field.
components/clarinet-cli/tests/cli.rs Updates requirement-add test to assert via project.address_map.
components/clarinet-cli/src/frontend/cli.rs Writes new entries into [[project.address_map]] (and updates TOML edit tests to recognize both keys).

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

Comment thread components/clarinet-deployments/src/onchain/mod.rs Outdated
Comment thread components/clarinet-files/src/project_manifest.rs Outdated
@brady-stacks
brady-stacks force-pushed the feat/requirements-rework-1655 branch from 7c0a9bd to 92c47b4 Compare August 27, 2026 14:38
@brady-stacks
brady-stacks marked this pull request as draft August 27, 2026 15:37
@brady-stacks brady-stacks changed the title feat: replace requirements with auto-detecting address_map feat: remove requirements in favor of auto-detection Aug 27, 2026
@brady-stacks
brady-stacks marked this pull request as ready for review August 31, 2026 23:07
@brady-stacks
brady-stacks requested a lite review from Copilot August 31, 2026 23:08

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread components/clarinet-deployments/src/lib.rs Outdated
Comment thread components/clarinet-cli/src/frontend/cli.rs Outdated
@jbencin-stacks

Copy link
Copy Markdown
Contributor

Opened PR here with some issues and associated tests: brady-stacks#12

@brady-stacks
brady-stacks enabled auto-merge (squash) September 10, 2026 16:54
Comment thread components/clarinet-deployments/src/lib.rs Outdated
Comment thread components/clarinet-files/src/project_manifest.rs Outdated
@jbencin-stacks

Copy link
Copy Markdown
Contributor

Some more tests that should pass before merging: brady-stacks#13

@brady-stacks
brady-stacks force-pushed the feat/requirements-rework-1655 branch from 8641978 to e1845b3 Compare September 30, 2026 19:23
brady-stacks and others added 9 commits October 1, 2026 14:55
…tected list

- Include resolved dependencies from detect_dependencies() in auto_detected list
  (previously only unresolved deps were counted, missing sBTC preloaded deps)
- Filter out user contract IDs when seeding auto-detected queue
  (user contracts are already deployed, shouldn't be fetched from mock server)
- Remove needless ..Default::default() on RequirementConfig (single-field struct)
@brady-stacks
brady-stacks force-pushed the feat/requirements-rework-1655 branch from 973e326 to 7ed6c7c Compare October 1, 2026 22:42
@brady-stacks
brady-stacks force-pushed the feat/requirements-rework-1655 branch from 75473a1 to c040bfe Compare October 2, 2026 17:37

This branch has not been deployed

No deployments
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