fix: eliminate network dependency in flaky data-cite-frag Karma tests#5194
Open
fix: eliminate network dependency in flaky data-cite-frag Karma tests#5194
Conversation
…k dependency Agent-Logs-Url: https://github.com/speced/respec/sessions/3f0bd7ae-5179-49e0-a313-3e7e5f3fa55f Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix flaky Karma integration test due to Jasmine timeout
fix: eliminate network dependency in flaky data-cite-frag Karma tests
Apr 13, 2026
marcoscaceres
approved these changes
Apr 13, 2026
Contributor
|
@copilot can you check what broke on ci? |
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.
The
data-cite-frag→ "adds the path and the fragment identifier to the link" test was intermittently timing out in CI (FirefoxHeadless, Jasmine 5000ms default) because resolvingWHATWG-HTMLfell through to a liveupdateFromNetwork()call againstapi.specref.orgwhen IndexedDB was cold (fresh CI runner).Root cause
data-cite.jscallsresolveRef(key)for eachdata-citeelement; on a cache miss it falls back toupdateFromNetwork([key]). The[[WHATWG-HTML]]reference is not present in the document markup (only as adata-citeattribute), sobiblio.jsnever pre-fetches it — leavingdata-cite.jsto hit the network at runtime. The sibling test ("cited fragments are overridden by cite-frag") happened to pass because the first test's fetch populated IndexedDB before it ran.Fix
Pre-seed
WHATWG-HTMLvialocalBiblioinside thedescribe("data-cite-frag")block, and pass it tomakeStandardOpsin the two tests that reference that spec. Entries present inlocalBiblioare explicitly excluded from specref network fetches inbiblio.js.Original prompt
Create a fix for flaky Karma integration test in #5179.
Context:
"Core — data-cite attribute" → "data-cite-frag" → "adds the path and the fragment identifier to the link"
from tests/spec/core/data-cite-spec.js.
Goal:
Implementation guidance:
Files likely involved:
Deliverable:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for failing job 71167571943. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failing job 71167571943 is due to a timeout in the Karma integration test:
Core — data-cite attribute → data-cite-frag → adds the path and the fragment identifier to the linkmakeRSDoc)afterAll(flushIframes)triggersTimed out waiting on undefinedfromtests/spec/SpecHelper.js:13because at least onemakeRSDoc()promise never resolved and its timeout handler fired.Root cause
This particular test requires resolving external bibliography entries (e.g., WHATWG-HTML) and then building the final link:
In
src/core/data-cite.js,run()calls:updateBiblio([...elems])→ which callsupdateFromNetwork(missingBibEntries)(network-backed)getLinkProps()→ which callsresolveRef(key)againIf the network fetch is slow/flaky in CI (or FirefoxHeadless is slower),
doc.respec.readymay not resolve within 5s, causing the Jasmine timeout.Solution (make the test resilient)
Increase the timeout for this test (or for the whole
describe) so it can tolerate slower CI runs.In
tests/spec/core/data-cite-spec.jsat thedata-cite-fragtest (around lines 205–225 in ref6c5058a67ea2320b61f019eeb26257ae212a894d), add a larger timeout:This is the most targeted fix (only affects the slow/flaky test).
Optional hardening (recommended)
If you want to remove flakiness entirely, avoid relying on network-backed biblio in this test by ensuring the needed biblio entry is already available locally (e.g., inject a minimal biblio entry for
WHATWG-HTMLvia test setup). That would eliminate the dependency onupdateFromNetwork()timing, but requires a bit more refactoring of how the test provides biblio ...This pull request was created from Copilot chat.