mirror of
https://github.com/github/awesome-copilot.git
synced 2026-07-14 01:51:02 +00:00
Fix kanban refresh error exposure (#2242)
Stop the accessibility kanban extension from persisting raw refresh failure details to browser-visible state. Use a generic safe error message for clients, clear any previously persisted detailed refresh errors during state normalization, and keep detailed diagnostics server-side via console logging. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,7 @@ const EXTENSION_NAME = "accessibility-kanban";
|
|||||||
const STATE_FILE_PREFIX = "repository-issues-kanban-state";
|
const STATE_FILE_PREFIX = "repository-issues-kanban-state";
|
||||||
const COLUMNS = ["backlog", "plan", "ready", "implement", "done"];
|
const COLUMNS = ["backlog", "plan", "ready", "implement", "done"];
|
||||||
const VALID_COLUMNS = new Set(COLUMNS);
|
const VALID_COLUMNS = new Set(COLUMNS);
|
||||||
|
const REFRESH_ISSUES_ERROR = "Unable to refresh issues right now. Please try again.";
|
||||||
|
|
||||||
let repoInfoCache = null;
|
let repoInfoCache = null;
|
||||||
let githubTokenCache;
|
let githubTokenCache;
|
||||||
@@ -197,7 +198,7 @@ function normalizeState(rawState, repoInfo = getRepoInfo()) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
repo,
|
repo,
|
||||||
error: repoInfo.error || rawState?.error || null,
|
error: repoInfo.error || (rawState?.error === REFRESH_ISSUES_ERROR ? REFRESH_ISSUES_ERROR : null),
|
||||||
updatedAt: rawState?.updatedAt || new Date().toISOString(),
|
updatedAt: rawState?.updatedAt || new Date().toISOString(),
|
||||||
generation: rawState?.generation || Date.now(),
|
generation: rawState?.generation || Date.now(),
|
||||||
columns: Array.isArray(rawState?.columns) && rawState.columns.length ? rawState.columns : COLUMNS,
|
columns: Array.isArray(rawState?.columns) && rawState.columns.length ? rawState.columns : COLUMNS,
|
||||||
@@ -453,9 +454,10 @@ async function refreshIssuesSafe() {
|
|||||||
broadcast("state", merged);
|
broadcast("state", merged);
|
||||||
return merged;
|
return merged;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error("[accessibility-kanban] Failed to refresh issues", error);
|
||||||
const failed = {
|
const failed = {
|
||||||
...state,
|
...state,
|
||||||
error: error instanceof Error ? error.message : String(error),
|
error: REFRESH_ISSUES_ERROR,
|
||||||
};
|
};
|
||||||
saveState(failed);
|
saveState(failed);
|
||||||
broadcast("state", failed);
|
broadcast("state", failed);
|
||||||
|
|||||||
Reference in New Issue
Block a user