Skip to content

fix: protect task data and validate CLI inputs - #1

Merged
xSergioBG merged 2 commits into
mainfrom
codex/github-maintenance-2026-10-03
Oct 3, 2026
Merged

xSergioBG merged 2 commits into
mainfrom
codex/github-maintenance-2026-10-03

Conversation

@xSergioBG

Copy link
Copy Markdown
Owner

Corrige los errores silenciosos de lectura/escritura, valida IDs completos y conserva el archivo si su JSON está dañado. Añade seis pruebas de regresión con datos temporales y CI en Windows/Linux con Node.js 22 y 24.

Retira node_modules y el archivo inicial tasks.json vacío del árbol actual; siguen disponibles en el historial. Documenta uso, límites de concurrencia y TASKS_FILE.

Validación local: 6/6 pruebas correctas con Node.js 24.14.0. La ejecución de GitHub Actions debe comprobarse antes de integrar.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa98ceeba7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread task.js
let data;
try { data = fs.readFileSync(tasksFilePath, "utf8"); }
catch (error) { if (error.code === "ENOENT") return []; throw error; }
const tasks = data.trim() ? JSON.parse(data) : [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject empty files instead of treating them as no tasks

When an existing tasks.json is empty or contains only whitespace, this branch treats it as a valid empty task list, so the next mutating command succeeds and overwrites the damaged file. Since application-created empty stores are serialized as [], a blank file indicates invalid JSON and should be rejected and preserved just like other malformed content.

Useful? React with 👍 / 👎.

Comment thread task.js
Comment on lines +12 to +14
if (!Array.isArray(tasks) || tasks.some(t => !t || !Number.isSafeInteger(t.id) ||
t.id < 1 || typeof t.description !== "string" || !statuses.has(t.status)) ||
new Set(tasks.map(t => t.id)).size !== tasks.length) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate the required task timestamps

When a persisted row omits createdAt or updatedAt (or stores a non-string value), this predicate accepts the invalid record; list then prints undefined, and later additions preserve the malformed row rather than stopping for recovery. Both required timestamp fields should be validated before returning the task list.

Useful? React with 👍 / 👎.

@xSergioBG
xSergioBG merged commit 505b0cc into main Oct 3, 2026
5 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.

1 participant