Skip to content

[BUG] just check uses wrong path — justfile_directory() resolves incorrectly in imported justfile.base #187

Closed

Description

@gerchowl

Description

The check recipe in justfile.base uses dirname "{{justfile_directory()}}" to locate .devcontainer/scripts/version-check.sh. This path computation is wrong in both contexts where justfile.base is used:

  • Deployed workspace: justfile_directory() returns the project root (where the root justfile lives). dirname of that goes one level above the project, producing a path like /workspace/.devcontainer/scripts instead of /workspace/<project>/.devcontainer/scripts.
  • Devcontainer repo: Same logic produces <parent-of-repo>/.devcontainer/scripts, which also doesn't exist.

Steps to Reproduce

  1. Open a deployed workspace container
  2. Run just check

Expected Behavior

just check locates .devcontainer/scripts/version-check.sh and runs the version check.

Actual Behavior

Error: Could not locate .devcontainer/scripts directory

Environment

  • All deployed workspaces using justfile.base
  • Also fails in the devcontainer repo itself

Additional Context

justfile.gh already uses the correct pattern:

_gh_scripts := source_directory() / "scripts"

source_directory() (available since just 1.27.0) returns the directory of the current source file, not the root justfile. The container installs the latest just release, which is well past 1.27.0.

Possible Solution

Replace line 76 in justfile.base:

# Before (broken):
SCRIPT_DIR="$(cd "$(dirname "{{justfile_directory()}}")/.devcontainer/scripts" && pwd)"

# After (fixed):
SCRIPT_DIR="$(cd "{{source_directory()}}/scripts" && pwd)"

This works correctly in both contexts:

  • Deployed workspace: source_directory() = .devcontainer/ → scripts/ is right there
  • Devcontainer repo: source_directory() = repo root → fails cleanly with "version-check.sh not found" (expected, since the script only exists in deployed workspaces)

Changelog Category

Fixed


  • TDD compliance (see .cursor/rules/tdd.mdc)

Activity

  1. added
    bug
    area:workspace
    effort:small
    semver:patch
    on Feb 24, 2026
  2. self-assigned this
    on Feb 24, 2026
  3. gerchowl commented on Feb 24, 2026

    @gerchowl
    ContributorAuthor

    Design

    Problem: The check recipe uses dirname(justfile_directory()) to locate .devcontainer/scripts/. In both contexts (deployed workspace and devcontainer repo), this resolves one level above the project root, producing invalid paths.

    Solution: Use source_directory() (available since just 1.27.0) — returns the directory of the current source file, not the root justfile. This matches the pattern already used in justfile.gh (_gh_scripts := source_directory() / "scripts").

    Change: Replace line 76 in justfile.base:

    • Before: SCRIPT_DIR="$(cd \"$(dirname \"{{justfile_directory()}}\")/.devcontainer/scripts\" && pwd)"
    • After: SCRIPT_DIR="$(cd \"{{source_directory()}}/scripts\" && pwd)"

    Context behavior:

    • Deployed workspace: source_directory() = .devcontainer/ → scripts/ resolves correctly.
    • Devcontainer repo: source_directory() = repo root → scripts/ = repo/scripts; version-check.sh not present (expected) → fails cleanly with "version-check.sh not found".

    Files: justfile.base (canonical); assets/workspace/.devcontainer/justfile.base is synced via manifest from root.

    Testing: Existing integration tests that run just check in initialized workspaces will verify the fix.

  4. gerchowl commented on Feb 24, 2026

    @gerchowl
    ContributorAuthor

    Implementation Plan

    Issue: #187
    Branch: bugfix/187-fix-just-check-path

    Tasks

    • Replace dirname(justfile_directory()) with source_directory() in check recipe — justfile.base — verify: just sync-workspace runs; integration test for just check passes
  5. gerchowl commented on Feb 24, 2026

    @gerchowl
    ContributorAuthor

    Autonomous Run Complete

    • Design: posted
    • Plan: posted (1 task)
    • Execute: all tasks done
    • Verify: integration tests pass (110), lint pass
    • PR: fix: just check uses wrong path (#187) #189
    • CI: status checks not yet reported on PR — may be pending workflow trigger
  6. added a commit that references this issue on Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:workspacebugeffort:smallsemver:patch

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions