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

chore(deploy-script-support): Sync code patterns across files #8712

Merged
merged 11 commits into from
Jan 10, 2024

Conversation

gibson042
Copy link
Member

Description

  • Rename parameters and variables for clarity
  • Improve JSDoc annotation
  • Fix package reference in comment
  • Clarify script completion value as pseudo-exports
  • Update assert(cond, X`...`) calls to cond || Fail`...`

best reviewed commit-by-commit

Security Considerations

This should be a pure refactor, and even preserves lack of a makeEnactCoreProposals binding in the script code generated by extractCoreProposalBundles.

Scaling Considerations

n/a

Documentation Considerations

n/a

Testing Considerations

No new tests should be required.

Upgrade Considerations

I don't think anything outside of agoric-sdk relies upon the parameter field names (which should be self-contained in generated script), but if so then we'll need to update or accommodate them.

@gibson042 gibson042 requested a review from michaelfig January 4, 2024 20:56
Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

Thanks for making this code clearer! My only comments are around the (granted, preexisting) use of IIFEs where assigning names may make the intent easier to understand.

I'll leave it to your discretion whether or how to address that.

Comment on lines 252 to 260
// Make an enactCoreProposals function and "export" it by way of script completion value.
((
makeCoreProposalBehavior = ${makeCoreProposalBehavior},
makeEnactCoreProposals = ${makeEnactCoreProposals},
) => makeEnactCoreProposals({ metadataRecords, E }))();
Copy link
Member

Choose a reason for hiding this comment

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

Wow! I found this really tricky to understand, but eventually puzzled through it... I take it the IFFE default arguments are used just to create local bindings?

I'm not sure that's as clear as creating them at the top level. Would you be able to write a very clear explanation of what these lines are trying to do?

If it's too hard to render in English, I'd prefer something like:

Suggested change
// Make an enactCoreProposals function and "export" it by way of script completion value.
((
makeCoreProposalBehavior = ${makeCoreProposalBehavior},
makeEnactCoreProposals = ${makeEnactCoreProposals},
) => makeEnactCoreProposals({ metadataRecords, E }))();
const makeCoreProposalBehavior = ${makeCoreProposalBehavior};
const makeEnactCoreProposals = ${makeEnactCoreProposals};
// Make an enactCoreProposals function and "export" it by way of script completion value.
const enactCoreProposals = makeEnactCoreProposals({ metadataRecords, E });
enactCoreProposals;

Comment on lines 155 to 160
// Make a behavior function and "export" it by way of script completion value.
const behavior = (${makeCoreProposalBehavior})({ manifestBundleRef, getManifestCall, customManifest, E });
behavior;
Copy link
Member

Choose a reason for hiding this comment

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

Consider this for clarity, as well:

Suggested change
// Make a behavior function and "export" it by way of script completion value.
const behavior = (${makeCoreProposalBehavior})({ manifestBundleRef, getManifestCall, customManifest, E });
behavior;
const makeCoreProposalBehavior = ${makeCoreProposalBehavior};
// Make a behavior function and "export" it by way of script completion value.
const behavior = makeCoreProposalBehavior({ manifestBundleRef, getManifestCall, customManifest, E });
behavior;

@gibson042 gibson042 force-pushed the gibson-2024-01-cleanup-coreproposalbehavior branch from aab6e09 to 1965715 Compare January 10, 2024 00:04
@gibson042 gibson042 added the automerge:rebase Automatically rebase updates, then merge label Jan 10, 2024
@gibson042 gibson042 force-pushed the gibson-2024-01-cleanup-coreproposalbehavior branch from 1965715 to 2992afa Compare January 10, 2024 00:38
@mergify mergify bot merged commit ba2f0d9 into master Jan 10, 2024
66 checks passed
@mergify mergify bot deleted the gibson-2024-01-cleanup-coreproposalbehavior branch January 10, 2024 01:10
mhofman pushed a commit that referenced this pull request Jan 13, 2024
…salbehavior

chore(deploy-script-support): Sync code patterns across files
mhofman pushed a commit that referenced this pull request Jan 15, 2024
…salbehavior

chore(deploy-script-support): Sync code patterns across files
mhofman pushed a commit that referenced this pull request Jan 15, 2024
…salbehavior

chore(deploy-script-support): Sync code patterns across files
mhofman pushed a commit that referenced this pull request Jan 15, 2024
…salbehavior

chore(deploy-script-support): Sync code patterns across files
mhofman pushed a commit that referenced this pull request Jan 19, 2024
…salbehavior

chore(deploy-script-support): Sync code patterns across files
mhofman pushed a commit that referenced this pull request Jan 19, 2024
…salbehavior

chore(deploy-script-support): Sync code patterns across files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants