Skip to content

fix: throw an error instead of ignoring it when uploading batches - #207

Open
gasperzgonec wants to merge 12 commits into
mainfrom
gasperz/ASCPT-28
Open

fix: throw an error instead of ignoring it when uploading batches#207
gasperzgonec wants to merge 12 commits into
mainfrom
gasperz/ASCPT-28

Conversation

@gasperzgonec

Copy link
Copy Markdown
Contributor

Description

Connected Issues

Checklist

  • Tests added/updated and ran with npm run test OR no tests needed.
  • Ran backwards compatibility tests with npm run test:backwards-compatibility.
  • Code formatted and checked with npm run lint.
  • Tested airdrop-template linked to this PR.
  • Documentation updated and provided a link to PR / new docs OR no docs needed.

@gasperzgonec
gasperzgonec requested review from a team and radovanjorgic as code owners June 4, 2026 08:16
Comment thread src/repo/repo.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts
Comment thread src/http/axios-client-internal.ts Outdated
@radovanjorgic radovanjorgic changed the title fix: Throw an error instead of ignoring it when uploading batches fix: throw an error instead of ignoring it when uploading batches Jun 11, 2026
Comment thread src/multithreading/spawn/spawn.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/repo/repo.ts
Comment thread src/tests/upload-failure/slow-env.setup.ts Outdated
Comment thread src/types/workers.ts Outdated
Comment thread src/types/workers.ts Outdated
@github-actions

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

Comment thread src/multithreading/spawn/spawn.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
Comment thread src/multithreading/worker-adapter/worker-adapter.ts Outdated
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

- Revert defensive logFn guard in spawn.ts (unrelated to this fix, logFn
  is always a function on the real Logger).
- Rename canEmit to prepared and document beforeEmit's return contract.
- Collapse sendToPlatform/afterEmit into a single emitToPlatform method,
  matching the beforeEmit/buildEmitPayload/afterEmit shape used in v2.
- Inline emitUploadFailure into beforeEmit's catch block since it had a
  single call site.
- Run eslint --fix to clean up pre-existing formatting violations.
@github-actions

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

Matches v2's adapter shape (beforeEmit/buildEmitPayload/afterEmit, no
separate sendToPlatform/emitToPlatform helper) per review feedback.
beforeEmit no longer swallows the repo-upload failure itself; emit()
catches it, collects partial artifacts, and picks the error event type
before sending, so there's a single call site for the actual platform
emit and its WorkerMessageEmitted/WorkerMessageExit outcome handling.
@github-actions

Copy link
Copy Markdown

⚠️ Heads-up: This repository will be blocked from any work other than patching.

File jest.config.cjs is not allowed to be modified in this patch.
The following vulnerability issues are past SLA:

Note that there is significant latency in updating this list. Please reach out on #antifragile if you are in a hurry or have an emergency.

@radovanjorgic
radovanjorgic marked this pull request as draft July 22, 2026 08:52
@gasperzgonec
gasperzgonec marked this pull request as ready for review August 10, 2026 12:32
console.log(
`Uploading all repos before emitting event with event type: ${newEventType}.`
);
// Uploading all repos can fail partway through. When it does, we still

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you re-check this with @GasperSenk. Is it true that we want to report artifacts with failure?

// we emit an error event for the current phase instead of the
// originally requested event type.
let eventTypeToEmit = newEventType;
let payload: EventData;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rename to eventPayload.

console.error('Error while posting state', error);
parentPort?.postMessage(WorkerMessageSubject.WorkerMessageExit);
this.hasWorkerEmitted = true;
const prepared = await this.beforeEmit(newEventType);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Prepared what? Let's try to have better naming here. Also what happens if "it is not prepared" and we just return here?

* flushing repos again, so artifacts uploaded before the failure are still
* reported without retrying the failed batch.
*/
async emitFailure(error: unknown): Promise<void> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe rename to emitError so we have it unified across the whole sdk. Also if I am not wrong this is used only in process-task, right? Can it be reused for all situations where we emit error? I imagine behaviour is the same.

Comment thread src/repo/repo.ts
return error;
throw new Error(
error?.message ??
`Upload failed for item type "${this.itemType}" without artifact.`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What does this message mean?

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.

2 participants