Migrate 2.0.0 errors to daw_error/v1 #9

Closed
opened 2026-08-10 08:37:04 +02:00 by michael · 1 comment
Owner

Goal

Migrate daw-lua-net 2.0.0 to the structured daw_error/v1 return contract before public release.

Session rationale

The session decided to use the current private 2.0.0 transition to introduce structured errors now. daw-lua-net is one of only two repositories already on that breaking line, so it should be aligned with daw-lua-common before the wider module ecosystem adopts 2.x.

Scope

  • Replace returned error strings with valid immutable daw_error/v1 objects on all public failure paths.
  • Preserve existing successful API shapes such as normalized HTTP results; only the error representation changes unless a concrete incompatibility is required by the contract migration.
  • Assign stable machine-readable error code values and correct source identities.
  • Preserve complete nested causes when lower layers return daw_error/v1.
  • Keep errors serializable and free of Lua-only runtime references.
  • Update tests and any Lua binding helpers required for validation/construction.

Acceptance criteria

  • All public failures return nil, <valid daw_error/v1 object>.
  • No public error path requires parsing formatted [ERROR] strings.
  • Propagated lower-level errors are represented through cause rather than string concatenation.
  • Error data remains fully serializable.
  • Tests cover object-based failures and existing network behavior remains unchanged apart from the agreed error representation.
  • make test passes on the Lua versions currently supported by the repository.

Cross-repository context

This migration depends on the finalized daw_error/v1 contract in DAW/daw-contracts and must remain aligned with the parallel DAW/daw-lua-common migration.

## Goal Migrate `daw-lua-net` 2.0.0 to the structured `daw_error/v1` return contract before public release. ## Session rationale The session decided to use the current private 2.0.0 transition to introduce structured errors now. `daw-lua-net` is one of only two repositories already on that breaking line, so it should be aligned with `daw-lua-common` before the wider module ecosystem adopts 2.x. ## Scope - Replace returned error strings with valid immutable `daw_error/v1` objects on all public failure paths. - Preserve existing successful API shapes such as normalized HTTP results; only the error representation changes unless a concrete incompatibility is required by the contract migration. - Assign stable machine-readable error `code` values and correct `source` identities. - Preserve complete nested causes when lower layers return `daw_error/v1`. - Keep errors serializable and free of Lua-only runtime references. - Update tests and any Lua binding helpers required for validation/construction. ## Acceptance criteria - [ ] All public failures return `nil, <valid daw_error/v1 object>`. - [ ] No public error path requires parsing formatted `[ERROR]` strings. - [ ] Propagated lower-level errors are represented through `cause` rather than string concatenation. - [ ] Error data remains fully serializable. - [ ] Tests cover object-based failures and existing network behavior remains unchanged apart from the agreed error representation. - [ ] `make test` passes on the Lua versions currently supported by the repository. ## Cross-repository context This migration depends on the finalized `daw_error/v1` contract in `DAW/daw-contracts` and must remain aligned with the parallel `DAW/daw-lua-common` migration.
Author
Owner

Session 2026-08-10

Migration complete. All public failures in http_client.lua,
ip_utils.lua, and init.lua now return nil, <daw_error/v1 object>
instead of nil, <string>.

  • All public failures return nil, <valid daw_error/v1 object>.
  • No public error path requires parsing formatted [ERROR] strings.
  • Propagated lower-level errors are represented through cause
    rather than string concatenation.
  • Error data remains fully serializable (plain daw_error/v1 tables).
  • Tests cover object-based failures; existing network behavior
    unchanged apart from the error representation. Test suite grew
    42 -> 64 tests across two review rounds (input validation
    hardening, opts.headers type checks, encode_failed cause
    preservation).
  • make test passes on Lua 5.1 and 5.4.

Two team review rounds done during the session; all findings addressed
except the _G.daw_register guard, which stays on the truthy check
(matches the accepted convention already used across daw-lua-common,
see DAW/daw-docs#18 -- not reverted, tracked separately).

Released as v2.1.0 (commit 09a0039, tag v2.1.0). Also updated README.md
(PUBLIC_README_STANDARD.md), added .github/FUNDING.yml,
docs/MIGRATION-DAW-LUA-NET-2.1.md, docs/release-notes-v2.1.0.md.

## Session 2026-08-10 Migration complete. All public failures in `http_client.lua`, `ip_utils.lua`, and `init.lua` now return `nil, <daw_error/v1 object>` instead of `nil, <string>`. - [x] All public failures return `nil, <valid daw_error/v1 object>`. - [x] No public error path requires parsing formatted `[ERROR]` strings. - [x] Propagated lower-level errors are represented through `cause` rather than string concatenation. - [x] Error data remains fully serializable (plain daw_error/v1 tables). - [x] Tests cover object-based failures; existing network behavior unchanged apart from the error representation. Test suite grew 42 -> 64 tests across two review rounds (input validation hardening, opts.headers type checks, encode_failed cause preservation). - [x] `make test` passes on Lua 5.1 and 5.4. Two team review rounds done during the session; all findings addressed except the `_G.daw_register` guard, which stays on the truthy check (matches the accepted convention already used across daw-lua-common, see DAW/daw-docs#18 -- not reverted, tracked separately). Released as v2.1.0 (commit 09a0039, tag v2.1.0). Also updated README.md (PUBLIC_README_STANDARD.md), added .github/FUNDING.yml, docs/MIGRATION-DAW-LUA-NET-2.1.md, docs/release-notes-v2.1.0.md.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-lua-net#9
No description provided.