Skip to content

fix(project): robust project file loading (A5, C6)#27

Merged
dsent merged 4 commits into
aldum:devfrom
Vadim1987:Vadim1987/fix-project-load-errors
Jun 30, 2026
Merged

fix(project): robust project file loading (A5, C6)#27
dsent merged 4 commits into
aldum:devfrom
Vadim1987:Vadim1987/fix-project-load-errors

Conversation

@Vadim1987

Copy link
Copy Markdown

A5: codeload crashed on non-string input (readfile can yield nil content on read race / missing read / SD eject); guard and return an error instead of loadstring(nil). C6: ProjectService:run discarded the readfile success flag, so a missing main.lua compiled the error message as code; check the flag and return the real message.

Copilot AI left a comment

Copy link
Copy Markdown

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 hardens Lua project file loading to avoid crashes and misleading compilation errors when project source cannot be read (e.g., missing main.lua or transient read failures).

Changes:

  • Add a defensive guard in codeload to avoid calling loadstring with non-string input.
  • Fix ProjectService:run to respect readfile’s success flag and return the real read error instead of compiling the error message as code.

Reviewed changes

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

File Description
src/util/lua.lua Adds a type guard before loadstring to prevent crashes on nil/non-string code.
src/model/project/project.lua Checks readfile’s success flag in ProjectService:run to propagate missing/failed read errors correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/util/lua.lua
Comment thread src/model/project/project.lua
@dsent

dsent commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

The extra changes suggested by Copilot seem overdefensive and unnecessary to me. I think we should ignore them. If everyone agrees, I will reject-resolve.

@dsent

dsent commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

@aldum pls confirm

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread src/model/project/project.lua
@dsent
dsent merged commit ff42ebb into aldum:dev Jun 30, 2026
8 checks passed
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.

4 participants