chore: unify [ERROR] prefixes to public-API-name.function form across common #37
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type
bug
type
config
type
deployment
type
docs
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type
research
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/daw-lua-common#37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
daw-error-standard.md establishes a repo-wide error prefix contract:
using the public API name the caller actually uses (not the internal
file/module structure). During today's cleanup pass this was applied
inconsistently -- some files already match (base64.lua, most of
crypto.lua), others use a colon-separated form without a dot
(decimal.lua, fs/query.lua, fs/dir.lua, fs/file.lua, fs/handle.lua,
fs/temp.lua), and two files omit the function name entirely
(config_parser.lua, uuid.lua).
Affected files
base64.lua and crypto.lua already largely comply and are out of scope.
Open question to resolve first
config_parser.lua and uuid.lua each expose exactly one public function.
Does the standard apply uniformly (prefix always includes the function
name, even for single-function modules), or is a module-name-only
prefix acceptable when there is exactly one public entry point? The
standard document does not currently distinguish this case.
Also in scope
fs/handle.lua's open_read/read_line/read_bytes were re-exported on the
fs/init.lua facade (fs.open_read etc.) ahead of this issue, so the
"use the public facade name, not the internal module path" rule now
applies cleanly to all fs.handle functions without exception.
Acceptance criteria
[ERROR] public.name: message[ERROR] module: message(no function name)Refs
DAW/daw-lua-common -- daw-error-standard.md
Done. All [ERROR] prefixes across the repo now use the public-API-name.function form (fs.read_file:, decimal.add:, etc.), except the documented module-init exception (bare module name when a whole submodule failed to load).
Beyond the pure renaming, this pass also surfaced and fixed three real bugs where a function forwarded another function's error unchanged instead of adding its own context:
Also found: json/decode.lua and json/encode.lua were using json_decode:/json_encode: (underscore-joined) instead of the dot form -- a third, previously unnoticed variant. Fixed to json.decode:/json.encode:.
Side effect: crypto.lua grew past fragjan's 250-line limit during this pass and was split into crypto/init.lua (facade), crypto/hash.lua, and crypto/hmac.lua -- require("daw.common.crypto") is unchanged for callers. The hmac_sha256_hex/hmac_sha256_b64url duplication (near-identical temp-file plumbing) was also consolidated into a shared run_hmac() helper as part of the split.
make test: 391 tests passed under both Lua 5.1 and 5.4. fragjan: 34 files, 711 checks, all clear.
Refs: DAW/daw-lua-common#8 (crypto), DAW/daw-lua-common#30 (namespace migration this built on)