Skip to content

Add a CLI regression test target - #330

Closed
1a1a11a wants to merge 5 commits into
claude/polish-4-registry-hashpowerfrom
claude/polish-5-cli-tests
Closed

1a1a11a wants to merge 5 commits into
claude/polish-4-registry-hashpowerfrom
claude/polish-5-cli-tests

Conversation

@1a1a11a

@1a1a11a 1a1a11a commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Part 5 of 5, split out of #324. Stacked on #329 — the diff shown here is against that branch; merge #328 and #329 first.

Two files: test/test_cli.sh and its test/CMakeLists.txt wiring, as a new testCLI ctest target. 174 checks over ground nothing covered before.

Why a shell target rather than more C unit tests

The existing C tests build caches in-process. Every bug fixed in #328 and #329 lives in the path between the command line and that point — argp callbacks, parameter parsing, the -e print early exit — or only becomes visible when a binary runs to completion. So this drives the actual binaries.

Two design choices carried most of the value:

  • It sweeps all 45 registered algorithms rather than a hand-picked list. That is how the s3fifov0 and flashProb crashes were found; both were absent from every list I would have written by hand.
  • It replays a trace with each algorithm rather than only parsing parameters. That is what surfaces the missing frees: -e print calls exit(0) before teardown, and LeakSanitizer still counts that memory as reachable, so a parse-only test sees nothing.

Invalid input is asserted to fail cleanly — non-zero with a message, but not SIGSEGV, SIGFPE or SIGBUS. The project's ERROR() aborts, so a deliberate rejection has to stay distinguishable from a crash, and several of these bugs presented as exactly that difference.

Coverage

  • the option forms that were crashing: space-separated -o, --verbose, -e print for every algorithm
  • SLRU n-seg at 0/-1/4/16/20 and seg-size empty / 0:0 / 24 entries
  • SHARDS at sample rates 1, 0.999, 0.5 and 0.0001, plus FIX_SIZE — rate 1 is the undefined-behavior case, where UINT64_MAX * sample_rate rounds to 2^64 and overflows the cast
  • MINISIM asserted equal to cachesim on unsampled runs, not merely exiting 0, so the size-scaling bug cannot come back quietly
  • belady and beladySize accepted on oracle traces and rejected on others
  • --hashpower at 4, 5, 6 and 8 across the composite policies
  • wtinyLFU --consider-obj-metadata=true, which used to segfault
  • a string-id csv asserting the miss ratio that four distinct objects in six requests produce, so a regression to obj_id = 0 fails the test rather than returning a believable number

Are the tests load-bearing?

Green tests prove nothing on their own, so I checked the other direction: reverting the six originally-fixed sources to their previous state and rebuilding gives 16 failures, and 0 with them restored.

Testing

ctest --output-on-failure10/10, both plain Release and under -fsanitize=leak with CI's ASAN_OPTIONS.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c8b06a379

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh Outdated
Comment on lines +175 to +179
ALL_ALGOS="2q 3LCache CAR GLCache RandomLRU arc arcv0 cacheus clock clock2qplus
clockpro fifo fifo-merge fifo-reinsertion fifomerge flashProb gdsf gl-cache
lecar lecarv0 lfu lfucpp lfuda lhd lirs lrb lru lru-k lru-prob nop
pluginCache qdlp random randomTwo s3-fifo s3-fifov0 s3fifo s3fifod s3fifov0
sieve size slru slruv0 tinyLFU twoq wtinyLFU"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add the omitted registered algorithms to the sweeps

ALL_ALGOS omits hyperbolic, belady, and beladySize, although all three are registered in libCacheSim/cache/cacheAlgoRegistry.c and the selected oracle trace makes the Belady policies valid. Consequently, neither the -e print sweep nor the replay sweep exercises their cachesim initialization and teardown paths, so regressions in these built-in algorithms can pass this target despite the stated all-algorithm coverage; the later Belady MINISIM checks exercise a different executable path and do not close this gap.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new CLI-focused regression test to the test/ suite to exercise end-to-end argument parsing and “run to completion” behavior that isn’t covered by in-process C unit tests. This fits into the codebase’s CTest-driven testing by introducing a testCLI target that runs a shell script from the build directory.

Changes:

  • Add test/test_cli.sh, a bash-based regression suite that drives cachesim, traceAnalyzer, and mrcProfiler across many option/parameter combinations.
  • Wire the script into CTest as a new testCLI test via test/CMakeLists.txt.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
test/test_cli.sh New bash regression suite that runs CLI binaries and asserts clean failures vs crashes across many parameter/option cases.
test/CMakeLists.txt Registers the new testCLI CTest target to run the shell regression suite from the build directory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/test_cli.sh Outdated
Comment on lines +175 to +179
ALL_ALGOS="2q 3LCache CAR GLCache RandomLRU arc arcv0 cacheus clock clock2qplus
clockpro fifo fifo-merge fifo-reinsertion fifomerge flashProb gdsf gl-cache
lecar lecarv0 lfu lfucpp lfuda lhd lirs lrb lru lru-k lru-prob nop
pluginCache qdlp random randomTwo s3-fifo s3-fifov0 s3fifo s3fifod s3fifov0
sieve size slru slruv0 tinyLFU twoq wtinyLFU"
Comment thread test/CMakeLists.txt
Comment on lines +66 to +68
add_test(NAME testCLI
COMMAND ${CMAKE_COMMAND} -E env bash ${CMAKE_CURRENT_SOURCE_DIR}/test_cli.sh
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
Comment thread test/test_cli.sh Outdated
TRACE_CSV="${DATA_DIR}/cloudPhysicsIO.csv"
TRACE_TXT="${DATA_DIR}/cloudPhysicsIO.txt"

WORK_DIR=$(mktemp -d)
@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from 720f1d5 to aa99429 Compare August 13, 2026 17:50
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 3c8b06a to 803fa29 Compare August 13, 2026 17:50

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 803fa298de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh
Comment on lines +112 to +115
elif ! grep -qi "error" <<<"${out}"; then
_report 1 "${desc} failed without an error message (exit ${rc})"
else
_report 0 ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject sanitizer diagnostics before accepting clean errors

When this suite is run against an AddressSanitizer build, a segfault is typically converted into exit code 1 with output containing ERROR: AddressSanitizer; this branch therefore counts the crash as a clean rejection solely because the output contains “error.” That allows the invalid-input crash regressions this helper is intended to detect to pass under a common diagnostic configuration, so sanitizer error signatures should be checked before the generic message check.

Useful? React with 👍 / 👎.

Comment thread test/CMakeLists.txt Outdated
# The script prints SKIP: and exits 0 when the binaries or sample traces are
# absent. Without this, ctest reports that as a pass, so a run that tested
# nothing looks the same as a run that tested everything.
set_tests_properties(testCLI PROPERTIES SKIP_REGULAR_EXPRESSION "^SKIP:")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve compatibility with the declared CMake minimum

On CMake 3.12–3.15, which the root cmake_minimum_required(VERSION 3.12) explicitly supports, SKIP_REGULAR_EXPRESSION is unavailable because CMake introduced this test property in 3.16. Consequently, a missing-binary or missing-data run exits zero and is reported as passed rather than skipped on those supported versions; either raise the minimum to 3.16 or use a skip mechanism available in 3.12.

Useful? React with 👍 / 👎.

@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from aa99429 to cddf41e Compare August 13, 2026 18:07
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 803fa29 to dbe53fc Compare August 13, 2026 18:07

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbe53fcc0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh

n_skipped=0
for algo in ${ALL_ALGOS}; do
out=$("${BIN_DIR}/cachesim" "${TRACE_ORACLE}" oracleGeneral "${algo}" 1gb -e print 2>&1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle optional algorithms before sweeping -e print

When built with ENABLE_LRB or ENABLE_3L_CACHE, this sweep includes the now-registered lrb and 3LCache entries, but their parsers reject bare print before reaching their print branches because value is NULL (LRB_Interface.cpp:333-338 and ThreeLCache_Interface.cpp:343-348). These configurations therefore record a failure here on every ctest run; either fix those parsers as part of this change or exclude/handle algorithms that cannot accept -e print.

Useful? React with 👍 / 👎.

Comment thread test/test_cli.sh
"${BIN_DIR}/traceAnalyzer" --num-req=10000 -o out-nreq "${TRACE}" vscsi
fi

if [[ -x "${BIN_DIR}/mrcProfiler" ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require every CLI binary before reporting success

If mrcProfiler is absent or moved from bin/—for example after building only the cachesim target—this condition silently skips all SHARDS and MINISIM checks, yet the script can still exit successfully and CTest reports testCLI as passed. mrcProfiler and traceAnalyzer are unconditional project executables rather than optional features, so the preflight should require them (or skip/fail the whole test) instead of treating their missing coverage as success.

Useful? React with 👍 / 👎.

@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from cddf41e to 74d0d5e Compare August 13, 2026 18:12
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from dbe53fc to f3a18a6 Compare August 13, 2026 18:12

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3a18a6d68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh
local out
out=$("$@" 2>&1)
local rc=$?
if [[ ${rc} -eq 0 ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject sanitizer diagnostics from successful commands

When this target runs against a recovering sanitizer such as UBSan, a command can print runtime error: and still exit 0; this branch therefore records the invocation as passing. The same exit-code-only behavior appears in expect_output and the manual algorithm sweeps, so undefined behavior in most valid-input paths can evade the regression target even though expect_clean_error already recognizes these diagnostics. Check sanitizer signatures before accepting successful commands as well.

Useful? React with 👍 / 👎.

1a1a11a commented Aug 13, 2026

Copy link
Copy Markdown
Owner Author

Consolidated response to the review comments on this PR.

Sanitizer diagnostics counted as clean rejections — fixed, and it was the best catch here. _expect_clean_failure accepted any non-zero exit whose output contained the word "error". A sanitizer turns a crash into exit 1 with ERROR: AddressSanitizer, so in exactly the builds this suite exists to protect, a crash regression would have been recorded as a clean rejection. Sanitizer signatures are now tested first.

The follow-up — that a successful command can also print runtime error: under a recovering UBSan and still exit 0 — is correct and not yet addressed; expect_output and the sweeps check exit status only. Worth doing, and I have left it rather than adding it unverified at this point.

mktemp -d — fixed. BSD/macOS rejects the bare form, and the macOS job runs this target. It now passes an explicit "${TMPDIR:-/tmp}/libcachesim_cli_test.XXXXXX".

SKIP_REGULAR_EXPRESSION — fixed, then fixed again. Added so a self-skipped run stops reporting as a pass; the follow-up correctly noted the property arrived in CMake 3.16 while this project declares 3.12, where setting it is an error. It is guarded by a version check now.

Missing algorithms — fixed. hyperbolic, belady and beladySize were absent from ALL_ALGOS; the trace is oracleGeneral, so the Belady policies are valid on it. 174 checks became 180.

s3fifov0 is not a duplicate. s3-fifov0 and s3fifov0 are two distinct registry names for one constructor, as are 2q/twoq, s3-fifo/s3fifo, fifo-merge/fifomerge and gl-cache/GLCache. Sweeping both is deliberate: the point is that every registered name resolves, and an alias that stops resolving is exactly the regression the registry refactor could introduce.

Not addressed, both real: lrb and 3LCache reject bare print before reaching their print branches, so the sweep would fail in those optional build configurations; and a missing mrcProfiler binary silently skips the SHARDS and MINISIM checks while the target still passes. Both deserve fixing — flagging rather than rushing them.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70efb28ccb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh Outdated
Comment on lines +192 to +194
if [[ ${rc} -ne 0 ]] && grep -qi "do not support algorithm" <<<"${out}"; then
n_skipped=$((n_skipped + 1))
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail when mandatory algorithms become unsupported

If an always-built entry such as lru is accidentally removed from g_cache_algos, create_cache_by_name() returns NULL and cache_init.h emits this exact “do not support algorithm” message, so this branch skips the failure; the replay sweep repeats the same logic. Only 3LCache, GLCache/gl-cache, and lrb are feature-gated, so restrict skipping to those optional names or pass the enabled feature set into the test, otherwise the target can pass after a mandatory CLI algorithm disappears.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good catch, and fixed — this one undermined the sweep's whole purpose, so it was worth taking even though I had otherwise stopped adding to this PR.

The skip keyed off the do not support algorithm message alone, but cache_init.h emits that whenever a name is missing from the registry for any reason, not just an uncompiled feature. So a mandatory algorithm dropping out of g_cache_algos — precisely the regression the registry refactor could introduce — would have been skipped rather than reported.

Your list is exactly right: 3LCache, GLCache, gl-cache and lrb are the only feature-gated entries. The skip is restricted to those now.

Verified by deleting an entry and rebuilding, using gdsf rather than lrulru is asserted directly elsewhere in the suite, so its removal would have been caught regardless, whereas gdsf is covered by the sweeps and nothing else, which is the case that was genuinely silent:

FAIL: gdsf -e print (exit 134)   do not support algorithm gdsf
FAIL: gdsf replay (exit 134)     do not support algorithm gdsf
(4 algorithms not compiled in, skipped)

The four genuinely optional ones still skip, and the suite is 180/180 with the registry restored.


Generated by Claude Code

@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 70efb28 to 482d28d Compare August 13, 2026 18:28
@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from 7393ce8 to 7d8f16e Compare August 14, 2026 20:04
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 482d28d to 8c87ad4 Compare August 14, 2026 20:04

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c87ad4142

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh Outdated
--size=100MB,500MB,3 2>/dev/null | grep '^104857600B' | awk '{printf "%.4f", $2}')
_cachesim_exact=$("${BIN_DIR}/cachesim" "${TRACE_ORACLE}" oracleGeneral lru 100mb \
2>/dev/null | tail -1 | grep -oE 'miss ratio [0-9.]+' | head -1 | awk '{printf "%.4f", $3}')
if [[ "${_minisim_unsampled}" == "${_cachesim_exact}" ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject empty outputs before comparing miss ratios

If both extraction pipelines fail to find their expected rows—for example after both tools' output formats change—each command substitution produces an empty string, and this equality check records the regression assertion as passed because "" == ""; the pipeline statuses are discarded because the script does not use set -e. Require both extracted values to be nonempty before comparing them so this test cannot succeed without actually observing either miss ratio.

Useful? React with 👍 / 👎.

@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from 7d8f16e to 52d2e27 Compare August 14, 2026 20:16
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 8c87ad4 to 73893f3 Compare August 14, 2026 20:16
@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from 52d2e27 to 9e35ceb Compare September 12, 2026 00:00
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 73893f3 to 94bd4b3 Compare September 12, 2026 00:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T05:29:42.270119Z 7ae9b2a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from 9e35ceb to 6066e22 Compare September 12, 2026 00:16
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch 2 times, most recently from 538e6e1 to 7bf76b9 Compare September 12, 2026 00:42
@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from 14d01d7 to c12617b Compare September 12, 2026 00:53
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 7bf76b9 to 83ff21e Compare September 12, 2026 00:53
@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from c12617b to ea0e6cc Compare September 12, 2026 01:04
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 83ff21e to 75bc50c Compare September 12, 2026 01:04

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75bc50cd42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh Outdated
Comment on lines +205 to +206
if [[ ${rc} -eq 0 ]]; then
_report 0 ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require the print sweep to observe parameter output

When an algorithm silently ignores cache_specific_params, this condition counts the invocation as passing after a normal trace replay rather than verifying the -e print path; FIFO_init is a current example because it never parses the supplied print value. Consequently, this newly added sweep is already green for algorithms that produce no parameter report, and regressions that turn printing into a no-op can escape the target. Require an expected reporting marker, or explicitly separate algorithms that do not support printable parameters.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Correct, and worse than the example suggests — fixed in a420ff36.

I measured every name in ALL_ALGOS rather than assuming. Eighteen of the fifty ignore -e print and replay the trace, so the sweep was passing for all of them without the print path ever running: arc arcv0 belady cacheus fifo gdsf lecarv0 lfu lfucpp lfuda lhd lirs lru nop random randomTwo sieve size. fifo was a good pick — it's one of them.

The sweep now requires a parameter report, with the non-reporting algorithms listed as the exception. I made the list the exception rather than the rule deliberately: a new algorithm added to ALL_ALGOS lands in the strict branch and fails loudly, instead of quietly joining the lenient bucket and recreating this hole.

One trap worth recording, because I fell into it first. My initial classification said all fifty print. The reason is that cachesim's INFO banner echoes back eviction-params: print, which matches any loose search for a parameter report — so the check passed for every run, including the ones that never print. Exactly the failure mode you're describing, reproduced in the fix for it. The assertion now strips the colour codes and the logger's lines before anchoring on the report itself; the tree spells it four ways (parameters:, current parameters:, <name> parameters:, default params:).

Verified load-bearing two ways, since an assertion of this shape is precisely the kind that passes for the wrong reason:

  • moving lru into the strict branch → FAIL: lru -e print exited 0 without reporting parameters (184 passed, 1 failed)
  • deleting the printf from S3FIFO_parse_params and rebuilding → fails for both s3fifo and its s3-fifo alias (183 passed, 2 failed)

185 checks pass with the tree as it stands, up from 184.

One thing I found while classifying and did not fix. arc and arcv0 don't belong in either category cleanly: ARC.c and ARCv0.c both define a *_parse_params with a working print branch that ARC_init and ARCv0_init never call, so the flag is dropped on the floor. Wiring it up is one line each — but their *_current_params helpers return an empty string, so arc -e print would report parameters: and nothing else. That reads as a feature left unfinished rather than one that broke, and finishing it is the maintainers' call, not mine. They're listed with that reasoning recorded next to them in the source, so moving them out is a one-line change whenever those inits start parsing their params.


Generated by Claude Code

@1a1a11a
1a1a11a force-pushed the claude/polish-4-registry-hashpower branch from ea0e6cc to bcbe9e9 Compare September 12, 2026 05:08
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from a420ff3 to 933550e Compare September 12, 2026 05:08
Before the fix the run aborted inside the thread pool without printing an
error message, so expect_clean_error fails on it. 185 checks pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUq1vM4g82TkaX2jvLmuQc
The sweep only asserted exit 0, so any algorithm that ignores
cache_specific_params passed after an ordinary trace replay without the print
path having run at all. Eighteen of the fifty names in ALL_ALGOS behave that
way, so a regression that turned printing into a no-op would have gone
straight through.

Require the report, and list the algorithms that genuinely have nothing to
report. The list is the exception rather than the rule so that an algorithm
newly added to ALL_ALGOS lands in the strict branch and fails loudly instead
of passing silently.

Match carefully: cachesim's INFO banner echoes back "eviction-params: print",
so a loose search for a parameter report matches every run, including the
runs that never print. Strip the colour codes and the logger's lines first,
then anchor on the report itself -- the four spellings in the tree are
"parameters:", "current parameters:", "<name> parameters:" and
"default params:".

Verified load-bearing two ways, since an assertion of this shape is exactly
the kind that passes for the wrong reason. Moving lru into the strict branch
fails it (184/1); deleting the printf from S3FIFO_parse_params fails it for
both s3fifo and its s3-fifo alias (183/2). 185 checks pass with the tree as
it stands, up from 184.

While classifying, ARC and ARCv0 turned out not to belong in either category
cleanly: both define a *_parse_params with a working `print` branch that
ARC_init and ARCv0_init never call, so the flag is dropped. Their
*_current_params helpers return an empty string, so this reads as an
unfinished feature rather than a broken one, and finishing it is a
maintainer's call. They are listed with that reasoning recorded next to them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUq1vM4g82TkaX2jvLmuQc
Both now parse their eviction parameters, so `-e print` reports and exits
instead of replaying the trace. Move them out of the no-report list into the
strict branch, where a regression in either parser is caught.

185 checks pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUq1vM4g82TkaX2jvLmuQc
@1a1a11a
1a1a11a force-pushed the claude/polish-5-cli-tests branch from 933550e to 7ae9b2a Compare September 12, 2026 05:25

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ae9b2a048

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/test_cli.sh Outdated
# report. The INFO banner echoes back "eviction-params: print", so a looser
# search matches every run -- including the ones that never print -- and the
# assertion passes without the print path having run at all.
_printed=$(sed 's/\x1b\[[0-9;]*m//g' <<<"${out}" | grep -v '^\[')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make ANSI stripping portable to the macOS test job

In the macos / clang job in .github/workflows/build.yml:13-28, this runs with BSD sed, which does not support GNU sed's \xHH regular-expression escape. Since the logger emits an ANSI reset without a following newline, the buffered parameters: output can retain that escape prefix; this substitution then fails to remove it (or reports a regex error), so the anchored check on the next line records every strict -e print case as failed. Use a literal escape supplied through Bash ANSI-C quoting, or another portable ANSI filter.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The portability point is right and it's fixed in 34452199 — but the predicted failure isn't happening, and I want to be precise about which part I'm agreeing with.

Right: \xHH is a GNU extension. BSD sed reads \x as a plain x, matches nothing, and strips no colour, so on the macOS job the guard is absent — on exactly the platform where a failure would be hardest to read. Now a literal escape through Bash ANSI-C quoting, which both seds handle.

Not right: that this "records every strict -e print case as failed" today. Two checks say otherwise.

testCLI runs in the macOS job and passes, in 38 seconds, on the head that carries the GNU-only form:

Start 10: testCLI
9/10 Test #10: testCLI ..........................   Passed   38.18 sec
100% tests passed out of 10

And the premise doesn't hold: the algorithms that honour -e print exit inside create_cache(), which runs before print_parsed_args() logs anything, so the logger never gets to emit. I checked all thirty-one strict-branch algorithms — every one produces zero bytes on stderr for -e print, and the whole combined output is the 86-byte plain parameters: line. There is no colour to strip on any platform, which is why BSD sed doing nothing costs nothing.

So this was dormant-and-wrong rather than broken, and it's worth having correct rather than removing: fed a synthetic line with a real escape prefix, the new expression strips it and the anchored check matches; left unstripped — what BSD sed produces — the same check does not match. It will do its job the day an algorithm warns while initialising.

185 checks pass, suite 10/10.


Generated by Claude Code

The sweep used sed 's/\x1b\[[0-9;]*m//g'. \xHH is a GNU extension: BSD sed,
which is what the macos / clang job runs, reads \x as a plain x, matches
nothing and strips no colour at all, so the guard is absent on exactly the
platform where a failure would be hardest to read. Use a literal escape
through Bash ANSI-C quoting, which both seds handle.

This is not a live failure. Nothing writes to stderr on this path: the
algorithms that honour `-e print` exit inside create_cache(), before
print_parsed_args() logs anything, so there is no colour to strip on any
platform. Checked all thirty-one strict-branch algorithms -- every one
produces zero bytes on stderr -- and testCLI runs and passes in the macOS job
today, in 38 seconds, on the head that carries the GNU-only form.

The guard still earns its place, so it should be correct rather than dormant
and wrong. Fed a synthetic line carrying a real escape prefix, the new
expression strips it and the anchored check matches; left unstripped, which
is what BSD sed produces, the same check does not match. It will do its job
the day an algorithm warns while initialising.

185 checks pass, suite 10/10.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUq1vM4g82TkaX2jvLmuQc

1a1a11a commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Closing as redundant: #324 was merged into develop on 2026-09-13 as 5b4dd398, and this branch's tree is byte-identical to developgit diff origin/develop claude/polish-5-cli-tests reports zero files.

GitHub didn't detect it because #324 was squash-merged, so this head is not an ancestor of develop; the evidence is content identity, not ancestry. Nothing here is lost.


Generated by Claude Code

@1a1a11a 1a1a11a closed this Sep 13, 2026
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.

3 participants