Skip to content

Commit 20a5c6a

Browse files
authored
Merge pull request #3469 from demergent-labs/codex-check-length-of-initmethodcandidstring
check the length of `initAndPostUpgradeMethodCandidString` parameter
2 parents 9ce203c + eac86d2 commit 20a5c6a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Before merging a PR created by the GitHub Copilot coding agent, you will need to
137137
One simple way to do this is the following:
138138

139139
1. Check out the coding agent's feature branch on your local machine
140-
2. Run this command from the root of the repository: `git reset --soft $(git merge-base --fork-point main HEAD)`
140+
2. Run this command from the root of the repository: `git reset --soft $(git merge-base main HEAD)`
141141
3. Commit and force push the changes
142142

143143
The three steps above will essentially allow you to collapse all of the coding agent's commits into one commit on your machine, signed by you and verifiable by GitHub. You will need to force push to the coding agent's branch to remove all of its unverified commits.

src/stable/lib/did_file/visitor/visit/service.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,16 @@ function getQueryAndUpdateMethods(
9898
);
9999
}
100100

101-
function createCanisterParamsString(initMethodCandidString: string[]): string {
102-
const parts = initMethodCandidString[0].split('->');
101+
function createCanisterParamsString(
102+
initAndPostUpgradeMethodCandidString: string[]
103+
): string {
104+
if (initAndPostUpgradeMethodCandidString.length !== 1) {
105+
throw new Error(
106+
'Expected exactly one init or post upgrade candid string'
107+
);
108+
}
109+
110+
const parts = initAndPostUpgradeMethodCandidString[0].split('->');
103111
if (parts.length >= 2) {
104112
return parts.slice(0, -1).join('->').trim();
105113
}

0 commit comments

Comments
 (0)