Skip to content

fix: re-enable pre-commit in devcontainer#5779

Open
prql-bot wants to merge 6 commits intomainfrom
fix/devcontainer-pre-commit
Open

fix: re-enable pre-commit in devcontainer#5779
prql-bot wants to merge 6 commits intomainfrom
fix/devcontainer-pre-commit

Conversation

@prql-bot
Copy link
Copy Markdown
Collaborator

@prql-bot prql-bot commented Apr 7, 2026

Summary

  • Re-enables pre-commit installation in the devcontainer postCreateCommand, which was disabled due to Field Report from using Vite build... #3709 (now closed)
  • The install-python-deps command now runs task install-maturin && task install-pre-commit && pre-commit install-hooks as originally intended

Closes #5768

🤖 Generated with Claude Code

The pre-commit installation was disabled referencing #3709, which has
since been closed. Re-enable it.

Closes #5768

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator Author

@prql-bot prql-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task install-pre-commit doesn't exist — there's no such task defined in Taskfile.yaml (or anywhere else in the repo). The original commented-out line had this same nonexistent command, so re-enabling it as-is will cause the postCreateCommand to fail during devcontainer setup.

The setup-dev task (Taskfile.yaml:89) runs pre-commit install-hooks directly — no wrapper task. The devcontainer line should probably just do the same.

The `install-pre-commit` task doesn't exist in Taskfile.yaml. The
`setup-dev` task runs `pre-commit install-hooks` directly, so the
devcontainer should do the same.

Co-Authored-By: Claude <noreply@anthropic.com>
Just install pre-commit so `pre-commit run -a` works, without
pre-downloading all hook environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@max-sixty
Copy link
Copy Markdown
Member

@prql-bot why doesn't CI test for the devcontainer? can we adjust this so it does?

@prql-bot
Copy link
Copy Markdown
Collaborator Author

prql-bot commented Apr 7, 2026

The build-devcontainer job only triggers when Dockerfiles, the build workflow, or Taskfile.yaml change — devcontainer.json itself isn't in the trigger list. So changes to postCreateCommand (like this PR) don't get tested.

The existing smoke test in build-devcontainer.yaml builds the base Docker image and runs cargo test + mdbook build inside it, but never exercises the postCreateCommand steps from devcontainer.json.

Two options to fix this:

Option A — Add devcontainer.json to the trigger paths and test postCreateCommand in the base image. Add .devcontainer/devcontainer.json to the devcontainer-build path filter, then add a step that runs the postCreateCommand commands (task install-maturin && uv tool install pre-commit, task install-npm-dependencies) inside the base image container. This is lightweight but doesn't test devcontainer features (Python, Node, go-task, etc. are installed via features, not the base image).

Option B — Use devcontainers/ci to build the full devcontainer. The devcontainers/ci action can build and run the full devcontainer including features and postCreateCommand. This tests the actual developer experience but is heavier (installs all features from scratch each time).

I'd lean toward Option A as a pragmatic first step — it would have caught the task install-pre-commit issue in this PR. Want me to implement one of these?

@max-sixty
Copy link
Copy Markdown
Member

can we try B?

Use the devcontainers/ci action to build and test the full devcontainer
including features and postCreateCommand. Also add devcontainer.json to
the path filter so changes to it trigger the test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prql-bot
Copy link
Copy Markdown
Collaborator Author

prql-bot commented Apr 8, 2026

Done — added a test-devcontainer job that uses devcontainers/ci to build the full devcontainer (base image + features + postCreateCommand) and verify that key tools are available (task, pre-commit, cargo, node). Also added devcontainer.json to the path filter so changes to it trigger the test.

The devcontainer's postCreateCommand runs `task install-maturin` which
calls `uv tool install maturin`, but `uv` isn't installed by any
devcontainer feature. Install it via pip first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prql-bot
Copy link
Copy Markdown
Collaborator Author

prql-bot commented Apr 8, 2026

The test-devcontainer job failed because uv isn't installed in the devcontainer — task install-maturin calls uv tool install maturin but no feature provides uv. This was a pre-existing issue (the install-maturin step would also fail without uv), just not caught because the existing build-devcontainer job doesn't exercise postCreateCommand.

Pushed a fix that installs uv via pip install uv before running the tasks that need it.

pip install fails because the devcontainer Python is marked as
externally managed. Use pipx instead, which creates an isolated venv.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

devcontainer: pre-commit disabled referencing closed issue #3709

2 participants