Skip to content

env sync prints a full add plan but writes no files in a synthetic project #184

Description

@fentas

Observation, not a diagnosis — I could not explain it and it reproduces on shipped v4.18.5, so it is unrelated to #182.

Repro

```bash
mkdir -p /tmp/p/.bin && cd /tmp/p
printf 'binaries: {}\n' > .bin/b.yaml
b -c /tmp/p/.bin/b.yaml env add 'git@github.com:owner/repo#someprofile'
b -c /tmp/p/.bin/b.yaml update --envs-only
```

What happens

  • The plan renders correctly: `(new) → ` followed by `+ add` rows for all 243 files.
  • No files are written anywhere — not under the project root, not under the config dir. Only `.bin/b.lock` appears.
  • `.bin/b.lock` records a `sha256` for `.bin/b.yaml` that does not match the file on disk, i.e. a hash was computed for content that was never written.
  • With `-y --safety auto`, every row flips from `add` to `keep` (243 keep) and still nothing is written.
  • Same with and without `git init` in the project.
  • A watcher polling the target file every 20ms across the whole sync sees no modification at all.

Tracing `SyncEnv`, a first sync has no previous lock entry, so `localChanged` stays false and the `!localChanged` branch should call `writeFile` whenever the target hash differs from on-disk (pkg/env/env.go:437-442) — which it does here. So I expected a write. I did not get far enough to say which guard actually skips it.

Possibly just a missing piece of setup on my side (`PATH_BASE`-style dest root, or something `env add` normally records that I did not). Filing because the failure is silent: a plan claiming 243 adds while writing nothing is indistinguishable from success in a script.

Component behaviour is fine — `filterContent` + `spliceYAML` on a real config with real selectors produce exactly the right bytes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions