Skip to content

Sampler: pass template names newline-separated so spaced account template names survive - #36

Closed
michieldegezelle wants to merge 7 commits into
mainfrom
sampler-report-link-and-diffs-folder
Closed

Sampler: pass template names newline-separated so spaced account template names survive#36
michieldegezelle wants to merge 7 commits into
mainfrom
sampler-report-link-and-diffs-folder

Conversation

@michieldegezelle

@michieldegezelle michieldegezelle commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Account template identifiers are directory names and routinely contain spaces (account_templates/Investment- and depreciation details). The handles / account_templates inputs were documented and encoded as space-separated strings, then deliberately word-split into CLI args — so -at received Investment-, and, depreciation, details and the run died:

[error] Config file for account template "Investment-" not found

Hit live in lu_market: https://github.com/silverfin/lu_market/actions/runs/30612771053 (the PR under review changed exactly one file, inside that template).

Change

Both inputs are now one name per line, and the arg arrays are built with mapfile so each line becomes exactly one argv entry. This is already the convention in this repo's own run_tests.yml (TEMPLATE_BUCKETS, with a comment saying why) — the sampler was the only place that regressed to space-joining. firm_ids stays space-separated; it's numeric, so the SC2086 split there is still intentional.

Two supporting bits in the same area:

  • The attempt log line is %q-quoted, so a name containing spaces is visibly one argument.
  • The PR comment renders the names as individually code-quoted, comma-separated entries — a multi-line value inside one backtick pair renders as garbage.

⚠️ Input contract change for callers

A caller still passing a space-joined list now fails loudly (Config file for account template "..." not found) instead of silently sampling templates nobody asked for. I deliberately did not add a space-splitting fallback: for names containing spaces it cannot be made correct, and the loud failure is the honest outcome.

Input descriptions and the README input list are updated to say one per line. The only callers today are the lu_market / nl_market wrappers, which currently run inlined forks of this job (pinned to silverfin-cli's unmerged sampler-compact-diff-v2 branch); their matching fixes are silverfin/lu_market#784 and silverfin/nl_market#913. When those forks are reverted to uses: after silverfin-cli #265 merges, this fix means they don't regress — but the newline-emitting classify half lives in the market repos, so the two halves must land together.

Testing

The name-splitting logic was verified in bash against the real lu_market names (Investment- and depreciation details + Loan details → 3 argv entries, spaces intact); YAML validated. Not yet exercised in a live sampler run — see the market PRs for that.

🤖 Generated with Claude Code

michieldegezelle and others added 7 commits July 28, 2026 14:21
The presigned report_url expires ~5 minutes after the run completes (see
silverfin-cli's CI_AUTH_SAMPLER_PLAN.md §10.4), so the "Open full sampler
report" link posted on the PR is essentially always dead by the time a
reviewer clicks it. Link to the GitHub Actions artifact instead (valid for
the full 7-day retention window), falling back to the presigned URL only if
the artifact upload itself didn't happen.

Also adds a diffs/ folder to the uploaded results.zip containing before/after
view.html only for the entries the compact diff flagged, via silverfin-cli's
new run-sampler --from-zip --add-diffs-folder (silverfin-cli#265) - lets a
reviewer open just the changed entries instead of the full archive.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add diffs/ folder step now sets an output flag and echoes ::warning::
  on failure instead of silently swallowing it via continue-on-error,
  matching the sibling download step's pattern.
- Pin the silverfin-cli install to a commit that actually has
  --add-diffs-folder (it isn't on main yet); previously this workflow
  called a flag that main doesn't have.
- Add a final fallback line when neither artifactUrl nor reportUrl is
  set, and note the artifact link requires GitHub sign-in.
- Sync README's run_sampler.yml section, which described the old
  report-URL-primary priority and didn't mention the diffs/ step.

Addresses review feedback from PR #35.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
If the token write-back step above it fails, the default success()
guard would skip this download even when report_url is set. Addresses
CodeRabbit feedback on PR #35.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
diffs_added was set but never consumed downstream, so a reviewer had
no way to know the diffs/ folder was missing from the artifact short
of digging through Actions logs. Addresses re-review feedback on
PR #35.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
actions/github-script@v7 targets Node 20, which GitHub Actions now
forces onto Node 24 with a deprecation warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
Account template identifiers are directory names and routinely contain
spaces ("Investment- and depreciation details"). The sampler encoded the
handles/account_templates inputs as space-separated strings and then
word-split them into CLI args, so -at received "Investment-", "and",
"depreciation", "details" and the run died with:

  [error] Config file for account template "Investment-" not found

Switch both inputs to one-name-per-line and build the arg arrays with
mapfile, so each line becomes exactly one argv entry. This is already the
convention in run_tests.yml (TEMPLATE_BUCKETS) — the sampler was the only
place that regressed to space-joining. firm_ids stays space-separated;
it's numeric.

Also render the names in the PR comment as individually code-quoted,
comma-separated entries (a multi-line value inside one backtick pair
renders as garbage) and %q-quote the attempt log line so a spaced name is
visibly one argument.

Callers must now pass these inputs newline-separated — README and the
input descriptions updated accordingly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Changes

Sampler workflow

Layer / File(s) Summary
Newline-delimited sampler inputs
.github/workflows/run_sampler.yml, README.md
The workflow accepts each handle and account-template name as one newline-delimited argument. The CLI installation uses a pinned commit. Attempt logs quote argument boundaries.
Result download and artifact enrichment
.github/workflows/run_sampler.yml, README.md
Failed workflows download results when a report URL exists. The workflow adds a best-effort diffs/ folder and uploads the artifact after a successful download.
Pull request result reporting
.github/workflows/run_sampler.yml
Pull request comments prefer the seven-day artifact link, report enrichment failures, and use the presigned report URL only as a fallback.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the changes and testing, but it omits the required template sections for issue linkage, change type, and checklist. Add the required Description, Fixes #, Type of change, and Checklist sections, and mark the applicable options.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: newline-separated template names that preserve spaces.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sampler-report-link-and-diffs-folder

Comment @coderabbitai help to get the list of available commands.

@michieldegezelle michieldegezelle changed the title Sampler: durable report link, diffs-only zip folder, and newline-separated template names Sampler: pass template names newline-separated so spaced account template names survive Aug 4, 2026
@michieldegezelle

Copy link
Copy Markdown
Collaborator Author

Superseded by #37 — same one-commit fix, but branched off current main so the PR carries only the newline-separated-template-names change. This branch was the already-merged sampler-report-link-and-diffs-folder branch reused, which made the commit list look like it re-contained the work merged in the July 29 PR.

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