Skip to content

English Architecture and Testing

ame824 edited this page Aug 3, 2026 · 2 revisions

Architecture and testing

Why modular?

In Bitburner, every Netscript API used by a file contributes to its RAM cost. A single script importing all APIs could never start on a small Home server. autoDoIt therefore separates planning, tasks, and workers.

File layout

autoDoIt.js              small scheduler
core/                    configuration, capabilities, status, translation
lib/                     pure selection, budget, and helper logic
tasks/                   short normal management tasks
special/                 BitNode/Source-File-dependent systems
workers/                 minimal persistent executables
ui/                      Control Center and Overview extension
tools/                   self-test and auto-updater
git-pull.js              full downloader/updater
git-pull-lite.js         low-RAM downloader
runtime-manifest.txt     authoritative runtime file list
version.txt              update comparison marker
tests/                   external Node tests

Scheduler

autoDoIt.js imports no expensive system APIs. On every tick it:

  1. determines current Home RAM and the dynamic target
  2. selects the operating phase
  3. filters tasks that do not match the BitNode/API state
  4. checks the real RAM cost of each remaining file
  5. sorts due tasks by phase priority
  6. launches only the permitted number

Exclusive work such as Casino or certain SF‑1 workflows temporarily blocks other management launches. Existing hacking workers on other servers continue running.

Tasks and workers

Normal tasks perform one pass and exit, so their API RAM is resident only while real work occurs. Persistent workers are extremely small and receive their target/mode as arguments.

Large management areas use small coordinators with mutually exclusive phase workers. For example, factions separate planning from work, Bladeburner splits bootstrap, skills, and actions, and stocks split access from trading. The scheduler launches at most one phase per group, so the dynamic RAM target also counts only the largest worker in that group.

Special systems such as IPvGO or Darknet may stay active longer, but only in a matching BitNode or when the relevant Source-File capability exists.

Status communication

Modules write structured events to data files. The dashboard and Overview read these inexpensive states instead of querying every expensive API themselves. Notices have cooldowns so one missing requirement cannot flood the Terminal or toast system.

Update safety

runtime-manifest.txt is the source of truth for required runtime files. The updater:

  1. downloads the remote version and manifest
  2. downloads every file
  3. validates expected markers
  4. optionally runs the self-test
  5. restarts the scheduler with its previous arguments

A failed remote check does not replace a working local installation.

External tests

In the repository:

node --test tests/*.test.mjs

Tests cover, among other things:

  • scheduler phases and priorities
  • network and port logic
  • hacking target selection
  • Home, cloud-server, and Hacknet budgets
  • faction/augmentation selection
  • phase isolation for large managers and the shared faction plan
  • RAM target calculation using the maximum rather than the sum of exclusive workers
  • BitNode routing and projected Source-File rewards
  • Coding Contract solvers
  • Darknet password models and worker separation
  • Casino helper logic
  • v3 API names for Corporation and Bladeburner
  • importability of every runtime module
  • updater manifest and restart behaviour

In-game self-test

run tools/self-test.js

It complements external tests with state Node cannot reproduce:

  • Bitburner's real RAM analyzer
  • files on home
  • the current save's network
  • Source-File/BitNode API access

The self-test purchases nothing, installs no augmentations, and destroys no BitNode.

Limits

Visible UI automation (Casino and explicitly approved SF‑1 steps) can be affected by Bitburner layout changes. Unknown future Coding Contract types are skipped without consuming an attempt so their reward is not lost.

Copyright and participation

Bug reports, test results, and improvement suggestions are welcome. The source code is not licensed for free reuse or republication. Personal use inside Bitburner is permitted; copying, distributing, incorporating it into another project, or publishing modified versions requires prior explicit permission from ame824.

Clone this wiki locally