Skip to content

pklrun: re-resolve PklProject when deps.json is stale (not just absent) #495

Description

@naxty

Summary

pklrun (introduced in #494) auto-runs pkl project resolve only when PklProject.deps.json is absent. It keys off file existence, not freshness — so editing a PklProject's dependencies without deleting deps.json leaves stale resolved deps in place and they are used silently.

This was an explicit, accepted scope decision for #494 (D1: resolve-only-if-missing). This issue tracks closing the staleness gap as a follow-up.

Symptom

  1. Resolve a project once → PklProject.deps.json is created.
  2. Edit PklProject: add / bump / remove a dependencies { ... } entry.
  3. Run formae apply / eval again.
  4. Old resolved deps are used. New dep appears "not found" or pinned to the wrong version. Only fix today is manually rm PklProject.deps.json.

Where

  • pkg/plugin/pklrun/pklrun.goensureProjectResolved checks os.Stat(deps) and returns early if it exists.

Options

  • Compare mtimes: re-resolve when PklProject is newer than PklProject.deps.json.
  • Hash the dependencies block and store/compare alongside deps.json.
  • Escape hatch: a --resolve/--force-resolve flag or FORMAE_PKL_RESOLVE=always env var.

mtime comparison is the cheapest correct default; the env/flag is a useful complement for "always re-resolve" workflows.

Out of scope

Concurrency hardening of the resolve write (parallel applies racing on deps.json) is a separate concern — tracked elsewhere.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions