Skip to content

Simplified action APIs, improved allAction errors, and dependency bumps (v4.4.41)

Choose a tag to compare

released this 01 Sep 12:42
· 57 commits to working since this release

This release focuses on API simplification for actions, clearer error reporting for missing allAction handlers, and a set of maintenance changes: dependency version bumps, packaging/version fixes, CI/test config tweaks, and small developer ergonomics improvements. The primary technical thrust is the removal of the previous "affected-items" tuple return form from action/allAction APIs and the associated wrapper, type, and test updates — resulting in a leaner surface area for action methods and clearer runtime errors when an allAction key is not found.

New Features

  • Simplified action return types and wrappers
    • action/allAction APIs now return the direct result value (V or V[]) instead of a two-element tuple containing an affected-items array. This removes the previous [V, affected[]] form and the plumbing required to propagate affected-item lists through wrappers and callers.
    • Files affected: src/ops/action.ts, src/ops/allAction.ts, src/Operations.ts, src/contained/Operations.ts, src/primary/Operations.ts, src/Options.ts.
    • Tests updated to assert direct return values rather than tuple-form results (tests/ops/, tests/primary/ adjusted accordingly).

Improvements

  • Leaner wrapAllActionOperation signature and richer missing-action diagnostics

    • The wrapAllActionOperation wrapper signature was simplified by removing explicit toWrap and options parameters, making the wrapper surface leaner and reducing unused parameters in call sites (src/ops/allAction.ts).
    • When an allAction key is not found, the runtime now builds a clearer error message listing available action names (or 'none' when empty) and logs detailed context including requestedAction, availableActions, allActionsKeys, params, and locations before throwing. This aids diagnosing misconfigured or misspelled allAction keys.
    • The wrapper still resolves and invokes the found allAction method and returns its direct result.
  • Error message and formatting improvements

    • Error classes now use abbreviated key formatting for messages (abbrevIK) to avoid large JSON stringification in errors; default generic parameters were added for location generics to simplify usage when locations are not used (src/errors.ts).
    • docs copy script updated to invoke the docs template script deterministically (docs/package.json): node node_modules/@fjell/docs-template/dist/scripts/copy-docs.js.

Dependency & Packaging Changes

  • Package version and packaging hygiene

    • package.json version updated through the normal dev/release cycles and finalized at 4.4.41; EOF newline normalization restored where appropriate.
    • package-lock.json synchronized to reflect dependency updates.
  • Runtime and dev dependency bumps and pinning

    • Updated Fjell runtime dependencies (various commits) to newer patch releases across @fjell/core, @fjell/logging, and @fjell/registry to maintain compatibility with the current 4.4.x line.
    • Pin esbuild to an exact patch (0.25.9) in devDependencies to ensure reproducible builds across environments (package.json change).
    • ESLint config and related linting packages were updated to newer patch versions and additional ESLint packages were added to support rule sets.

Testing & CI

  • Test configuration and coverage

    • Vitest branch coverage threshold adjusted from 84% to 83% in vitest.config.ts to match current coverage expectations.
    • Tests were updated to reflect the simplified action API surface (removal of affected-items tuple) and to remove now-unused wrapper parameters in mocks and assertions.
  • CI workflow refinements

    • Test workflow triggers limited to main and feature/** branches, removing release/** and working triggers to reduce unnecessary CI runs (.github/workflows/test.yml).

Bug Fixes

  • Clearer runtime errors for missing allAction entries
    • Previously: a generic thrown Error when an allAction key was not found provided little context.
    • Now: the code constructs a descriptive error message that lists available actions (or indicates none) and logs a contextual object with availableActions and the request parameters before throwing. This reduces friction when diagnosing configuration or registration problems (src/ops/allAction.ts).

Refactoring

  • Remove affected-items plumbing across the codebase
    • Interfaces and option signatures were updated to remove tuple return variants and affected-items propagation (src/Options.ts, src/Operations.ts and related files). This reduces type complexity and unused plumbing.
    • Wrappers, internal logging/comments, and unused parameters (coordinate, registry) were removed where no longer necessary.

Developer Experience

  • Tests and examples updated to align with the simplified API
    • Mocks and test expectations updated to expect single-value returns from action/allAction methods. Tests no longer assert or pass the removed affected-items tuples.
    • Default generics added to error classes reduce verbosity for common usage patterns when location generics are not required (src/errors.ts).

Documentation Updates

  • docs package script updated
    • The docs copy step now calls the docs-template script directly for deterministic local execution (docs/package.json change).

Breaking Changes

  • API change: action/allAction return type
    • The most significant incompatible change in this release is the removal of the affected-items tuple return form from action and allAction methods. Callers must now expect the direct result value (V or V[]) rather than [V, affectedItems].
    • Affected areas: any consumer code that previously relied on the second element of the tuple (affected-items) must be updated to reflect the new return shape or to compute affected items through alternate means if required.

Migration notes

  • To adapt to the new action/allAction API:

    • Update any custom action or allAction implementations to return either a single item (V) or an array of items (V[]) directly instead of [V, affectedItems].
    • Update callers and tests to stop destructuring or indexing into a returned tuple for affected-items — adjust assertions and downstream logic accordingly.
  • To benefit from improved allAction error diagnostics:

    • Ensure allAction handlers are registered under the keys expected by callers. If a key is missing, the thrown error now includes available action keys in the message and detailed logging is emitted prior to throwing.

Performance Enhancements

  • No direct runtime performance changes were the stated goal of these commits. The simplification of return types may remove a small amount of allocation/structural handling when previously building tuples, but no explicit performance micro-optimizations were introduced.

Security Updates

  • No security patches were included in this release beyond routine dependency patch bumps.

Notes

  • This release includes multiple routine package.json/lockfile edits (version bumps, EOF newline normalization) and dependency updates intended to keep the project aligned with the current 4.4.x Fjell ecosystem and to produce reproducible installs/builds.
  • Review consumer code and tests for any reliance on the removed affected-items tuple and update accordingly before upgrading to this release.

If you need pointers to the exact files changed for migration (wrappers, Options/Operations types, or test updates), search for changes in src/ops/allAction.ts, src/ops/action.ts, src/Options.ts, src/Operations.ts and the tests under tests/ops and tests/primary.