Skip to content

feat(env): þing-01 P1 (#134) — kill the ensemble-dotenv borrow; declared fail-loud entry validation - #137

Merged
Polichinel merged 1 commit into
developmentfrom
feat/thing01-p1-dotenv-kill
Jul 28, 2026
Merged

feat(env): þing-01 P1 (#134) — kill the ensemble-dotenv borrow; declared fail-loud entry validation#137
Polichinel merged 1 commit into
developmentfrom
feat/thing01-p1-dotenv-kill

Conversation

@Polichinel

Copy link
Copy Markdown
Collaborator

Closes #134 (þing-01 P1 — orð_09 §4 commitment, verdict D6; sequenced behind views-models M3/#287, merged — their run.sh now reads the PLATFORM-001 coordinate registry and exports the coordinates; the secret stays the operator slot).

Change

  • The borrow is dead: load_dotenv(dotenv_path=str(self.ensemble_path_manager.dotenv)) (old unfao.py:180) and the dotenv import are deleted. This was the runtime edge of the þing-01 copy-chain (sáttmál S6ii): the manager reaching inside views-models' checkout for its environment. The launcher now declares its env sourcing; this package never loads one.
  • New unfao/appwrite_env.py — the required Appwrite-seam environment, DECLARED: CONNECTION_ENV + PROD_FORECASTS_ENV + UNFAO_ENV (names per the registry's connection/target classes, plus the one operator-issued secret slot), and assert_env_declared() which raises naming every missing variable (empty string counts as missing). Dependency-light by design — importable and testable without views-pipeline-core.
  • All three AppwriteConfig construction sites validate first (prod-forecasts read path, contract-mode unfao store, legacy _save) — no partial config can half-work.

Tests (7 new, tests/test_env_declaration.py)

Borrow-is-dead source guard (load_dotenv/from dotenv/find_dotenv banned; prose may mention the dead borrow); all-missing-names-in-message; only-the-missing named; complete env passes; empty-string counts as missing; declaration↔use drift guard (os.getenv reads in the manager == declared names, and all 3 sites validate); D3 naming-rule guard (exactly one declared secret, by suffix).

Verification

  • 7 new tests green; full suite 269 passed / 44 xfailed / 5 failed — the five known local pyarrow-toolchain byte-parity tests (CI authoritative).
  • Behavior change to note honestly: with an unassembled environment the manager now fails at datastore construction with EnvironmentError naming the variables, where before the borrow could silently paper over it (that papering is exactly what þing-01 retired). The production launcher path is covered by views-models#287's registry export + transitional .env fallback.

Cross-refs: views-models#287 (M3, merged), views-models#280 (retargeting), PLATFORM-001 registry (views-appwrite/docs/ADRs/platform/coordinate_registry.toml).

🤖 Generated with Claude Code

…eclared fail-loud entry validation

The manager no longer reaches into views-models' checkout for its environment
(the load_dotenv(ensemble_path_manager.dotenv) borrow — the runtime edge of the
þing-01 copy-chain, sáttmál S6). The launcher declares its env sourcing
(views-models M3/#287, merged: run.sh reads the PLATFORM-001 coordinate
registry; the secret stays the operator slot); this package now only validates.

New unfao/appwrite_env.py declares the required names (registry connection +
target classes + the one secret slot; dependency-light by design) and
assert_env_declared() raises naming EVERY missing variable (verdict D6) —
called before all three AppwriteConfig constructions. Guards pin the borrow
dead, the declaration↔use match, and the D3 naming rule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Polichinel
Polichinel merged commit 3f10e87 into development Jul 28, 2026
4 checks passed
@Polichinel
Polichinel deleted the feat/thing01-p1-dotenv-kill branch July 28, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant