Skip to content

Agents and workflow upgrades#7

Merged
NoEgAm merged 4 commits into
mainfrom
agents
Dec 16, 2025
Merged

Agents and workflow upgrades#7
NoEgAm merged 4 commits into
mainfrom
agents

Conversation

@tiye
Copy link
Copy Markdown
Member

@tiye tiye commented Dec 15, 2025

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

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 refactors the application to use immutable data structures and upgrades dependencies. The key change is converting the Store from a mutable to an immutable design pattern, where updates return new Store instances instead of mutating in place.

Key changes:

  • Store refactored to be immutable with the update method returning a new Store instance
  • Removed unused Noop action variant and tasks field from Store
  • Simplified state update syntax using record update syntax { ..self, field: value }

Reviewed changes

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

Show a summary per file
File Description
src/main/store.mbt Converts Store to immutable design, removes mut keywords, changes update to return Store, removes Noop action, adds Eq derive
src/main/main.mbt Updates Store mutation to use assignment pattern app.store.val = app.store.val.update(op), removes direct state access call
src/main/counter.mbt Simplifies state updates using record update syntax, removes intermediate variables
moon.mod.json Upgrades dependencies: respo 0.1.2→0.2.2, dom-ffi 0.2.1→0.2.3, respo_css 0.1.3→0.1.4
llms/Agents.md Documents immutable data patterns, explains record update syntax, adds StateRef documentation
.github/workflows/check.yml Modernizes CI setup by using dedicated Moonbit setup action and upgrading Node.js 22→24

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

Comment thread src/main/store.mbt
_ => ()
Increment => { ..self, counted: self.counted + 1 }
StatesChange(states) => { ..self, states: self.states.set_in(states) }
Decrement => { ..self, counted: self.counted - 1 }
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The IncTwice action is not explicitly handled in the update method and falls through to the wildcard case, which returns the store unchanged. However, based on the component code in counter.mbt, IncTwice updates the local state by adding 2 to the counter, but should also update the global store's counted field by incrementing it twice. Consider adding an explicit case: IncTwice => { ..self, counted: self.counted + 2 }

Suggested change
Decrement => { ..self, counted: self.counted - 1 }
Decrement => { ..self, counted: self.counted - 1 }
IncTwice => { ..self, counted: self.counted + 2 }

Copilot uses AI. Check for mistakes.
Comment thread llms/Agents.md
items : @immut/array.T[Item] // Use immutable collections
states : @respo.RespoStatesTree
} derive(ToJson, FromJson)
}
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The Store struct example in the documentation is missing the derive clause. Based on the actual code in src/main/store.mbt, it should be: } derive(ToJson, @json.FromJson, Eq) to be consistent with the working implementation.

Suggested change
}
} derive(ToJson, @json.FromJson, Eq)

Copilot uses AI. Check for mistakes.
Comment thread src/main/counter.mbt
}
let on_dec = fn(
e : RespoEvent,
e,
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

The explicit type annotation for the e parameter was removed, relying on type inference. While this works due to MoonBit's type inference, it's inconsistent with the other event handlers (on_inc at line 24 and on_inc_twice at line 43) which explicitly annotate the parameter as e : RespoEvent. Consider maintaining consistency by keeping the explicit type annotation.

Suggested change
e,
e : RespoEvent,

Copilot uses AI. Check for mistakes.
@NoEgAm NoEgAm merged commit f0e77f6 into main Dec 16, 2025
1 check passed
@NoEgAm NoEgAm deleted the agents branch December 16, 2025 13:21
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.

3 participants