Skip to content

Allow temporary IDs for all project operations#19573

Open
Copilot wants to merge 6 commits intomainfrom
copilot/add-temporary-ids-support
Open

Allow temporary IDs for all project operations#19573
Copilot wants to merge 6 commits intomainfrom
copilot/add-temporary-ids-support

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

  • Fix TypeScript typecheck error in create_project.cjs (normalizeTemporaryId(temporaryId ?? ""))
  • Verify all create_project_status_update tests pass (16/16)
  • Verify formatting survives make fmt-cjs
  • Build passes

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits March 4, 2026 09:33
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
@mnkiefer
Copy link
Contributor

mnkiefer commented Mar 4, 2026

@copilot fix js tests

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot fix js tests

Fixed in 8cb353f. The TypeScript strict null check was failing because normalizeTemporaryId expects string but the JSDoc cast /** @type {string} */ (without parentheses) doesn't survive prettier's TypeScript parser — it gets stripped, leaving the type as string | null. Changed line 463 to normalizeTemporaryId(temporaryId ?? "") which satisfies TypeScript and is formatter-stable. The ?? "" fallback never triggers at runtime since the early return at line 350–356 already handles the null case.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.13.1/x64/bin/node /opt/hostedtoolcache/node/24.13.1/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js m k/gh-aw/node_mod-- git push�� -u origin k/gh-aw/gh-aw/actions/node_modules/.bin/git it git _modules/.bin/git git (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@mnkiefer mnkiefer marked this pull request as ready for review March 5, 2026 06:48
Copilot AI review requested due to automatic review settings March 5, 2026 06:48
Copy link
Contributor

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

Adds support for referencing newly-created GitHub Projects via temporary IDs (e.g. aw_... / #aw_...) so subsequent project operations can resolve the real project URL.

Changes:

  • Store a temporary-id → project URL mapping when create_project succeeds.
  • Resolve temporary project IDs from the shared temporaryIdMap in create_project_status_update.
  • Add unit tests covering temporary project ID resolution and not-found behavior for status updates.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
actions/setup/js/create_project_status_update.test.cjs Adds tests validating temporary project ID resolution (with and without #) and failure behavior.
actions/setup/js/create_project_status_update.cjs Resolves output.project when it’s a temporary ID by looking up projectUrl in the shared temp-id map.
actions/setup/js/create_project.cjs Stores the created project URL in the shared temp-id map and returns temporaryId in the result.

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

Comment on lines +343 to +349
// Resolve temporary project ID if present
const projectStr = effectiveProjectUrl.trim();
const projectWithoutHash = projectStr.startsWith("#") ? projectStr.substring(1) : projectStr;
if (isTemporaryId(projectWithoutHash)) {
const normalizedId = normalizeTemporaryId(projectWithoutHash);
const resolved = temporaryIdMap.get(normalizedId);
if (resolved && typeof resolved === "object" && "projectUrl" in resolved && resolved.projectUrl) {
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

handleCreateProjectStatusUpdate’s parameter order doesn’t match how handlers are invoked by safe_output_handler_manager (it calls handlers as (message, resolvedTemporaryIds, temporaryIdMap)). With the current signature (message, temporaryIdMap, resolvedTemporaryIds), temporaryIdMap will be a plain object in production and temporaryIdMap.get(...) will throw. Update the handler to accept (message, resolvedTemporaryIds = {}, temporaryIdMap = null) (or normalize args), and build a Map via temporaryIdMap instanceof Map ? temporaryIdMap : loadTemporaryIdMapFromResolved(resolvedTemporaryIds) before doing lookups.

Copilot uses AI. Check for mistakes.

// Store temporary ID mapping so subsequent operations can reference this project
const normalizedTempId = normalizeTemporaryId(temporaryId ?? "");
temporaryIdMap.set(normalizedTempId, { projectUrl: projectInfo.projectUrl });
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

This new temporaryIdMap.set(...) assumes the second handler argument is a Map, but safe_output_handler_manager invokes handlers as (message, resolvedTemporaryIds, temporaryIdMap). That means temporaryIdMap will be a plain object at runtime and this will throw. Adjust handleCreateProject to accept the shared Map as the third parameter (and/or normalize args like other handlers), then write to that Map.

Suggested change
temporaryIdMap.set(normalizedTempId, { projectUrl: projectInfo.projectUrl });
if (temporaryIdMap instanceof Map) {
temporaryIdMap.set(normalizedTempId, { projectUrl: projectInfo.projectUrl });
} else if (temporaryIdMap && typeof temporaryIdMap === "object") {
// Fallback for plain-object maps
temporaryIdMap[normalizedTempId] = { projectUrl: projectInfo.projectUrl };
}

Copilot uses AI. Check for mistakes.
Comment on lines +630 to +644
const handler = await main({ max: 10 });

const temporaryIdMap = new Map();
temporaryIdMap.set("aw_abc12345", { projectUrl: "https://github.com/orgs/test-org/projects/42" });

const result = await handler(
{
project: "aw_abc12345",
body: "Test status update",
status: "ON_TRACK",
start_date: "2025-01-01",
target_date: "2025-12-31",
},
temporaryIdMap
);
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

These tests invoke the handler as handler(message, temporaryIdMap), but the handler manager calls handlers as (message, resolvedTemporaryIds, temporaryIdMap). After aligning the handler signature with the manager, update these tests to pass the temporaryIdMap in the same position (e.g. handler(message, {}, temporaryIdMap)) so they exercise the production calling convention.

Copilot uses AI. Check for mistakes.
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.

3 participants