This ticket reports and resolves a bug introduced during the refactoring of ReleaseSyncer.mjs where ReleaseSyncer.releases was changed from an array to an object.
Problem:
After ReleaseSyncer.releases was refactored from an array to an object, the IssueSyncer.#getIssuePath method, which relies on ReleaseSyncer.releases.find(), started failing with the error: ReleaseSyncer.releases.find is not a function. This prevented the sync_all tool from correctly processing and archiving closed issues.
Root Cause:
The IssueSyncer.#getIssuePath method was attempting to use the find() array method directly on ReleaseSyncer.releases, which is no longer an array but an object.
Solution:
The IssueSyncer.#getIssuePath method has been updated to correctly access the values of the ReleaseSyncer.releases object before attempting to use the find() method.
Changes Implemented:
The following line in ai/mcp/server/github-workflow/services/sync/IssueSyncer.mjs was changed:
const release = ReleaseSyncer.releases.find(r => new Date(r.publishedAt) > closed);
const release = Object.values(ReleaseSyncer.releases).find(r => new Date(r.publishedAt) > closed);
This ensures that the find() method is called on an array of release objects, resolving the error.
This ticket reports and resolves a bug introduced during the refactoring of
ReleaseSyncer.mjswhereReleaseSyncer.releaseswas changed from an array to an object.Problem: After
ReleaseSyncer.releaseswas refactored from an array to an object, theIssueSyncer.#getIssuePathmethod, which relies onReleaseSyncer.releases.find(), started failing with the error:ReleaseSyncer.releases.find is not a function. This prevented thesync_alltool from correctly processing and archiving closed issues.Root Cause: The
IssueSyncer.#getIssuePathmethod was attempting to use thefind()array method directly onReleaseSyncer.releases, which is no longer an array but an object.Solution: The
IssueSyncer.#getIssuePathmethod has been updated to correctly access the values of theReleaseSyncer.releasesobject before attempting to use thefind()method.Changes Implemented: The following line in
ai/mcp/server/github-workflow/services/sync/IssueSyncer.mjswas changed:// Old: const release = ReleaseSyncer.releases.find(r => new Date(r.publishedAt) > closed); // New: const release = Object.values(ReleaseSyncer.releases).find(r => new Date(r.publishedAt) > closed);This ensures that the
find()method is called on an array of release objects, resolving the error.