Urgent.News

What's breaking now, across thousands of outlets.

Tech

How I built a test that walks the shipped import graph: the missing module that bricked Ankita 2.7.0

How I built a test that walks the shipped import graph: the missing module that bricked Ankita 2.7.0 Ankita is my open-source desktop AI companion — local-first, MIT-licensed, your models. Yesterday I shipped v2.7.0. This morning I shipped v2.7.1, and the only reason it exists is embarrassing: after updating to 2.7.0, the desktop app would not start at all. The main process died with…

On February 22, 2023, Ankita 2.7.0 was released, but users found the desktop app would not start after the update. The root cause was a missing module in the packaged import graph, leading Ankita to write a test that walks the shipped import graph to prevent such issues in the future.

The issue stemmed from Ankita's split personality: the packaging config listed some directories for packaging, but not others. This resulted in two copies of the chatgpt-companion module: one as real files in extraResources and another inside the ASAR archive. When the Electron main process imported the companion module, the relative import resolved correctly on disk but failed in the packaged artifact.

The test, named test/desktop/chatgpt-package.test.mjs, enumerates every module under the code trees and checks if the packaged files contain relative imports. If any missing modules are found, the test asserts the map is empty. In the v2.7.0 configuration, the test failed for desktop/chatgpt-companion/sign-in.mjs, which was imported by desktop/electron/chatgpt-sign-in.mjs, reproducing the production crash as a unit-test failure. Fixing this required adding desktop/chatgpt-companion/**/* to the builder's files list.

The test has certain limitations: it only checks literal specifiers, does not account for dynamic imports, and trusts the builder's matcher to predict the artifact contents. While a test that builds the real ASAR and boots the main process could catch more bugs, it would be slower, more complex, and more prone to failures. The decision ultimately boils down to balancing thoroughness with practicality.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

My SSD went silent and SMART called it perfect

Storage monitoring assumes decay. Wear counters creep, spare blocks drain, thermals climb, and every dashboard I've ever set up is built to catch that slow slide.

  • Samsung 980 PRO 500GB SSD experienced sudden failure
  • Drive reported flawless self-monitoring status
  • Firmware or controller issue caused the malfunction

Turn PDF pages into JPG images in your browser

A PDF page is often the wrong format for a slide, a chat message, or a blog image. Uploading the whole document just to export one page is a poor trade. PDF to JPG does that conversion in the browser.

  • Convert PDF pages to JPG in browser, preserving original file
  • Choose quality (High, Medium, Low) for conversion
  • Access tool at https://kepttools.com/pdf-to-jpg

More from Monday 26 October →