Skip to content

v3 using chainguard wolfi-base#5

Merged
keiravillekode merged 3 commits into
exercism:mainfrom
keiravillekode:v3-may
May 3, 2026
Merged

v3 using chainguard wolfi-base#5
keiravillekode merged 3 commits into
exercism:mainfrom
keiravillekode:v3-may

Conversation

@keiravillekode
Copy link
Copy Markdown
Contributor

Support interface version 3

https://exercism.org/docs/building/tooling/test-runners/interface

We move from debian to chainguard wolfi-base
to reduce image size.

(Alpine doesn't expose readdir64_r, expected by Factor.)

Each exercise now includes exercism-tools
testing library. This defines

  • STOP-HERE
  • TASK
  • run-exercism-tests

https://github.com/exercism/factor/

has been updated to use this testing library.

We omit some unused files from the factor distribution: we don't need to support interactive help.

Support interface version 3

https://exercism.org/docs/building/tooling/test-runners/interface

We move from debian to chainguard wolfi-base
to reduce image size.

(Alpine doesn't expose readdir64_r, expected by Factor.)

Each exercise now includes exercism-tools
testing library. This defines
- STOP-HERE
- TASK
- run-exercism-tests

https://github.com/exercism/factor/

has been updated to use this testing library.

We omit some unused files from the factor distribution:
we don't need to support interactive help.
@keiravillekode keiravillekode requested a review from a team as a code owner May 2, 2026 09:05
@keiravillekode
Copy link
Copy Markdown
Contributor Author

keiravillekode commented May 2, 2026

The image is now 241 MB, was previously 383 MB

69 MB of the saving is from the move to wolfi-base.

The remaining savings are from trimming the factor distribution.

Comment thread bin/run.sh Outdated
jq -n --arg output "${test_output}" '{version: 1, status: "fail", message: $output}' > ${results_file}
if [[ ! -f "$test_file" ]]; then
jq -n --arg msg "test file not found: ${slug}-tests.factor" \
'{version: 3, status: "error", message: $msg}' >"$results_file"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
'{version: 3, status: "error", message: $msg}' >"$results_file"
'{version: 3, status: "error", message: $msg}' > "$results_file"

Comment thread bin/run.sh Outdated
# Copy the fixture to a fresh temp dir so the rewrite below does not mutate
# the source.
tmp_dir=$(mktemp -d -t "factor-runner-${slug}-XXXXX")
trap 'rm -rf "$tmp_dir"' EXIT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
trap 'rm -rf "$tmp_dir"' EXIT
trap 'rm -rf "${tmp_dir}"' EXIT

Comment thread bin/run.sh Outdated
# the source.
tmp_dir=$(mktemp -d -t "factor-runner-${slug}-XXXXX")
trap 'rm -rf "$tmp_dir"' EXIT
cp -r "${solution_dir}/." "$tmp_dir"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
cp -r "${solution_dir}/." "$tmp_dir"
cp -r "${solution_dir}/." "${tmp_dir}"

Comment thread bin/run.sh Outdated
cp -r "${solution_dir}/." "$tmp_dir"
stripped_tests="${tmp_dir}/${slug}/${slug}-tests.factor"
awk '!/^STOP-HERE$/' "$stripped_tests" > "${stripped_tests}.new"
mv "${stripped_tests}.new" "$stripped_tests"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
mv "${stripped_tests}.new" "$stripped_tests"
mv "${stripped_tests}.new" "${stripped_tests}"

Comment thread bin/run.sh Outdated
raw_output=${raw_output//$tmp_dir/$canonical_root}

# Awk parser shared by all stages: JSON-escape a single string field.
read -r -d '' AWK_JSON <<'AWK' || true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
read -r -d '' AWK_JSON <<'AWK' || true
read -r -d '' AWK_JSON <<' AWK' || true

Comment thread bin/run.sh Outdated
}
state == "inline" && $0 ~ header_re {
close_segment()
idx++; seg_failed = 0; seg_n = 0; delete seg
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason come of these have multiple commands on one line?

Comment thread bin/run.sh Outdated
END { close_segment() }
')

segments=$(printf '%s\n' "$parsed" | awk '/"type":"segment"/' || true)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Variable expansions mostly use {} before here and don't have them after here

Comment thread bin/run.sh Outdated
if [[ -z "$segments" ]]; then
cleaned=$(printf '%s\n' "$raw_output" | awk '/^\([UO]\) /{exit} {print}' \
| awk 'NF { print; blank = 0; next } !blank { print; blank = 1 }')
if [[ -z "$cleaned" ]]; then cleaned="No tests were executed"; fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if [[ -z "$cleaned" ]]; then cleaned="No tests were executed"; fi
[[ -z "$cleaned" ]] && cleaned="No tests were executed"

Comment thread bin/run.sh Outdated
cleaned=$(printf '%s\n' "$raw_output" | awk '/^\([UO]\) /{exit} {print}' \
| awk 'NF { print; blank = 0; next } !blank { print; blank = 1 }')
if [[ -z "$cleaned" ]]; then cleaned="No tests were executed"; fi
jq -n --arg msg "$cleaned" '{version:3, status:"error", message:$msg}' >"$results_file"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
jq -n --arg msg "$cleaned" '{version:3, status:"error", message:$msg}' >"$results_file"
jq -n --arg msg "$cleaned" '{version:3, status:"error", message:$msg}' > "$results_file"

Comment thread Dockerfile Outdated
RUN git clone https://github.com/factor/factor.git && \
cd factor && \
git checkout cd14ceed53f6f9a43bbd3aec3950d8beb5439ed8
git checkout a56e6390e81340be6573cb790311c0a980a5f369
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this commit associated with a release? Would that merit a comment?

@keiravillekode keiravillekode merged commit 8cb65a9 into exercism:main May 3, 2026
1 check passed
@keiravillekode keiravillekode deleted the v3-may branch May 3, 2026 08:44
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.

2 participants