Migration & Strict Rename Plan
Relevant source files
The following files were used as context for generating this wiki page:
The Migration & Strict Rename Plan is a comprehensive architectural overhaul designed to standardize the nomenclature and execution logic across the ArchiveBox ecosystem, specifically abx-dl, abx-plugins, and archivebox. The primary goal is to move away from legacy compatibility layers and aliases in favor of a strict, phase-split execution model that clearly distinguishes between dependency requests and resolved binary assets.
Central to this plan is the replacement of the legacy "fake" install bootstrapping (previously handled via archivebox://install crawl URLs) with a dedicated InstallEvent and a formal install phase. This ensures that dependency resolution is handled as a first-class citizen in the lifecycle, providing clearer state management and improved error reporting.
Core Nomenclature Refactoring
The plan mandates a strict rename of core records and events to align with their actual roles in the system. The distinction between a "Request" for a dependency and the "Resolved" dependency itself is now enforced at the type level.
Record and Event Renames
| Old Name | New Name | Purpose |
|---|---|---|
Binary record (initial) | BinaryRequest | Represents the intent to use a tool without metadata. |
Binary (resolved) | Binary | Represents the resolved tool with abspath and version. |
BinaryEvent | BinaryRequestEvent | Event emitted to trigger dependency resolution. |
on_Binary__* | on_BinaryRequest__* | Hook type for provider plugins to resolve tools. |
on_Crawl__* | on_CrawlSetup__* | Hooks for launching daemons and runtime state. |
Sources: TODOs.md:12-21, README.md:55-65
Behavior and Data Constraints
A critical rule of the new architecture is that a BinaryRequest must never carry resolved metadata such as abspath, version, or sha256. Only the resulting Binary record, emitted by a provider plugin (e.g., pip, npm, apt), carries this information.
Sources: TODOs.md:24-30, abx_dl/config.py:151-165
Execution Lifecycle and Phase Splitting
The project is moving from a monolithic crawl-based install to a partitioned lifecycle. This ensures that the orchestrator handles high-level events while provider plugins participate strictly through defined hook types.
The diagram above illustrates the new sequential flow where dependencies must be resolved in the Install Phase before any crawl setup or snapshot extraction begins.
Sources: TODOs.md:32-34, README.md:144-155
Phase Logic Changes
- Install Phase: Driven by
config.json > required_binaries. It emitsBinaryRequestEvents. Cache hits inderived.envor the database should respond to these by emitting syntheticBinaryevents. - Crawl Setup Phase: Hooks renamed to
on_CrawlSetup__*. These hooks are restricted to emittingMachineandProcessrecords only; they are strictly forbidden from emittingArchiveResultrecords. - Snapshot Phase: Remains the primary extraction phase, emitting
ArchiveResult,Snapshot, andTagrecords.
Sources: TODOs.md:31-40, abx_dl/cli.py:532-545
Hook File Migration Path
Provider and setup hooks across all plugins must be renamed to match the new event-based partitioning. This removes substring-based matching in favor of exact hook event parsing.
Renaming Map
| Original Hook Path | New Hook Path |
|---|---|
env/on_Binary__00_env_discover.py | env/on_BinaryRequest__00_env.py |
npm/on_Binary__10_npm_install.py | npm/on_BinaryRequest__10_npm.py |
pip/on_Binary__11_pip_install.py | pip/on_BinaryRequest__11_pip.py |
chrome/on_Crawl__90_chrome_launch.js | chrome/on_CrawlSetup__90_chrome_launch.js |
twocaptcha/on_Crawl__95_twocaptcha_config.js | twocaptcha/on_CrawlSetup__95_twocaptcha_config.js |
Sources: TODOs.md:46-61
Implementation Roadmap
The implementation is divided across abx-dl and archivebox to ensure the ecosystem remains synchronized during the transition.
abx-dl Updates
- Hook Parsing: Implement exact event type parsing in the
Hookclass. - Process Routing: Update internal routing to handle the distinction between
BinaryRequestandBinary. - CLI Overhaul: Update UI labels in the TUI to reflect new event names and ensure the
installCLI path emitsInstallEventdirectly. - Cleanup: Remove
INSTALL_URLand all logic associated with fake-install crawls.
Sources: TODOs.md:63-73, abx_dl/cli.py:843-860
Orchestration Sequence
This sequence shows the direct path for the new install command, bypassing the need for a simulated URL crawl.
Sources: TODOs.md:34-36, tests/test_cli.py:545-560
Conclusion
The Migration & Strict Rename Plan represents a shift toward a more robust, explicit dependency management system. By decoupling tool discovery from the archive crawl and enforcing a strict "Request vs. Resolution" model, the system gains better predictability and removes the legacy overhead of "fake" URLs used for bootstrapping.
Sources: TODOs.md:1-10, README.md:144-150