fix: lang.resolve_lang pulls os.getenv directly -- violates DAW architecture #8
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/documentation
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type/refactor
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-modul-berhtjan-core#8
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?
Problem
lang.resolve_langcallsos.getenv("LC_ALL")andos.getenv("LANG")directly. This violates the DAW architecture principle:
Only main is responsible for the environment. Modules receive what
they need via parameters -- they never reach out to the environment
themselves.
This also makes the function untestable without mocking the OS.
Fix
Remove os.getenv calls from resolve_lang. The caller (main) reads
the environment and passes the lang/locale via ctx:
ctx.lang or ctx.user_locale must be set by main before calling resolve_lang.
If no locale is available, main passes a default -- not the module.
See also
Clarification: os.getenv belongs in sys.lua only. sys reads the environment and passes values to config or main. Modules receive lang/locale via ctx -- never via os.getenv directly.
Final clarification: os.getenv belongs in bin/wrapper only. The wrapper reads the OS environment (including LANG/LC_ALL for language fallback) and builds the ctx before calling main. sys.lua provides the getenv wrapper function. Modules and config.lua never call os.getenv directly.