Skip to content

fix: move devcontainer to the shared python_template image (drops emSign G3) - #75

Merged
blooop merged 6 commits into
mainfrom
fix/devcontainer-shared-base
Oct 25, 2026
Merged

blooop merged 6 commits into
mainfrom
fix/devcontainer-shared-base

Conversation

@blooop

@blooop blooop commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

This PR moves the devcontainer to the shared python_template image, so the container no longer trusts emSign ECC Root CA - G3 (CVE-2026-111943).

Evidence

  • Before (main): Ubuntu 22.04.5 LTS, ca-certificates 20260816ubuntu0.22.04.1, pixi 0.48.2. G3 count 0 (the common-utils feature upgrades ca-certificates at build time). pixi run test: 50 passed. After the cold create, git status shows M pixi.lock. Cold dl: 90 s.
  • After (this branch, head a660c8e): Ubuntu 26.04.1 LTS, ca-certificates 20260816ubuntu0.26.04.1, pixi 0.83.0. G3 count 0.
  • After: git status is clean after the cold create (GIT_DIRTY=0). post-create runs pixi install --frozen, so it does not rewrite the lock.
  • After: pixi lock --check passes. pixi run ci passes: ruff check "All checks passed!", 50 tests passed, coverage 82 %.
  • After: pixi run pre-commit (all hooks, all files) passes.
  • After: the Next.js site builds in the container. Node v24.9.0 and npm 11.6.0 come from the pixi nodejs dependency, not from the image. npm ci and npm run build in site/ pass and prerender all /recipe/[id] pages. git status stays clean after the build.
  • Cold dl for a new workspace (image already pulled; create, post-create, dotfiles, pixi run ci): 74 s. Other agents used the host at the same time, so these times are high.

What this changes

  • Deletes .devcontainer/Dockerfile. It built a private image from an old Microsoft base with an old pixi.
  • Copies .devcontainer/ from blooop/python_template main (without ci/): "image": "ghcr.io/blooop/python_template/devcontainer:latest", post-create.sh (seeds known_hosts, runs pixi install --frozen), and claude-code/ (for initializeCommand). The shared image carries pixi, git-lfs, the claude-code feature and the CA fix, so this repo needs no CA block of its own.
  • Removes the common-utils:2 feature. The shared image already has it.
  • devcontainer.json bind-mounts ~/.config/gh from the host. init-host.sh (the initializeCommand) now creates ~/.config/gh as well as ~/.claude. Without it, docker refuses to create the container on a host that has no ~/.config/gh ("bind source path does not exist").
  • The devcontainer.json comments no longer name pixi run dev-use-local, dev-use-prebuilt, a commented build block for the deleted Dockerfile, or a local .devcontainer/ci/devcontainer.json. planthood has none of these. The ci config lives in python_template.
  • Re-locks pixi.lock with pixi 0.83 (format v7), as its own commit. Package versions change. The lock on main did not match pyproject.toml (pixi lock --check fails on main): it still held google-generativeai and its Google API stack after the move to google-genai. The new lock has google-genai 2.33.0 and drops the old stack; pydantic goes to 2.13/2.14. planthood/llm.py imports from google import genai, so the new lock matches the code.
  • Removes pylint; ruff is the only linter and formatter. This removes pylint from the test feature, the pylint task, the lint and ci task chains, [tool.pylint*], the VS Code extension and task text, the dependabot group, the README and docs mentions, and one pylint:disable comment. requirements.txt listed black as the dev formatter; it now lists ruff. In pixi.lock, only pylint and its dependencies (astroid, dill, isort, mccabe, tomlkit) go.
  • Keeps "name": "planthood" as the last key of devcontainer.json, as the template asks.

The lock change does not touch build-and-deploy.yml: that workflow installs with pip install -e . and npm ci, not from pixi.lock. CI ci.yml uses prefix-dev/setup-pixi@v0.9.5 with no pixi-version, so it takes the latest pixi, which reads the v7 lock.

How I checked it

dl blooop/planthood@fix/devcontainer-shared-base -- bash -lc 'grep PRETTY_NAME /etc/os-release; dpkg-query -W ca-certificates; pixi --version; echo G3=$(ls /etc/ssl/certs | grep -c emSign_ECC_Root_CA_-_G3); echo GIT_DIRTY=$(git status --porcelain | wc -l); pixi lock --check; pixi run ci; pixi run pre-commit'
dl blooop/planthood@fix/devcontainer-shared-base -- bash -lc 'cd site && pixi run npm ci && pixi run npm run build && git status -s'
dl blooop/planthood@main -- bash -lc 'grep PRETTY_NAME /etc/os-release; dpkg-query -W ca-certificates; pixi --version; echo G3=$(ls /etc/ssl/certs | grep -c emSign_ECC_Root_CA_-_G3); echo GIT_DIRTY=$(git status --porcelain | wc -l); pixi run test'
HOME=<empty dir> devcontainer up   # failed with "bind source path does not exist" before the init-host.sh fix, passes after

I did not run the scrape, extract or enrich pipeline stages against the live site or an LLM. The tests cover extract, enrich, schedule and quality on fixtures.

Merge danger

Door: two-way. A revert brings back the old Dockerfile, the old lock and pylint.
Blast radius: small. The new lock changes the package versions that CI and the dev environment install; the tests pass on it. The package code does not change.

Review notes

  • The copy drops two VS Code extensions that main had: GitHub.copilot and ryanluker.vscode-coverage-gutters. A copy that adds them back differs from the template.
  • post-create.sh still calls planthood "this template".
  • Most claude-code/ files (install.sh, README.md, TROUBLESHOOTING.md, devcontainer-feature.json, about 1000 lines) do nothing here: no features block uses them. Only init-host.sh runs.

🤖 Generated with Claude Code

The shared image carries the ca-certificates fix that drops emSign ECC
Root CA - G3 (CVE-2026-111943). Port python_template's .devcontainer/
and delete the private Dockerfile.
The lock on main no longer matched pyproject.toml, so pixi re-solved it
in post-create and every new dl workspace started dirty. This lock is
the pixi 0.83 solve (format v7); some package versions change.
post-create now runs `pixi install --frozen`, so a new dl workspace
does not rewrite pixi.lock.
@sourcery-ai

sourcery-ai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Sorry @blooop, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 1 hour by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR switches development environments from a repository-built, outdated base image to the shared Python template image, inheriting its CA trust remediation and tooling while adding template-compatible post-create and Claude Code setup. It also regenerates pixi.lock with pixi 0.83 to match the current project dependencies and uses frozen installation to keep container creation clean and reproducible.

Sequence diagram for reproducible devcontainer creation

sequenceDiagram
    actor Developer
    participant DevContainer as Devcontainer
    participant Image as SharedImage
    participant PostCreate as post-create.sh
    participant Pixi as pixi

    Developer->>DevContainer: Create workspace
    DevContainer->>Image: Pull ghcr.io/blooop/python_template/devcontainer:latest
    Image-->>DevContainer: pixi and shared tooling available
    DevContainer->>PostCreate: Run post-create.sh
    PostCreate->>PostCreate: Seed known_hosts
    PostCreate->>Pixi: install --frozen
    Pixi-->>PostCreate: Install committed lockfile
    PostCreate-->>DevContainer: Clean reproducible workspace
Loading

Flow diagram for host Claude Code configuration

flowchart LR
    Host["Host ~/.claude"] -->|initializeCommand creates directory| Mount["Read-write bind mount"]
    Mount --> Container["/home/vscode/.claude"]
    Container --> Claude["Claude Code"]
    Claude -->|reads and refreshes credentials| Mount
Loading

File-Level Changes

Change Details Files
Replaces the repository-built development container with the shared Python template image and template-managed lifecycle configuration.
  • Deletes the private Dockerfile and common-utils feature dependency.
  • Adds the shared image reference, frozen post-create installation, SSH host-key seeding, and optional task execution.
  • Adds host initialization and the local Claude Code feature configuration used by the shared image.
  • Preserves the repository name metadata expected by the template.
.devcontainer/Dockerfile
.devcontainer/devcontainer.json
.devcontainer/post-create.sh
.devcontainer/claude-code/devcontainer-feature.json
.devcontainer/claude-code/init-host.sh
.devcontainer/claude-code/install.sh
.devcontainer/claude-code/README.md
.devcontainer/claude-code/TROUBLESHOOTING.md
Removes the vulnerable emSign G3 trust path by inheriting the shared image's updated OS, CA certificates, and tooling.
  • Moves the base environment to the shared Ubuntu 26.04 image with updated CA certificates and pixi.
  • Relies on the shared image for the CA remediation, git/common utilities, and Claude Code feature rather than rebuilding them locally.
.devcontainer/devcontainer.json
.devcontainer/Dockerfile
Regenerates the pixi lockfile with pixi 0.83 and aligns dependency resolution with the current project configuration.
  • Migrates the lockfile to format v7.
  • Replaces the obsolete google-generativeai dependency stack with google-genai and updates related package versions, including pydantic.
pixi.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

devcontainer.json bind-mounts ~/.config/gh, but initializeCommand only
created ~/.claude, so docker refused the mount (bind source path does not
exist) for anyone who never ran gh on the host. Not testable in the suite;
reproduced with devcontainer CLI up against an empty HOME, red before and
green after.
The copied comments said to run `pixi run dev-use-local` and
`dev-use-prebuilt`, kept a commented build block for the Dockerfile this
PR deletes, and pointed at .devcontainer/ci/devcontainer.json. None of
those exist in planthood; the ci config lives in python_template.
The user lints and formats with ruff only. Drop pylint from the test
feature, the pylint task, the lint and ci task chains and [tool.pylint*],
the VS Code extension and task text, the dependabot group, the README and
docs mentions and the one pylint:disable comment. requirements.txt listed
black as the dev formatter; it now lists ruff. pixi.lock re-locked with
pixi 0.83: only pylint and its deps (astroid, dill, isort, mccabe,
tomlkit) leave it.
@blooop
blooop merged commit 42d2879 into main Oct 25, 2026
8 checks passed
@blooop
blooop deleted the fix/devcontainer-shared-base branch October 25, 2026 21:16
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.

1 participant