Migrate to daw-lua-common 2.0.0 #6

Closed
opened 2026-07-21 20:42:12 +02:00 by michael · 1 comment
Owner

Goal

Migrate daw-lua-net to daw-lua-common 2.0.0.

Changes

  • Submodule lib/daw/common updated to v2.0.0
  • http_client.lua: removed pcall around json.decode (no longer
    throws in 2.0.0), fallback-to-raw behavior on non-JSON responses
    preserved
  • http_client.lua: json.encode failure now explicitly checked
    and returned as nil, err instead of relying on the old
    throw-on-failure behavior
  • http_client.lua: [ERROR] http_client.<func>: prefixes added
    per daw-error-standard.md (previously missing / used a generic
    [ERROR] net: prefix)
  • http_client.lua: get/post/put now return a single result table
    { body, status, headers }, nil instead of three positional
    values (body, status, nil) -- see DAW/daw-lua-net#5 for the
    underlying standard change
  • File header comment path corrected (http_client.lua, was a
    stale src/daw/lua/common/http_client.lua reference)
  • test/test_http_client.lua adapted to new return shape

Verification

  • fragjan code . -- 5 files, 122 checks, all clear
  • make test -- Lua 5.4, all 20 tests passed
  • make test with DAW_LUA_VERSION = 5.1 -- all 20 tests passed

Migration guide: DAW/daw-lua-common MIGRATING-2.0.md

## Goal Migrate daw-lua-net to daw-lua-common 2.0.0. ## Changes - [x] Submodule `lib/daw/common` updated to v2.0.0 - [x] `http_client.lua`: removed `pcall` around `json.decode` (no longer throws in 2.0.0), fallback-to-raw behavior on non-JSON responses preserved - [x] `http_client.lua`: `json.encode` failure now explicitly checked and returned as `nil, err` instead of relying on the old throw-on-failure behavior - [x] `http_client.lua`: `[ERROR] http_client.<func>:` prefixes added per daw-error-standard.md (previously missing / used a generic `[ERROR] net:` prefix) - [x] `http_client.lua`: `get/post/put` now return a single result table `{ body, status, headers }, nil` instead of three positional values (`body, status, nil`) -- see DAW/daw-lua-net#5 for the underlying standard change - [x] File header comment path corrected (`http_client.lua`, was a stale `src/daw/lua/common/http_client.lua` reference) - [x] `test/test_http_client.lua` adapted to new return shape ## Verification - [x] `fragjan code .` -- 5 files, 122 checks, all clear - [x] `make test` -- Lua 5.4, all 20 tests passed - [x] `make test` with `DAW_LUA_VERSION = 5.1` -- all 20 tests passed ## Related - DAW/daw-lua-net#5 (HTTP return-shape standard change) - DAW/steurjan#144 (call-site adaptation, separate rollout) Migration guide: DAW/daw-lua-common MIGRATING-2.0.md
Author
Owner

Final status update -- released as v2.0.0

Since this issue was opened, the review process surfaced significantly more
than the original checklist:

  • ip_utils.lua: ip_matches_cidr, is_ip_allowed, and get_client_ip now fail
    closed on malformed/unverifiable input (nil, err) instead of the previous
    silent 0/false/hardcoded-127.0.0.1 behavior (see DAW/daw-lua-net#3).
    get_client_ip requires request.remote_addr and takes an optional
    trusted_proxies parameter.
  • All public functions across the library now return an explicit
    result, nil | nil, err (including true, nil / false, nil for predicates).
  • init.lua rebuilt around the module_stub()/load_submodule() facade
    pattern shared with daw.common/init.lua.
  • http_client.lua: get_raw() aligned to the same
    { body, status, headers }, nil | nil, err contract as get/post/put
    (previously body, status, err) -- no more return-shape exception in the
    library.
  • Test suite grown from 20 to 42 tests (14 http_client, 28 ip_utils),
    including full coverage of the new fail-closed and get_raw() behavior.
  • README updated to match.

fragjan clean, make test green on Lua 5.1 and 5.4. Tagged and pushed as
v2.0.0.

Refs: DAW/daw-lua-net#3, DAW/daw-lua-net#5, DAW/daw-lua-common#39

## Final status update -- released as v2.0.0 Since this issue was opened, the review process surfaced significantly more than the original checklist: - ip_utils.lua: ip_matches_cidr, is_ip_allowed, and get_client_ip now fail closed on malformed/unverifiable input (nil, err) instead of the previous silent 0/false/hardcoded-127.0.0.1 behavior (see DAW/daw-lua-net#3). get_client_ip requires request.remote_addr and takes an optional trusted_proxies parameter. - All public functions across the library now return an explicit result, nil | nil, err (including true, nil / false, nil for predicates). - init.lua rebuilt around the module_stub()/load_submodule() facade pattern shared with daw.common/init.lua. - http_client.lua: get_raw() aligned to the same { body, status, headers }, nil | nil, err contract as get/post/put (previously body, status, err) -- no more return-shape exception in the library. - Test suite grown from 20 to 42 tests (14 http_client, 28 ip_utils), including full coverage of the new fail-closed and get_raw() behavior. - README updated to match. fragjan clean, make test green on Lua 5.1 and 5.4. Tagged and pushed as v2.0.0. Refs: DAW/daw-lua-net#3, DAW/daw-lua-net#5, DAW/daw-lua-common#39
michael 2026-07-25 20:31:03 +02:00
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#6
No description provided.