From 3384ce7b1b368e1afd441bfa146b1c6b69452b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Parada?= Date: Thu, 28 May 2026 22:38:01 -0400 Subject: [PATCH 1/3] refactor: remove profiler4fun --- action.yaml | 20 ++- dist/main/index.js | 114 +++++++++------ dist/post/index.js | 338 ++++++++++++++++++++++++++++++++------------- src/action.js | 3 +- src/main.js | 18 --- src/post.js | 31 +---- 6 files changed, 325 insertions(+), 199 deletions(-) diff --git a/action.yaml b/action.yaml index 514b951..0d481fb 100644 --- a/action.yaml +++ b/action.yaml @@ -1,11 +1,11 @@ -name: 'Garnet Runtime Visibility' -description: 'Runtime profiling and behavioral assertions for GitHub Actions' +name: "Garnet Runtime Visibility" +description: "Runtime profiling and behavioral assertions for GitHub Actions" branding: - icon: 'activity' - color: 'purple' + icon: "activity" + color: "purple" inputs: api_token: - description: 'Your Garnet API token from app.garnet.ai' + description: "Your Garnet API token from app.garnet.ai" required: true github_token: description: "GitHub token used for pull request comments" @@ -23,21 +23,17 @@ inputs: description: "Jibril version (v2.10.8, v0.0, or 'latest')" required: false default: "" - profiler_4fun: - description: "Enable profiler 4 fun mode" - required: false - default: "false" debug: description: "Enable debug mode" required: false default: "false" outputs: profile_result: - description: 'Assertion result for this run: pass or fail' + description: "Assertion result for this run: pass or fail" report_url: - description: 'Link to the full run report on app.garnet.ai' + description: "Link to the full run report on app.garnet.ai" agent_id: - description: 'Identifier for the Jibril sensor instance that ran' + description: "Identifier for the Jibril sensor instance that ran" runs: using: "node24" main: "dist/main/index.js" diff --git a/dist/main/index.js b/dist/main/index.js index 3f4bbd6..9fad87f 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -4377,7 +4377,6 @@ function defaultFactory (origin, opts) { class Agent extends DispatcherBase { constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) { - if (typeof factory !== 'function') { throw new InvalidArgumentError('factory must be a function.') } @@ -4985,29 +4984,71 @@ class Parser { const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr - if (ret === constants.ERROR.PAUSED_UPGRADE) { - this.onUpgrade(data.slice(offset)) - } else if (ret === constants.ERROR.PAUSED) { - this.paused = true - socket.unshift(data.slice(offset)) - } else if (ret !== constants.ERROR.OK) { - const ptr = llhttp.llhttp_get_error_reason(this.ptr) - let message = '' - /* istanbul ignore else: difficult to make a test case for */ - if (ptr) { - const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) - message = - 'Response does not match the HTTP/1.1 protocol (' + - Buffer.from(llhttp.memory.buffer, ptr, len).toString() + - ')' - } - throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)) + if (ret !== constants.ERROR.OK) { + const body = data.subarray(offset) + + if (ret === constants.ERROR.PAUSED_UPGRADE) { + this.onUpgrade(body) + } else if (ret === constants.ERROR.PAUSED) { + this.paused = true + socket.unshift(body) + } else { + throw this.createError(ret, body) + } } } catch (err) { util.destroy(socket, err) } } + finish () { + assert(currentParser === null) + assert(this.ptr != null) + assert(!this.paused) + + const { llhttp } = this + + let ret + + try { + currentParser = this + ret = llhttp.llhttp_finish(this.ptr) + } finally { + currentParser = null + } + + if (ret === constants.ERROR.OK) { + return null + } + + if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) { + this.paused = true + return null + } + + return this.createError(ret, EMPTY_BUF) + } + + createError (ret, data) { + const { llhttp, contentLength, bytesRead } = this + + if (contentLength && bytesRead !== parseInt(contentLength, 10)) { + return new ResponseContentLengthMismatchError() + } + + const ptr = llhttp.llhttp_get_error_reason(this.ptr) + let message = '' + if (ptr) { + const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) + message = + 'Response does not match the HTTP/1.1 protocol (' + + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + + ')' + } + + return new HTTPParserError(message, constants.ERROR[ret], data) + } + destroy () { assert(this.ptr != null) assert(currentParser == null) @@ -5379,8 +5420,11 @@ async function connectH1 (client, socket) { // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded // to the user. if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so for as a valid response. - parser.onMessageComplete() + const parserErr = parser.finish() + if (parserErr) { + this[kError] = parserErr + this[kClient][kOnError](parserErr) + } return } @@ -5399,8 +5443,10 @@ async function connectH1 (client, socket) { const parser = this[kParser] if (parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so far as a valid response. - parser.onMessageComplete() + const parserErr = parser.finish() + if (parserErr) { + util.destroy(this, parserErr) + } return } @@ -5412,8 +5458,7 @@ async function connectH1 (client, socket) { if (parser) { if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so far as a valid response. - parser.onMessageComplete() + this[kError] = parser.finish() || this[kError] } this[kParser].destroy() @@ -31519,9 +31564,8 @@ AI_TEMPERATURE=${getEnv("AI_TEMPERATURE", "0.3")} # Runner information RUNNER_ARCH=${getEnv("RUNNER_ARCH")} RUNNER_OS=${getEnv("RUNNER_OS")} -# Jibril writes profile markdown to these files (one per printer) +# Jibril writes profile outputs to these files JIBRIL_PROFILER_FILE=${getEnv("JIBRIL_PROFILER_FILE")} -JIBRIL_PROFILER4FUN_FILE=${getEnv("JIBRIL_PROFILER4FUN_FILE")} JIBRIL_JSONPROFILER_FILE=${getEnv("JIBRIL_JSONPROFILER_FILE")} # GitHub context GITHUB_ACTION=${getEnv("GITHUB_ACTION", "__run")} @@ -31981,16 +32025,6 @@ async function main() { } try { - // Save whether profiler4fun mode is enabled as a boolean. - const profiler4fun = getInput("profiler_4fun") === "true" - - // Store as string for state passing to post.js. - saveState("profiler4fun", profiler4fun ? "true" : "") - saveState( - "selectedProfiler", - profiler4fun ? "profiler4fun" : "profiler", - ) - // Save debug state for later retrieval. const debug = getInput("debug") === "true" saveState("debug", debug ? "true" : "") @@ -32013,20 +32047,12 @@ async function main() { // Set the default profiler printer file paths. const profilerFile = process.env.JIBRIL_PROFILER_FILE || "/var/log/jibril.profiler.out" - const profiler4funFile = - process.env.JIBRIL_PROFILER4FUN_FILE || "/var/log/jibril.profiler4fun.out" const jsonProfilerFile = process.env.JIBRIL_JSONPROFILER_FILE || "/var/log/jibril.profile.json" process.env.JIBRIL_PROFILER_FILE = profilerFile - process.env.JIBRIL_PROFILER4FUN_FILE = profiler4funFile process.env.JIBRIL_JSONPROFILER_FILE = jsonProfilerFile saveState("profilerFile", profilerFile) - saveState("profiler4funFile", profiler4funFile) saveState("jsonProfilerFile", jsonProfilerFile) - saveState( - "selectedProfilerFile", - profiler4fun ? profiler4funFile : profilerFile, - ) await run() } catch (err) { diff --git a/dist/post/index.js b/dist/post/index.js index e49dc24..a80a8e8 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -16512,7 +16512,7 @@ function expand(str, max, isTop) { N = []; - for (var i = x; test(i, y); i += incr) { + for (var i = x; test(i, y) && N.length < max; i += incr) { var c; if (isAlphaSequence) { c = String.fromCharCode(i); @@ -36576,12 +36576,11 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const { EventEmitter } = __nccwpck_require__(9580) -const STREAM_DESTROYED = new Error('Stream was destroyed') -const PREMATURE_CLOSE = new Error('Premature close') - const FIFO = __nccwpck_require__(3867) const TextDecoder = __nccwpck_require__(7934) +const StreamError = __nccwpck_require__(5657) + // if we do a future major, expect queue microtask to be there always, for now a bit defensive const qmt = typeof queueMicrotask === 'undefined' ? (fn) => global.process.nextTick(fn) : queueMicrotask @@ -36746,8 +36745,12 @@ class WritableState { } end(data) { - if (typeof data === 'function') this.stream.once('finish', data) - else if (data !== undefined && data !== null) this.push(data) + if (typeof data === 'function') { + this.stream.once('finish', data) + } else if (data !== undefined && data !== null) { + this.push(data) + } + this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY } @@ -36812,8 +36815,11 @@ class WritableState { } updateCallback() { - if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) this.update() - else this.updateNextTick() + if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) { + this.update() + } else { + this.updateNextTick() + } } updateNextTick() { @@ -36906,7 +36912,10 @@ class ReadableState { const data = this.queue.shift() this.buffered -= this.byteLength(data) - if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED + if (this.buffered === 0) { + this.stream._duplexState &= READ_NOT_QUEUED + } + return data } @@ -36928,9 +36937,15 @@ class ReadableState { if ((stream._duplexState & READ_STATUS) === READ_QUEUED) { const data = this.shift() - if (this.pipeTo !== null && this.pipeTo.write(data) === false) + + if (this.pipeTo !== null && this.pipeTo.write(data) === false) { stream._duplexState &= READ_PIPE_NOT_DRAINED - if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit('data', data) + } + + if ((stream._duplexState & READ_EMIT_DATA) !== 0) { + stream.emit('data', data) + } + return data } @@ -36950,9 +36965,14 @@ class ReadableState { (stream._duplexState & READ_FLOWING) !== 0 ) { const data = this.shift() - if (this.pipeTo !== null && this.pipeTo.write(data) === false) + + if (this.pipeTo !== null && this.pipeTo.write(data) === false) { stream._duplexState &= READ_PIPE_NOT_DRAINED - if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit('data', data) + } + + if ((stream._duplexState & READ_EMIT_DATA) !== 0) { + stream.emit('data', data) + } } } @@ -36978,7 +36998,9 @@ class ReadableState { stream.emit('readable') } - if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary() + if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) { + this.updateNonPrimary() + } } while (this.continueUpdate() === true) stream._duplexState &= READ_NOT_UPDATING @@ -36990,8 +37012,14 @@ class ReadableState { if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) { stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING stream.emit('end') - if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING - if (this.pipeTo !== null) this.pipeTo.end() + + if ((stream._duplexState & AUTO_DESTROY) === DONE) { + stream._duplexState |= DESTROYING + } + + if (this.pipeTo !== null) { + this.pipeTo.end() + } } if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) { @@ -37015,8 +37043,11 @@ class ReadableState { } updateCallback() { - if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) this.update() - else this.updateNextTick() + if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) { + this.update() + } else { + this.updateNextTick() + } } updateNextTickIfOpen() { @@ -37091,10 +37122,12 @@ function afterDrain() { function afterFinal(err) { const stream = this.stream if (err) stream.destroy(err) + if ((stream._duplexState & DESTROY_STATUS) === 0) { stream._duplexState |= WRITE_DONE stream.emit('finish') } + if ((stream._duplexState & AUTO_DESTROY) === DONE) { stream._duplexState |= DESTROYING } @@ -37102,26 +37135,37 @@ function afterFinal(err) { stream._duplexState &= WRITE_NOT_FINISHING // no need to wait the extra tick here, so we short circuit that - if ((stream._duplexState & WRITE_UPDATING) === 0) this.update() - else this.updateNextTick() + if ((stream._duplexState & WRITE_UPDATING) === 0) { + this.update() + } else { + this.updateNextTick() + } } function afterDestroy(err) { const stream = this.stream - if (!err && this.error !== STREAM_DESTROYED) err = this.error + if (!err && !StreamError.isStreamDestroyed(this.error)) err = this.error if (err) stream.emit('error', err) + stream._duplexState |= DESTROYED stream.emit('close') const rs = stream._readableState const ws = stream._writableState - if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err) + if (rs !== null && rs.pipeline !== null) { + rs.pipeline.done(stream, err) + } if (ws !== null) { - while (ws.drains !== null && ws.drains.length > 0) ws.drains.shift().resolve(false) - if (ws.pipeline !== null) ws.pipeline.done(stream, err) + while (ws.drains !== null && ws.drains.length > 0) { + ws.drains.shift().resolve(false) + } + + if (ws.pipeline !== null) { + ws.pipeline.done(stream, err) + } } } @@ -37135,6 +37179,7 @@ function afterWrite(err) { if ((stream._duplexState & WRITE_DRAIN_STATUS) === WRITE_UNDRAINED) { stream._duplexState &= WRITE_DRAINED + if ((stream._duplexState & WRITE_EMIT_DRAIN) === WRITE_EMIT_DRAIN) { stream.emit('drain') } @@ -37146,8 +37191,11 @@ function afterWrite(err) { function afterRead(err) { if (err) this.stream.destroy(err) this.stream._duplexState &= READ_NOT_ACTIVE - if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) + + if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) { this.stream._duplexState &= READ_NO_READ_AHEAD + } + this.updateCallback() } @@ -37181,8 +37229,14 @@ function afterOpen(err) { if (err) stream.destroy(err) if ((stream._duplexState & DESTROYING) === 0) { - if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY - if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY + if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) { + stream._duplexState |= READ_PRIMARY + } + + if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) { + stream._duplexState |= WRITE_PRIMARY + } + stream.emit('open') } @@ -37234,9 +37288,7 @@ class Stream extends EventEmitter { if (opts.open) this._open = opts.open if (opts.destroy) this._destroy = opts.destroy if (opts.predestroy) this._predestroy = opts.predestroy - if (opts.signal) { - opts.signal.addEventListener('abort', abort.bind(this)) - } + if (opts.signal) opts.signal.addEventListener('abort', abort.bind(this)) } this.on('newListener', newListener) @@ -37272,13 +37324,14 @@ class Stream extends EventEmitter { destroy(err) { if ((this._duplexState & DESTROY_STATUS) === 0) { - if (!err) err = STREAM_DESTROYED + if (!err) err = StreamError.STREAM_DESTROYED() this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY if (this._readableState !== null) { this._readableState.highWaterMark = 0 this._readableState.error = err } + if (this._writableState !== null) { this._writableState.highWaterMark = 0 this._writableState.error = err @@ -37288,8 +37341,13 @@ class Stream extends EventEmitter { this._predestroy() this._duplexState &= NOT_PREDESTROYING - if (this._readableState !== null) this._readableState.updateNextTick() - if (this._writableState !== null) this._writableState.updateNextTick() + if (this._readableState !== null) { + this._readableState.updateNextTick() + } + + if (this._writableState !== null) { + this._writableState.updateNextTick() + } } } } @@ -37309,6 +37367,20 @@ class Readable extends Stream { } } + static deferred(fn, opts) { + const out = new PassThrough(opts) + + fn() + .then((src) => { + if (src === null) return out.end() + if (out.destroying) return + pipeline(src, out, noop) + }) + .catch((err) => out.destroy(err)) + + return out + } + setEncoding(encoding) { const dec = new TextDecoder(encoding) const map = this._readableState.map || echo @@ -37453,10 +37525,13 @@ class Readable extends Stream { function ondata(data) { if (promiseReject === null) return - if (error) promiseReject(error) - else if (data === null && (stream._duplexState & READ_DONE) === 0) - promiseReject(STREAM_DESTROYED) - else promiseResolve({ value: data, done: data === null }) + if (error) { + promiseReject(error) + } else if (data === null && (stream._duplexState & READ_DONE) === 0) { + promiseReject(StreamError.STREAM_DESTROYED()) + } else { + promiseResolve({ value: data, done: data === null }) + } promiseReject = promiseResolve = null } @@ -37515,10 +37590,12 @@ class Writable extends Stream { static drained(ws) { if (ws.destroyed) return Promise.resolve(false) + const state = ws._writableState const pending = isWritev(ws) ? Math.min(1, state.queue.length) : state.queue.length const writes = pending + (ws._duplexState & WRITE_WRITING ? 1 : 0) if (writes === 0) return Promise.resolve(true) + if (state.drains === null) state.drains = [] return new Promise((resolve) => { state.drains.push({ writes, resolve }) @@ -37642,6 +37719,7 @@ class PassThrough extends Transform {} function transformAfterFlush(err, data) { const cb = this._transformState.afterFinal if (err) return cb(err) + if (data !== null && data !== undefined) this.push(data) this.push(null) cb(null) @@ -37695,7 +37773,7 @@ function pipeline(stream, ...streams) { }) if (autoDestroy) { - dest.on('close', () => done(error || (fin ? null : PREMATURE_CLOSE))) + dest.on('close', () => done(error || (fin ? null : StreamError.PREMATURE_CLOSE()))) } } @@ -37706,8 +37784,12 @@ function pipeline(stream, ...streams) { s.on('close', onclose) function onclose() { - if (rd && s._readableState && !s._readableState.ended) return onerror(PREMATURE_CLOSE) - if (wr && s._writableState && !s._writableState.ended) return onerror(PREMATURE_CLOSE) + if (rd && s._readableState && !s._readableState.ended) { + return onerror(StreamError.PREMATURE_CLOSE()) + } + if (wr && s._writableState && !s._writableState.ended) { + return onerror(StreamError.PREMATURE_CLOSE()) + } } } @@ -37755,7 +37837,7 @@ function getStreamError(stream, opts = {}) { (stream._writableState && stream._writableState.error) // avoid implicit errors by default - return !opts.all && err === STREAM_DESTROYED ? null : err + return !opts.all && StreamError.isStreamDestroyed(err) ? null : err } function isReadStreamx(stream) { @@ -37781,7 +37863,7 @@ function defaultByteLength(data) { function noop() {} function abort() { - this.destroy(new Error('Stream aborted.')) + this.destroy(StreamError.ABORTED()) } function isWritev(s) { @@ -37809,6 +37891,52 @@ module.exports = { } +/***/ }), + +/***/ 5657: +/***/ ((module) => { + +module.exports = class StreamError extends Error { + constructor(msg, code, fn = StreamError) { + super(msg) + + this.code = code + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, fn) + } + } + + static isStreamDestroyed(err) { + return err && err.code === 'STREAM_DESTROYED' + } + + static isPrematureClose(err) { + return err && err.code === 'PREMATURE_CLOSE' + } + + static isAborted(err) { + return err && err.code === 'ABORTED' + } + + get name() { + return 'StreamError' + } + + static STREAM_DESTROYED() { + return new StreamError('Stream was destroyed', 'STREAM_DESTROYED', StreamError.STREAM_DESTROYED) + } + + static PREMATURE_CLOSE() { + return new StreamError('Premature close', 'PREMATURE_CLOSE', StreamError.PREMATURE_CLOSE) + } + + static ABORTED() { + return new StreamError('Stream aborted', 'ABORTED', StreamError.ABORTED) + } +} + + /***/ }), /***/ 634: @@ -44183,7 +44311,6 @@ function defaultFactory (origin, opts) { class Agent extends DispatcherBase { constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) { - if (typeof factory !== 'function') { throw new InvalidArgumentError('factory must be a function.') } @@ -44791,29 +44918,71 @@ class Parser { const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr - if (ret === constants.ERROR.PAUSED_UPGRADE) { - this.onUpgrade(data.slice(offset)) - } else if (ret === constants.ERROR.PAUSED) { - this.paused = true - socket.unshift(data.slice(offset)) - } else if (ret !== constants.ERROR.OK) { - const ptr = llhttp.llhttp_get_error_reason(this.ptr) - let message = '' - /* istanbul ignore else: difficult to make a test case for */ - if (ptr) { - const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) - message = - 'Response does not match the HTTP/1.1 protocol (' + - Buffer.from(llhttp.memory.buffer, ptr, len).toString() + - ')' - } - throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)) + if (ret !== constants.ERROR.OK) { + const body = data.subarray(offset) + + if (ret === constants.ERROR.PAUSED_UPGRADE) { + this.onUpgrade(body) + } else if (ret === constants.ERROR.PAUSED) { + this.paused = true + socket.unshift(body) + } else { + throw this.createError(ret, body) + } } } catch (err) { util.destroy(socket, err) } } + finish () { + assert(currentParser === null) + assert(this.ptr != null) + assert(!this.paused) + + const { llhttp } = this + + let ret + + try { + currentParser = this + ret = llhttp.llhttp_finish(this.ptr) + } finally { + currentParser = null + } + + if (ret === constants.ERROR.OK) { + return null + } + + if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) { + this.paused = true + return null + } + + return this.createError(ret, EMPTY_BUF) + } + + createError (ret, data) { + const { llhttp, contentLength, bytesRead } = this + + if (contentLength && bytesRead !== parseInt(contentLength, 10)) { + return new ResponseContentLengthMismatchError() + } + + const ptr = llhttp.llhttp_get_error_reason(this.ptr) + let message = '' + if (ptr) { + const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) + message = + 'Response does not match the HTTP/1.1 protocol (' + + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + + ')' + } + + return new HTTPParserError(message, constants.ERROR[ret], data) + } + destroy () { assert(this.ptr != null) assert(currentParser == null) @@ -45185,8 +45354,11 @@ async function connectH1 (client, socket) { // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded // to the user. if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so for as a valid response. - parser.onMessageComplete() + const parserErr = parser.finish() + if (parserErr) { + this[kError] = parserErr + this[kClient][kOnError](parserErr) + } return } @@ -45205,8 +45377,10 @@ async function connectH1 (client, socket) { const parser = this[kParser] if (parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so far as a valid response. - parser.onMessageComplete() + const parserErr = parser.finish() + if (parserErr) { + util.destroy(this, parserErr) + } return } @@ -45218,8 +45392,7 @@ async function connectH1 (client, socket) { if (parser) { if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so far as a valid response. - parser.onMessageComplete() + this[kError] = parser.finish() || this[kError] } this[kParser].destroy() @@ -127671,7 +127844,7 @@ class RequestError extends Error { // pkg/dist-src/version.js -var dist_bundle_VERSION = "10.0.9"; +var dist_bundle_VERSION = "10.0.10"; // pkg/dist-src/defaults.js var defaults_default = { @@ -141424,7 +141597,6 @@ function getCreateRecheckDelayMs(profile) { /** @typedef {import("./profile-comment.js").NormalizedProfile} NormalizedProfile */ const DEFAULT_PROFILER_FILE = "/var/log/jibril.profiler.out" -const DEFAULT_PROFILER4FUN_FILE = "/var/log/jibril.profiler4fun.out" const JSON_PROFILE_LABEL = "JSON profile" // This is the post step for the action. It is called by the GitHub Actions @@ -141468,10 +141640,9 @@ async function run() { await uploadJibrilArtifacts() } - const selectedProfiler = resolveSelectedProfiler() - const profilerFile = resolveSelectedProfilerFile(selectedProfiler) + const profilerFile = resolveSelectedProfilerFile() - info(`using profiler printer: ${selectedProfiler}`) + info("using profiler printer: profiler") await appendProfilerSummary(profilerFile) await publishProfilerComment() @@ -141615,33 +141786,10 @@ async function readOptionalRootFile(filePath) { } /** - * @returns {"profiler" | "profiler4fun"} - */ -function resolveSelectedProfiler() { - const selectedProfiler = getState("selectedProfiler") - if (selectedProfiler === "profiler" || selectedProfiler === "profiler4fun") { - return selectedProfiler - } - - return getState("profiler4fun") === "true" ? "profiler4fun" : "profiler" -} - -/** - * @param {"profiler" | "profiler4fun"} selectedProfiler * @returns {string} */ -function resolveSelectedProfilerFile(selectedProfiler) { - if (selectedProfiler === "profiler4fun") { - return firstNonEmptyString([ - getState("selectedProfilerFile"), - getState("profiler4funFile"), - getEnv("JIBRIL_PROFILER4FUN_FILE"), - DEFAULT_PROFILER4FUN_FILE, - ]) - } - +function resolveSelectedProfilerFile() { return firstNonEmptyString([ - getState("selectedProfilerFile"), getState("profilerFile"), getEnv("JIBRIL_PROFILER_FILE"), DEFAULT_PROFILER_FILE, diff --git a/src/action.js b/src/action.js index d07da4c..b24410e 100644 --- a/src/action.js +++ b/src/action.js @@ -289,9 +289,8 @@ AI_TEMPERATURE=${getEnv("AI_TEMPERATURE", "0.3")} # Runner information RUNNER_ARCH=${getEnv("RUNNER_ARCH")} RUNNER_OS=${getEnv("RUNNER_OS")} -# Jibril writes profile markdown to these files (one per printer) +# Jibril writes profile outputs to these files JIBRIL_PROFILER_FILE=${getEnv("JIBRIL_PROFILER_FILE")} -JIBRIL_PROFILER4FUN_FILE=${getEnv("JIBRIL_PROFILER4FUN_FILE")} JIBRIL_JSONPROFILER_FILE=${getEnv("JIBRIL_JSONPROFILER_FILE")} # GitHub context GITHUB_ACTION=${getEnv("GITHUB_ACTION", "__run")} diff --git a/src/main.js b/src/main.js index 12cd1f0..0c1583a 100644 --- a/src/main.js +++ b/src/main.js @@ -27,16 +27,6 @@ async function main() { } try { - // Save whether profiler4fun mode is enabled as a boolean. - const profiler4fun = core.getInput("profiler_4fun") === "true" - - // Store as string for state passing to post.js. - core.saveState("profiler4fun", profiler4fun ? "true" : "") - core.saveState( - "selectedProfiler", - profiler4fun ? "profiler4fun" : "profiler", - ) - // Save debug state for later retrieval. const debug = core.getInput("debug") === "true" core.saveState("debug", debug ? "true" : "") @@ -59,20 +49,12 @@ async function main() { // Set the default profiler printer file paths. const profilerFile = process.env.JIBRIL_PROFILER_FILE || "/var/log/jibril.profiler.out" - const profiler4funFile = - process.env.JIBRIL_PROFILER4FUN_FILE || "/var/log/jibril.profiler4fun.out" const jsonProfilerFile = process.env.JIBRIL_JSONPROFILER_FILE || "/var/log/jibril.profile.json" process.env.JIBRIL_PROFILER_FILE = profilerFile - process.env.JIBRIL_PROFILER4FUN_FILE = profiler4funFile process.env.JIBRIL_JSONPROFILER_FILE = jsonProfilerFile core.saveState("profilerFile", profilerFile) - core.saveState("profiler4funFile", profiler4funFile) core.saveState("jsonProfilerFile", jsonProfilerFile) - core.saveState( - "selectedProfilerFile", - profiler4fun ? profiler4funFile : profilerFile, - ) await run() } catch (err) { diff --git a/src/post.js b/src/post.js index 31374c4..5085c89 100644 --- a/src/post.js +++ b/src/post.js @@ -14,7 +14,6 @@ import { publishPullRequestComment } from "./pr-comment.js" /** @typedef {import("./profile-comment.js").NormalizedProfile} NormalizedProfile */ const DEFAULT_PROFILER_FILE = "/var/log/jibril.profiler.out" -const DEFAULT_PROFILER4FUN_FILE = "/var/log/jibril.profiler4fun.out" const JSON_PROFILE_LABEL = "JSON profile" // This is the post step for the action. It is called by the GitHub Actions @@ -58,10 +57,9 @@ async function run() { await uploadJibrilArtifacts() } - const selectedProfiler = resolveSelectedProfiler() - const profilerFile = resolveSelectedProfilerFile(selectedProfiler) + const profilerFile = resolveSelectedProfilerFile() - core.info(`using profiler printer: ${selectedProfiler}`) + core.info("using profiler printer: profiler") await appendProfilerSummary(profilerFile) await publishProfilerComment() @@ -205,33 +203,10 @@ async function readOptionalRootFile(filePath) { } /** - * @returns {"profiler" | "profiler4fun"} - */ -function resolveSelectedProfiler() { - const selectedProfiler = core.getState("selectedProfiler") - if (selectedProfiler === "profiler" || selectedProfiler === "profiler4fun") { - return selectedProfiler - } - - return core.getState("profiler4fun") === "true" ? "profiler4fun" : "profiler" -} - -/** - * @param {"profiler" | "profiler4fun"} selectedProfiler * @returns {string} */ -function resolveSelectedProfilerFile(selectedProfiler) { - if (selectedProfiler === "profiler4fun") { - return firstNonEmptyString([ - core.getState("selectedProfilerFile"), - core.getState("profiler4funFile"), - getEnv("JIBRIL_PROFILER4FUN_FILE"), - DEFAULT_PROFILER4FUN_FILE, - ]) - } - +function resolveSelectedProfilerFile() { return firstNonEmptyString([ - core.getState("selectedProfilerFile"), core.getState("profilerFile"), getEnv("JIBRIL_PROFILER_FILE"), DEFAULT_PROFILER_FILE, From e97da5f2d3cdd7af272d88ffa8bacc96e5e360e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Parada?= Date: Thu, 28 May 2026 23:07:28 -0400 Subject: [PATCH 2/3] chore: update deps --- package-lock.json | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0eaf089..928d12b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -500,16 +500,15 @@ } }, "node_modules/@octokit/request": { - "version": "10.0.9", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.9.tgz", - "integrity": "sha512-o8Bi3f608eyM+7BmBiUWxFsdjLb3/ym1cQek5LZOv9KkZcxRrHCPhhRzm6xjO6HVZ85ItD6+sTsjxo821SVa/A==", + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.10.tgz", + "integrity": "sha512-KxNC2pTqqhszMNrf12ZRd4PonRgyJdsM4F/jySiddQK+DsRcfBtUvqn8t7UsyZhnRJHvX46OohDt5N3VqIWC2w==", "license": "MIT", "dependencies": { "@octokit/endpoint": "^11.0.3", "@octokit/request-error": "^7.0.2", "@octokit/types": "^16.0.0", "content-type": "^2.0.0", - "fast-content-type-parse": "^3.0.0", "json-with-bigint": "^3.5.3", "universal-user-agent": "^7.0.2" }, @@ -893,9 +892,9 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz", - "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz", + "integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==", "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" @@ -1111,22 +1110,6 @@ "bare-events": "^2.7.0" } }, - "node_modules/fast-content-type-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-3.0.0.tgz", - "integrity": "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "MIT" - }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -1607,9 +1590,9 @@ } }, "node_modules/streamx": { - "version": "2.25.0", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.25.0.tgz", - "integrity": "sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg==", + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.26.0.tgz", + "integrity": "sha512-VvNG1K72Po/xwJzxZFnZ++Tbrv4lwSptsbkFuzXCJAYZvCK5nnxsvXU6ajqkv7chyiI1Y0YXq2Jh8Iy8Y7NF/A==", "license": "MIT", "dependencies": { "events-universal": "^1.0.0", @@ -1818,9 +1801,9 @@ } }, "node_modules/undici": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.25.0.tgz", - "integrity": "sha512-ZgpWDC5gmNiuY9CnLVXEH8rl50xhRCuLNA97fAUnKi8RRuV4E6KG31pDTsLVUKnohJE0I3XDrTeEydAXRw47xg==", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.26.0.tgz", + "integrity": "sha512-4yqz8a3n5HmGTlsbADNtr/dJlhkh/55Rq798G6ibiULcXbDtaLpTl1pvdqcbFfeoj3iSi52lePFM7h9H21cw/A==", "license": "MIT", "engines": { "node": ">=18.17" From a3865f3f63356b5b728e37001953e9fe6321ca4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Parada?= Date: Thu, 28 May 2026 23:08:26 -0400 Subject: [PATCH 3/3] chore: update deps --- dist/post/index.js | 20 +------------------- package-lock.json | 6 +++--- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/dist/post/index.js b/dist/post/index.js index a80a8e8..c033ffa 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -95409,7 +95409,6 @@ const BASIC_LATIN = { num: '#', dollar: '$', percent: '%', - amp: '&', ast: '*', commat: '@', lowbar: '_', @@ -95841,9 +95840,6 @@ const CYRILLIC = { */ const MATH = { plus: '+', - minus: '−', - mnplus: '∓', - mp: '∓', pm: '±', times: '×', div: '÷', @@ -95916,10 +95912,6 @@ const MATH = { bumpe: '≏', bumpeq: '≏', HumpEqual: '≏', - dotminus: '∸', - minusd: '∸', - plusdo: '∔', - dotplus: '∔', le: '≤', LessEqual: '≤', ge: '≥', @@ -96036,7 +96028,6 @@ const MATH_ADVANCED = { wreath: '≀', nsime: '≄', nsimeq: '≄', - nsimeq: '≄', ncong: '≇', simne: '≆', ncongdot: '⩭̸', @@ -96153,10 +96144,6 @@ const ARROWS = { mapsto: '↦', mapstodown: '↧', crarr: '↵', - nwarrow: '↖', - nearrow: '↗', - searrow: '↘', - swarrow: '↙', nleftarrow: '↚', nleftrightarrow: '↮', nrightarrow: '↛', @@ -96197,7 +96184,6 @@ const ARROWS = { ldrushar: '⥋', rdldhar: '⥩', lrhard: '⥭', - rlhar: '⇌', uharr: '↾', uharl: '↿', dharr: '⇂', @@ -96213,7 +96199,6 @@ const ARROWS = { nhArr: '⇎', nlarr: '↚', nlArr: '⇍', - nrarr: '↛', nrArr: '⇏', larrb: '⇤', LeftArrowBar: '⇤', @@ -96375,7 +96360,6 @@ const PUNCTUATION = { DiacriticalDot: '˙', DiacriticalDoubleAcute: '˝', grave: '`', - acute: '´', }; /** @@ -96389,7 +96373,6 @@ const CURRENCY = { yen: '¥', euro: '€', dollar: '$', - euro: '€', fnof: 'ƒ', inr: '₹', af: '؋', @@ -96489,7 +96472,6 @@ const MISC_SYMBOLS = { Vdash: '⊩', dashv: '⊣', vDash: '⊨', - Vdash: '⊩', Vvdash: '⊪', nvdash: '⊬', nvDash: '⊭', @@ -96846,7 +96828,7 @@ class EntityDecoder { decode(str) { if (typeof str !== 'string' || str.length === 0) return str; //TODO: check if needed - //if (str.indexOf('&') === -1) return str; // fast path — no entities at all + if (str.indexOf('&') === -1) return str; // fast path — no entities at all const original = str; const chunks = []; diff --git a/package-lock.json b/package-lock.json index 928d12b..06ff283 100644 --- a/package-lock.json +++ b/package-lock.json @@ -369,9 +369,9 @@ } }, "node_modules/@nodable/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.1.tgz", + "integrity": "sha512-Pig3HxDIoMgjdEH8OCf/dkcTmLFjJRjWuq8jSnklu284/TKOPibSRERmOykiwmyXTtv61mP+44f3GMx0tLAyjg==", "funding": [ { "type": "github",