Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(NO MERGE): doc comments -h/--help propagate + small partial derive refactor #444

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dj8yfo
Copy link
Collaborator

@dj8yfo dj8yfo commented Feb 3, 2025

this is not indended for merge, just a temporary location to test near-cli-rs/interactive-clap#26 from

@dj8yfo dj8yfo changed the title test: doc comments -h/--help propagate + small partial derive refactor test(NO MERGE): doc comments -h/--help propagate + small partial derive refactor Feb 3, 2025
@dj8yfo
Copy link
Collaborator Author

dj8yfo commented Feb 3, 2025

this branch has been identified to cause a bug with
printing the final command

# test_refactored_interactive_clap
#  interactive-clap-derive v0.3.1 (proc-macro)
# https://github.com/dj8yfo/interactive-clap.git?branch=propagate_doc_comments_on_flags#6bc76721
near account view-account-summary network-config now
# main
# interactive-clap-derive v0.3.1 (proc-macro)
near account view-account-summary momentous-war.testnet network-config testnet now

the cause of the bug was narrowed down to be due to propagating
the doc attributes to intermetiate CliVariant struct, which messes up ToCliArgs
trait derive (2-step derives when 1st derive generates a struct, annotated with 2nd-step trait derive macro, are somewhat tricky to figure out):

Adding 1 line with doc-comment to test near-cli-rs/interactive-clap@29c9aea ,

results in the following snapshot change https://github.com/near-cli-rs/interactive-clap/actions/runs/13120732036/job/36605779439 .
image

@dj8yfo
Copy link
Collaborator Author

dj8yfo commented Feb 3, 2025

doing near-cli-rs/interactive-clap@c66953e
resolves obvious problem with to_cli_args printing

# test_refactored_interactive_clap
#  interactive-clap-derive v0.3.1 (proc-macro)
# https://github.com/dj8yfo/interactive-clap.git?branch=propagate_doc_comments_on_flags#c66953e9
near account view-account-summary momentous-war.testnet network-config testnet now
near contract call-function as-read-only momentous-war.testnet get_greeting json-args {} network-config testnet now
near contract call-function as-transaction momentous-war.testnet set_greeting json-args '{ "greeting" : "another" }' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as momentous-war.testnet network-config testnet sign-with-keychain send
# main
# interactive-clap-derive v0.3.1 (proc-macro)
near account view-account-summary momentous-war.testnet network-config testnet now
near contract call-function as-read-only momentous-war.testnet get_greeting json-args {} network-config testnet now
near contract call-function as-transaction momentous-war.testnet set_greeting json-args '{ "greeting" : "refab" }' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as momentous-war.testnet network-config testnet sign-with-keychain send

@dj8yfo
Copy link
Collaborator Author

dj8yfo commented Feb 6, 2025

as the change has been relatively large, slightly more than minimal amount of testing was done to check if anything broke in near-cli. Behaviour was congruent between 2 versions:

# near main
near-main account create-account sponsor-by-faucet-service test-inter-clap-ref.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
near-main tokens id-ref-inter-clap.testnet send-near test-inter-clap-ref.testnet '1 NEAR' network-config testnet sign-with-keychain send
near-main account export-account test-inter-clap-ref.testnet using-private-key network-config testnet
near-main account view-account-summary test-inter-clap-ref.testnet network-config testnet now
near-main staking validator-list network-config testnet
near-main config edit-connection testnet --key coingecko_url --value https://urlmain
near-main config show-connections
near-main config add-connection --network-name shardnet --connection-name pagoda --rpc-url rpc://far --wallet-url https://wallet/ --explorer-transaction-url https://explorer/
near-main contract deploy id-ref-inter-clap.testnet use-file target/near/testy_contract.wasm without-init-call network-config testnet sign-with-keychain send
near-main contract view-storage id-ref-inter-clap.testnet all as-json network-config testnet now
# near patch
near account create-account sponsor-by-faucet-service id-ref-inter-clap.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
near tokens id-ref-inter-clap.testnet send-near test-inter-clap-ref.testnet '1 NEAR' network-config testnet sign-with-keychain send
near account export-account test-inter-clap-ref.testnet using-private-key network-config testnet
near account view-account-summary id-ref-inter-clap.testnet network-config testnet now
near staking validator-list network-config testnet
near config edit-connection testnet --key coingecko_url --value https://url
near config show-connections
near config add-connection --network-name shardnet --connection-name pagoda --rpc-url rpc://far --wallet-url https://wallet/ --explorer-transaction-url https://explorer/
near contract deploy test-inter-clap-ref.testnet use-file target/near/testy_contract.wasm without-init-call network-config testnet sign-with-keychain send
near contract view-storage test-inter-clap-ref.testnet all as-json network-config testnet now

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.

1 participant