Repository navigation
v12.0.0 — promise-based fly(), typed errors, landing rewrite, tests + CI - #1
Merged
Merged
Conversation
Breaking API changes:
- fly() now returns a Promise: resolves { phase, landedAt } on landing,
rejects ElytraFlightError (err.code) on failure/stop/respawn
- 19 error codes in src/errors.js; NON_RETRYABLE pre-flight failures
(NO_ENTITY/NO_ELYTRA/ELYTRA_LOW/NO_ROCKETS/NO_LAUNCH_SPOT/PF_FAILED)
fail fast, transient in-flight failures retry -> RETRIES_EXHAUSTED
with the last code in err.cause
- fly() during CRUISE/DEADSTICK retargets the active flight and returns
the same pending promise; any other in-flight phase rejects IN_FLIGHT
without touching the active target
- emit('error') guarded (no more synchronous throw with no listener);
the promise rejection is the primary error path
Rewrites & fixes:
- Landing: spiral orbit -> glide-to-goal onto a verified safe spot;
cactus/hazard touchdown now relocates instead of looping forever
- New DEADSTICK phase: fuel-out mid-climb/cruise glides to the goal
- _yawTo holds heading within 3 m of the target column (jitter dead zone
that made the bot spin and stall)
- stop() clears the real interval handles (fly/verify/rocket/climb/land
loops + retry/sneak timers), emits exactly one 'stopped', cancels a
pending retry, rejects the promise with STOPPED
- Single shared state object (per-module ctx.state copies are gone);
per-instance logger; module switches (safety/elytraAudit/autoRocket/
chunkScan/pathfinding/wander/landing) all honoured
- Removed src/commands.js, src/config.js, src/core/chat.js (chat
commands moved out of the engine, owner alerts via whisper only)
- MODES.MED/LOW aliases resolve; mode speeds 22/13/10 m/s (planning)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- test/run.js: parallel unit + integration runner, real-time budget, zero npm dependencies (node test/run.js, unit, integ) - test/helpers/mock-bot.js: mineflayer bot over a real prismarine-world 1.21 terrain with blocks/tick elytra physics (rocket boost decay, ~15:1 glide, stall on up-point without boost) — yaw convention verified against mineflayer's own bot.lookAt - 14 unit tests: mode/phase/error-code invariants, block classification against real 1.21 data, elytra damage math (2/(n+3), unbreaking-aware), rocket counting/requirements - 13 integration tests: full 300 m flight, IN_FLIGHT + mid-cruise retarget (same promise), stop() semantics (one 'stopped', pending-retry cancellation), NO_ENTITY, RETRIES_EXHAUSTED with err.cause, preflight purity/shape, worn-elytra swap, flower/cactus landing recovery, DEADSTICK fuel-out landing - perf guard: 300 m flight < 500k blockAt calls (~45k in practice) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- Every fly() call now chains .then/.catch (STOPPED-aware); no more fire-and-forget flights or phase-event queue watching (IDLE double- fires on stop, which made queues double-advance) - inventory-transfer.js: removed the IDLE-driving phase listener; all three legs chain to handleTransferArrival(); transferMode re-entrancy guard on the transfer commands - waypoint-travel.js: next waypoint chained in .then(); waypointMode re-entrancy guard; .then/.catch on the chat commands - advanced/demo/multi-bot one-shot flights got .then/.catch - Dropped private internals (flight._targetX/_targetZ) for the public flight.targetX/targetZ getters Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- LICENSE: MIT (eksses, 2024-2026); CHANGELOG.md: 12.0.0 entry - eslint flat config (ESLint 9 + @eslint/js); npm run lint covers src, test, examples — clean - .github/workflows/ci.yml: node 18/20/22 — npm ci, lint, node test/run.js, npm pack --dry-run - package.json: v12.0.0, files includes LICENSE, eslint devDeps - legacy/elytraBot.js untracked (kept on disk, gitignored) — pre-12 monolith is reference-only and no longer part of the package Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- Promise-based fly() in Quick Start / API / all examples
- Full constructor options block (module switches, reliability,
hazardCheck, landingMargin default 1)
- Error-code table (19 codes, fail-fast vs retried, err.cause)
- Phases: string values (FAIL, SCAN, RELOC), DEADSTICK, glide-to-goal
landing; mode planning speeds 22/13/10
- Development section: node test/run.js, npm run lint, CI
- AGENTS.md: v12 architecture, critical invariants learned from real
bugs (yaw convention, _yawTo dead zone, takeoff-first fire,
guarded emit('error'), run-until-settled), mock physics gotchas,
measured rocket requirements
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
v12.0.0 — promise-based API, typed errors, rewrite of landing & reliability
Companion to the two audit rounds: all confirmed bugs (B1–B25, A1–A9) fixed, plus the missing repo infrastructure (tests, lint, CI, license, changelog). 27/27 tests passing (zero-dependency mock-flight suite, ~40 s).
Breaking (12.0.0)
fly()returns a Promise — resolves{ phase: 'IDLE', landedAt: {x,y,z} }, rejectsElytraFlightErrorwith a machine-readableerr.code(19 codes; see README table). Branch onerr.code, never message text.fly()duringCRUISE/DEADSTICKretargets in place and returns the same pending promise; any other in-flight phase rejectsIN_FLIGHTand does not change the active target.NO_ENTITY,NO_ELYTRA,ELYTRA_LOW,NO_ROCKETS,NO_LAUNCH_SPOT,PF_FAILED) fail fast with their code; transient in-flight failures retry up tomaxRetries, then rejectRETRIES_EXHAUSTEDwith the last code inerr.cause.src/commands.js,src/config.js,src/core/chat.js— chat commands were never part of the flight engine; owner alerts are whisper-only.Added
DEADSTICKphase — fuel-out mid-climb/cruise glides to the goal and still lands (covered by an integration test).src/errors.js— frozen 19-code error set, typed error class,NON_RETRYABLEset.test/— zero-dependency suite (node test/run.js): mock mineflayer bot over real prismarine-world 1.21 terrain with blocks/tick elytra physics; 14 unit + 13 integration tests (full 300 m flight, retarget, stop semantics, retry exhaustion, elytra swap, cactus/flower recovery, fuel-out) + perf guard (< 500kblockAtcalls per flight, ~45k in practice).npm run lintover src/test/examples — clean), CI (.github/workflows/ci.yml, Node 18/20/22: ci → lint → tests → pack dry-run), LICENSE (MIT), CHANGELOG.md.Fixed (selection — full list in CHANGELOG)
emit('error')no longer throws synchronously when no listener is attached (guarded; the promise rejection is the primary path).stop()clears the real interval handles (fly/verify/rocket/climb/land loops + retry/sneak timers), emits exactly onestopped, and cancels a pending retry (no more re-takeoff after stop)._yawTodead zone: within 3 m of the target column the bearing is numerically unstable (jitter flipped it ~180° → bot spun and never fired rockets).ctx.statecopies (writes silently lost) → single shared state object; per-instance logger (no more shared debug state across bots).isFlying()check (an elytra at jump apex is alreadyisFlying()with zero boost).MED/LOWresolve instead of silently falling back to MED; unknown mode no longer resets to MED.preflight()is pure (no equip side effect) and always returns the documented shape.Changed
.then/.catch, STOPPED-aware), public-API only, with re-entrancy guards in the queue-based ones.landingMargindefault 2 → 1; mode planning speeds documented (22/13/10 m/s).legacy/elytraBot.jsuntracked (kept on disk) — pre-12 monolith is reference-only.