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

refactor(daemon): Factor out internal facets #2208

Merged
merged 5 commits into from
Apr 11, 2024

Conversation

kriskowal
Copy link
Member

This is a simplifying refactor that reduces {internal, external} controller facets to just the (external) value. In preparation, removes the last vestiges of internal facets on worker and agent. Then mops up by collapsing the controller logic and structures.

@kriskowal kriskowal requested a review from rekmarks April 11, 2024 15:15
@kriskowal kriskowal force-pushed the kriskowal-daemon-factor-out-internal-facets branch from 2c066d1 to 53a048a Compare April 11, 2024 15:18
Copy link
Contributor

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM. Some optional suggestions.

@@ -384,7 +384,7 @@ export const makeHostMaker = ({
* @param {import('./types.js').MakeHostOrGuestOptions} [opts]
* @returns {Promise<{id: string, value: Promise<import('./types.js').EndoHost>}>}
*/
const makeHost = async (
const makeChildHost = async (
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@@ -1011,7 +1011,7 @@ test('name and reuse inspector', async t => {
});

// Regression test for https://github.com/endojs/endo/issues/2021
test.failing('eval-mediated worker name', async t => {
test('eval-mediated worker name', async t => {
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

formula,
context,
) => {
const evaluateFormula = async (id, formulaNumber, formula, context) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider: makeFormula()

@@ -746,23 +687,25 @@ const makeDaemonCore = async (
* @param {string} id
* @param {import('./types.js').Context} context
*/
const makeControllerForId = async (id, context) => {
const evaluateFormulaForId = async (id, context) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider: makeFormulaForId() or something along those lines. I'm not sold on the FormulaForId suffix, which doesn't seem to illuminate what distinguishes this function from evaluateFormula / makeFormula, since both take the id as an argument.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good points all around.

The first name I considered was makeFormulaForId (just removing the Controller) and I hesitated because it makes a value and does not make a formula. It uses the formula to make a value, which struck me as indistinguishable from evaluating a node in any other abstract syntax, which led me to evaluateFormula.

The distinction between evaluateFormula vs evaluateFormulaForId is going to haunt me. The latter presumes that it can find the formula for the identifier, and the former requires that to be spelled out, and all roads flow to evaluateFormula.

I’m going to merge for now and continue to think and discuss this with you.

@kriskowal kriskowal merged commit 94b8ac3 into master Apr 11, 2024
18 checks passed
@kriskowal kriskowal deleted the kriskowal-daemon-factor-out-internal-facets branch April 11, 2024 21:18
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