Skip to content

Conversation

@somebody1234
Copy link
Contributor

@somebody1234 somebody1234 commented Oct 28, 2025

Pull Request Description

  • This is preliminary refactoring in preparation for a few features:
    • Headless mode (run a hybrid project without needing the GUI)
      • Currently, the intention is for this behavior should be triggered by a flag passed to the single executable (the Electron desktop client)
        • This is not set in stone though, anyone with opinions otherwise is free to suggest better ways
    • Hybrid project sync (periodically uploading hybrid projects)
  • It involves moving LocalBackend, RemoteBackend, and all dependencies to enso-common.
  • This PR should not introduce any new functionality - any new functionality observed is likely a mistake and should be split out of this PR.

Important Notes

None

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@somebody1234 somebody1234 added the CI: No changelog needed Do not require a changelog entry for this PR. label Oct 28, 2025
@somebody1234 somebody1234 added the g-electron GUI: electron application specific label Oct 28, 2025
@@ -1,11 +1,11 @@
import { Rfc3339DateTime } from 'enso-common/src/utilities/data/dateTime'
import { describe, expect, it, test } from 'vitest'
import { Rfc3339DateTime } from '../../utilities/data/dateTime.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we start needing .js in imports?

Copy link
Contributor

Choose a reason for hiding this comment

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

More importantly, why do we have .js files instead of .ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did we start needing .js in imports?

we don't, but it is (was?) good practice, since allowing .js to be ommitted is actually a feature specific to node.js (and node.js compatible runtimes)

More importantly, why do we have .js files instead of .ts

this is a quirk of typescript - it typically accepts .js as extensions, not .ts, as it does not rewrite import URLs (or at least did not until recently) - and the compiled output is typically expected to have .js extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(let me know if i should remove the .js extensions anyway since most/all bundlers don't require the extension)

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer without extensions

electron.app.quit()
})
interface App {
window: import('electron').BrowserWindow | null
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we use such way of importing here? Cannot we just put normal type import?

Also I don't qute get what was wrong with App being a class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what was wrong with App being a class

technically nothing, but i do think it makes more difficult to split functions more finely into separate files for maintainability

Comment on lines +3 to +9
export interface DownloadUrlOptions {
readonly url: string
readonly path?: Path | null | undefined
readonly name?: string | null | undefined
readonly shouldUnpackProject?: boolean
readonly showFileDialog?: boolean
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be placed elsewhere. "Utilities" is too general, I don't see where I should use this structure (it mentions both FileDialog and project unpacking)

Comment on lines +11 to +16
/** Options for `download` function. */
export interface DownloadOptions {
readonly url: string
readonly name?: string | null | undefined
readonly electronOptions?: Omit<DownloadUrlOptions, 'name' | 'url'>
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If these are options for "download" function, it should be defined next to that function IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, but unfortunately right now the download function is browser-only :/ any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, one is used in electron IPC, another in special download callback in Backends...

I think I would put this file just in src, like options.ts or text.ts

@vitvakatu
Copy link
Contributor

vitvakatu commented Oct 29, 2025

I don’t understand changes in electron-client module. I assume it is for Headless mode? What is headless mode, exactly, and why do we need electron-client for that? Where can I read the description of this feature?

UPDATE: Please also extend the PR description to include all changes made. It talks about moving stuff around to common, but it seemingly does a lot more than that.

@somebody1234
Copy link
Contributor Author

okay, makes sense. initial comments:

  • electron-client changes are indeed unrelated to the PR title, yes - this is meant to be just moving RemoteBackend and LocalBackend to common, and just happened to be on the branch where I was implementing 'headless' functionality
    • so i think it makes sense to revert all changes to electron-client here, and add them in a separate PR
    • comments will be noted and (attempted to be?) addressed in the follow-up PR that will actually add 'headless' mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-gui CI: No changelog needed Do not require a changelog entry for this PR. g-dashboard g-electron GUI: electron application specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants