Skip to content

Fix: Sort task JSON files numerically instead of lexicographically#122

Open
chablino wants to merge 3 commits intoshareAI-lab:mainfrom
chablino:fix-S07
Open

Fix: Sort task JSON files numerically instead of lexicographically#122
chablino wants to merge 3 commits intoshareAI-lab:mainfrom
chablino:fix-S07

Conversation

@chablino
Copy link

Description:
Currently, the list_all method in s07_task_system.py relies on the default string sorting behavior when reading task_*.json files. This causes a lexicographical sorting issue where files are listed out of logical order (e.g., task_10.json appears before task_2.json).

Changes:

  • Modified the sorted() function by adding a custom key.
  • Used a lambda function to extract the numeric ID from the filename (f.stem.split("_")[-1]) and converted it to an integer.
  • This ensures that the task list is always displayed in the correct chronological/numerical sequence.

Copilot AI review requested due to automatic review settings March 23, 2026 13:15
@vercel
Copy link

vercel bot commented Mar 23, 2026

@chablino is attempting to deploy a commit to the crazyboym's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

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

Fixes task listing order in the s07 task system by sorting task_*.json files by numeric id rather than lexicographic filename order, so task_2.json correctly appears before task_10.json.

Changes:

  • Adds a custom key to the sorted() call in TaskManager.list_all() to sort by the numeric suffix in the filename.
  • Refactors the loop to sort into a files list first, then iterate.

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

chablino and others added 2 commits March 23, 2026 21:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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