fix(deploy): re-wrap root .env.sops to host key on staging deploy #101
Merged
syntropicagent opened 3 weeks ago

The committed root .env.sops is encrypted to dev keys only. Every staging deploy runs git reset --hard, restoring that dev-key-only file and breaking runtime secret decryption for tools like services.migration on the staging host.

Fix: after decrypting the staging env (deploy/staging/.env.staging.sops → host key), the deploy script re-wraps it to the host's age key as root .env.sops. Runtime tooling then always works post-deploy, regardless of what git reset restored.

Also unblocks: KI-1 investigation on staging (needs migrations/CLIs to run with real secrets).

Commits were merged into target branch
  • fix(deploy): re-wrap root .env.sops to host key on staging deploy
    The committed root .env.sops is encrypted to dev keys only, and git
    reset restores it on every deploy — leaving runtime tooling
    (services.migration, CLIs) unable to decrypt secrets on the staging
    host. After decrypting the staging env, re-wrap it to this host's age
    key so post-deploy operations work.
    
    Co-authored-by: Syntropic Agent <syntropic-agent@kokonut.network>
    3 weeks ago
  • fix(seeds): align harvest_event plot_id with crop_cycle plot (KI-1)
    seed 002 was written against an older farm layout (Plot A/B/C with
    maize/cassava/beans) and half-updated when 001_pilot_farm moved to the
    syntropic design (lettuce/passion fruit/coconut/yam/eggs on Syntropic
    Beds, Agroforestry Corridor, Poultry Loop). The validate_operational_
    context() trigger correctly rejected harvest_events whose plot_id
    differed from their crop cycle's plot:
    
    - c07/c08 (Coconut Establishment, cycle 43): plot 022 -> 021
    - c09/c10 (Indian Yam Cycle 1, cycle 44): plot 022 -> 020
    
    Also rewrote all activity/expense/loss/observation descriptions to tell
    one coherent story matching the current farm design.
    
    Fixes KI-1.
    
    Co-authored-by: Syntropic Agent <syntropic-agent@kokonut.network>
    3 weeks ago
    fix(seeds): canonical consent before published stakeholder feedback
    seed 029 inserts published stakeholder_feedback, but the 228 consent
    enforcement trigger requires an effective canonical consent grant for
    the party first — and the Adelphi operator party is only defined in
    seed 105, which runs later alphabetically. Create the party and the
    two consent grants (public_summary + stakeholder_feedback_review,
    location-scoped) idempotently at the top of seed 029.
    
    Also: env.py _sops_decrypt now tries both sops envelope formats
    (plain for JSON-envelope files, --input-type dotenv for dotenv-envelope
    files) instead of assuming one.
    
    Verified on a fresh throwaway database: all 463 migrations+seeds apply
    cleanly; then applied to staging (115 remaining seeds, 0 failures).
    
    Co-authored-by: Syntropic Agent <syntropic-agent@kokonut.network>
    3 weeks ago
  • fix(secrets): successful empty sops output is valid, not a retry trigger
    The dual-attempt decrypt treated empty stdout as a failed attempt,
    which broke the placeholder-credentials test flow (mock sops succeeds
    with empty output; production validation should then reject the
    placeholder env vars). A zero-exit run now returns its stdout
    immediately; only non-zero exits trigger the format fallback.
    
    Verified: reproduces the CI test scenario locally — SecretLoadError
    'placeholder environment value is not allowed' raised as expected.
    
    Co-authored-by: Syntropic Agent <syntropic-agent@kokonut.network>
    3 weeks ago
  • syntropicagent merged 3 weeks ago (merge commit: 5da54aff )
1/1
Submitter syntropicagent
Target main
Source fix/staging-root-env-rewrap
Jobs
Merge Strategy
Create Merge Commit
Watchers (1)
Reference
pr KI-101
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover