Refactor timing calculation logic and introduce Gantt chart visualization #15

Closed
opened 2026-07-19 20:15:22 +02:00 by abiwab · 1 comment
abiwab commented 2026-07-19 20:15:22 +02:00 (Migrated from codeberg.org)

I've talked a lot in the documentation about visualizing recipes as Gantt charts, so I think it's time to actually build one and include it in the Playground for the v1 release!

I first need to refactor how the compiler handles timing calculations. The current logic needs to be a bit more robust to accurately track the exact start and end times for both active cooking steps and passive background tasks so they can be plotted on a timeline.

Objectives:

  • Refactor Timing Logic: Update the processor to track a cookCursor, explicitly calculating when each step starts and ends, and setting accurate offsets for background timers.
  • Implement Gantt Chart: Create a new GramGantt.vue component in the playground to display active tasks and passive timers on parallel tracks. This will make understanding a recipe's workflow much more visual and intuitive.
  • Enhance Visualization: Include tooltips for individual steps and add a "gap compression" feature. This way, long idle periods (like a 24-hour dough rest) won't stretch out and completely break the visual scale of the chart.
I've talked a lot in the documentation about visualizing recipes as Gantt charts, so I think it's time to actually build one and include it in the Playground for the v1 release! I first need to refactor how the compiler handles timing calculations. The current logic needs to be a bit more robust to accurately track the exact start and end times for both active cooking steps and passive background tasks so they can be plotted on a timeline. **Objectives:** - **Refactor Timing Logic:** Update the processor to track a cookCursor, explicitly calculating when each step starts and ends, and setting accurate offsets for background timers. - **Implement Gantt Chart:** Create a new GramGantt.vue component in the playground to display active tasks and passive timers on parallel tracks. This will make understanding a recipe's workflow much more visual and intuitive. - **Enhance Visualization:** Include tooltips for individual steps and add a "gap compression" feature. This way, long idle periods (like a 24-hour dough rest) won't stretch out and completely break the visual scale of the chart.
abiwab commented 2026-07-19 20:33:55 +02:00 (Migrated from codeberg.org)

The Gantt chart is already implemented, I worked on it this whole weekend (I just forgot to create an issue about it). However, seeing the timeline laid out visually made me realize that our current scheduling logic doesn't quite fit real-world cooking.

Right now, the system schedules everything "as soon as possible". If a step doesn't explicitly depend on something else, it gets pushed to the very beginning of the timeline. For example, if a batter needs to rest in the fridge for 24 hours, the oven preheating step gets scheduled 24 hours in advance. Obviously, that doesn't make sense in a kitchen!

This means the core logic needs a deeper rework to support "Just in Time" cooking. The goal would be to have these independent prep steps automatically align themselves right before they are actually needed (an "As Late As Possible" scheduling approach). I'm still not 100% convinced that's the right path forward though, I'm still exploring alternatives. My biggest concern is that it would complicate the syntax even further.

Either way, this is a much bigger structural change, so I'll be looking into the best way to handle it moving forward—either by updating the scheduling algorithm to calculate backwards, or by introducing explicit section-level dependencies.

The Gantt chart is already implemented, I worked on it this whole weekend (I just forgot to create an issue about it). However, seeing the timeline laid out visually made me realize that our current scheduling logic doesn't quite fit real-world cooking. Right now, the system schedules everything "as soon as possible". If a step doesn't explicitly depend on something else, it gets pushed to the very beginning of the timeline. For example, if a batter needs to rest in the fridge for 24 hours, the oven preheating step gets scheduled 24 hours in advance. Obviously, that doesn't make sense in a kitchen! This means the core logic needs a deeper rework to support "Just in Time" cooking. The goal would be to have these independent prep steps automatically align themselves right before they are actually needed (an "As Late As Possible" scheduling approach). I'm still not 100% convinced that's the right path forward though, I'm still exploring alternatives. My biggest concern is that it would complicate the syntax even further. Either way, this is a much bigger structural change, so I'll be looking into the best way to handle it moving forward—either by updating the scheduling algorithm to calculate backwards, or by introducing explicit section-level dependencies.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gram-lang/gram#15
No description provided.