Conversation
d-braun
force-pushed
the
fix/895-quality-gate-history-deadlock
branch
3 times, most recently
from
September 7, 2026 22:23
a372d01 to
c5b08fb
Compare
2 tasks
formaceft-93
requested changes
Sep 14, 2026
Contributor
d-braun
force-pushed
the
fix/895-quality-gate-history-deadlock
branch
from
September 14, 2026 10:53
76bdde4 to
370f193
Compare
Contributor
Author
|
Thanks @formaceft-93! |
Member
|
Hello, @d-braun! Some tests windows failed. Please, resolve the problems before we continue |
d-braun
force-pushed
the
fix/895-quality-gate-history-deadlock
branch
from
September 15, 2026 10:46
cfdf05c to
118787b
Compare
Contributor
Author
|
Thanks @epszaw! Fixed. :) |
Nothing in the suite could reproduce the silent exit that `historyPath` caused (allure-framework#827, allure-framework#895): Yarn's PnP runtime replaces `fs/promises.open` with a ZipFS-backed handle whose `close()` doesn't wait for stream references, which hides the deadlock from every in-process test and from anything started through `yarn node`. - add a core test that copies the built packages into a real `node_modules` tree and runs the history code in a plain `node` process; without the fix it reports "Detected unsettled top-level await" and exits with code 13 - add an end-to-end `allure serve` test with `historyPath` configured, adapted from allure-framework#861; it covers the symptom of allure-framework#827 in environments with real `node_modules` and stays a smoke test under PnP - hoist the CLI build in `run.integration.test.ts` to file level, so it can't wipe `dist` while another suite drives the built CLI - create the write stream after the `limit === 0` early returns
…ssion test runs on Windows `URL#pathname` keeps the leading slash and the percent-encoding on Windows (`/C:/Users/RUNNER%7E1/...`), which `path.resolve` in `appendHistory` turned into `C:\C:\...` and made the `mkdir` fail with ENOENT on the windows-latest job.
formaceft-93
force-pushed
the
fix/895-quality-gate-history-deadlock
branch
from
September 16, 2026 08:47
9fbdf3b to
904c695
Compare
Contributor
|
@d-braun Sorry to bother you again, but can you resolve conflicts one more time, please :) |
# Conflicts: # packages/cli/src/commands/qualityGate.ts # packages/core/src/history.ts
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Fixes #895 and #827 (closes #861).
When
historyPathis configured,allure quality-gateexits with code 0 and prints nothing, no matter how many rules the results violate. The only trace it leaves is anallure-report/directory containing a singletest-results.jsonand noquality-gate.json, exactly as reported in the issue.allure generateandallure runhit the same defect; there it goes mostly unnoticed because the report has already been written by the time the process stalls.Root cause.
AllureLocalHistoryopens streams on aFileHandlewithautoClose: falseand then awaitsFileHandle.close()in afinallyblock without ever destroying them. Such streams are never destroyed on their own, and the handle stays referenced until they emit"close"— soFileHandle.close()waits for a reference that is never released and never settles. As a consequenceAllureReport.done()never returns, the event loop drains, and Node exits with code 0 before the quality gate is ever validated.This is why the issue looks like the config file is ignored: the reporter's config sets
historyPath, while the--max-failuresrun they compared against was made without--configand therefore without history. Rule parsing was never the problem.Note that running the CLI through
yarn allure …hides the defect — Yarn PnP preloads.pnp.cjs, which shifts the timing enough forclose()to settle. Under plainnode/npx, which is what users run, it deadlocks. Vitest masks it as well. The numbers below come from a cleannpm i [email protected]with the builthistory.jsswapped in and run under plainnode:quality-gatewithhistoryPathquality-gate.jsonhistoryLimitgeneratewithhistoryPathdone()never returnedChanges.
packages/core/src/history.ts— destroy every stream opened on the history file handle before closing it, in the order the streams were opened: destroying a reader that shares its handle with a still open writer never completes, whereas destroying the writer closes the reader along with it. Closing the handle toleratesEBADF, because a destroyed stream may already have closed the descriptor depending on the runtime.packages/cli/src/commands/qualityGate.ts— safety net: a quality gate must never pass silently. If the process is about to exit before the validation has finished, the command now reports it and exits with code 1 instead of leaving the caller with a successful exit code. Checked against the unfixed deadlock, it turns the silent exit 0 into a loud failure.Tests.
packages/core/test/history.streams.test.ts(new) — asserts that every stream opened on the history file handle is closed, for the new-file, existing-file and read paths. All three fail without the fix.packages/cli/test/commands/qualityGate.test.ts— two tests for the new safety net: it fires on an interrupted run and stays silent on a completed one.yarn format:check, oxlint and the@allurereport/core(528) andallure(217) suites pass.Checklist