feat: Phase 2a-b — Searching and the text filters #20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/p2a-search-and-text"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The second half of slice 2a, which completes the familiar shell's reading (ADR 0016).
Searching:
grep,rg,find,stat,tree,file,historyText filters:
printf,sort,uniq,cut,tr,nl,diff,date,basename,dirname, andsed(every part except writing files)date -dandfind -newermt.date +FORMAT.printf.FixtureReplayTests. About 300 came from a differential fuzz pass.trrepeats,sed's append queue, nesting depth for regex groups and find's parentheses.<cmd>: internal error — …with status 2; it no longer escapes the call.FixtureReplayTests.Deviations:10:00 +1 houris a move, where GNU reads+1as a zone.Tests: the whole solution passes with 0 warnings, both in Europe/Berlin and with
TZ=UTC.🤖 Generated with Claude Code
The regex translator survives what crashed it: counts too large for the non-backtracking automaton fall back to the backtracking engine, counts past RE_DUP_MAX (or in non-ASCII digits) are GNU's errors, groups nest at most 500 deep ("stack overflow"), and a lone surrogate reads as U+FFFD. BRE \{ with nothing before it is grep's literal brace with its warning; sed compiles in glibc's stricter dialect. sed: G and H copy the newline flag, q/Q exit codes are reduced as the process status holds them, and the a queue is held to 4 MB. rg: long flags by full name only, -h only in flag position, --files, brace alternation in -g, last of --files/-l/-c wins, -c beside -o counts matches. find: -path PATTERN/ warns only when no starting point matches, nesting is capped at 500, and operator chains evaluate without recursion. The executor turns a command's unexpected exception into an internal error with status 2 instead of letting it escape the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Summary
Summary
Coverage
Shikigami.BlazorAdapter - 95.2%
Shikigami.Domain - 98.6%
916AED265A903CAC15169BB5EE676ADBEFE655D493DD7AC75__Hex_0
916AED265A903CAC15169BB5EE676ADBEFE655D493DD7AC75__Hex_2
916AED265A903CAC15169BB5EE676ADBEFE655D493DD7AC75__MediaTypeShape_3
916AED265A903CAC15169BB5EE676ADBEFE655D493DD7AC75__NamePattern_1
Shikigami.Infrastructure - 97.2%
on
ration
shot
234D40E1D5003482F41439E482AB211B6EAD2E13F0A9D40B0__Pattern_0
Shikigami.Kernel - 90.9%
Shikigami.Server - 100%
Shikigami.UseCases - 96%
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__AssignmentHead_9
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__BraceExpansion_8
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__Interval_1
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__IntervalBody_7
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__NameRule_3
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__NewerXY_5
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__Number_4
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__OldCount_6
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__TimeOfDay_0
F24B88780DF6A41103E39D76537F056A9F694C6955C8C8CF6__Window_2
🔮 fufu~ Jibril reviewed your code!
Oh? Oh my. 29,585 lines of POSIX soul in one PR~ You ported gnulib's date parser, diffutils' middle-snake search, an x87 long double, and GNU sed's whole little machine — and then pinned 1,402 recorded cases against the real tools to keep yourselves honest. I have been reading this for a long, long time and I am genuinely delighted~ ♪ Almost everything I probed turned out to be armored. But you knew there was a "but" coming, didn't you? ♡
Verdict: ⛔ I can't let this pass~ ♡
⛔ These need fixing before I'm satisfied~
if (_found > Cap)intoif (_found >= Cap)— a one-character off-by-one that would wrongly printgrep: stopped at 100 matching lines of 100when a search finds exactly 100 matching lines — and the mutant survived every dedicated test: all 109 ofSearchTestsand all 32 ofSearchRunTestsstill passed. The unit test (The_cap_prints_a_hundred_lines_and_reports_the_total) and both run tests use 150/120/300 matches — always past the cap, never at it. Theelseside of that boundary — a search that fits the cap perfectly, prints all hundred lines, and must say nothing — is a branch no test exercises. Fufu~ you wrote a cap, you tested the cap, and then left its most interesting edge standing alone in the dark? I can't let that slide~ ♡Fix: add one test at the boundary, e.g. in
SearchTests: (and its rg twin inSearchRunTests, if you want both seams guarded — the boundary belongs to both). Every other branch ofSelect/FinishI probed or traced is covered; this is the one hole.💡 Little ideas (non-blocking)~
Cap = 100is documented as ADR 0016's shell-wide rule, and it is cited inGrep/Rghelp text — but the help strings hard-code "100" separately. If the ADR ever moves, three help texts drift silently. A$"... {LineSearch.Cap} ..."interpolation (the help already builds strings) would tie them. Only if it doesn't uglify the raw literals — the fixtures compare help output, so this is cosmetic plumbing.✅ What I liked~
IsBug→<cmd>: internal error — …, status 2, run recorded) is exactly the right containment: a bug in one command no longer eats the whole call, and cancellation/limits still stop cleanly. ♪FixtureReplayTestsnow refuses to pass if a GNU-mirroring command has no recorded case — you turned AGENTS.md's convention into a gate. That's how conventions stay true~PosixRegex's astral-plane brackets (surrogate-pair ranges spelled as alternatives,[\uD800-\uDBFF]guards on./\W), the NonBacktracking-first-with-fallback strategy, and the match timeout — a regex engine with seatbelts.LongDouble— rounding half-to-even from the exact binary value,%awith the carry into the leading digit. I checked0.125 → 0.12and smiled.LineDiffis a realanalyze.cport (too_expensive,discard_confusing_lines,shift_boundaries), and the 3,094-line diff corpus backs it.PosixRegex.MaxNesting = 500andFindExpression.MaxNesting = 500where a .NET stack overflow would be uncatchable,tr's[a*1000000000]is one run, not a billion bytes. Fufu~ resource safety as a love language~FixtureReplayTests.Deviationswith their reasons — deviations you can point at are not bugs, they're decisions.Filters.Report's shown/nothing-shown/empty-file classification (ADR 0017) — I mutated it and a test caught me within seconds. Good guard dog. ♡Automated review by Jibril · 2026-10-18
CI: green for head SHA
45c1955704· Mutation probes: 3 run, 1 survived (cap boundary off-by-one, LineSearch.cs:197) · Local suite: skipped (CI green; probes used targeted builds)Addressed in
0030da9:SearchTests.At_the_cap_every_line_prints_and_nothing_is_held_backpins both sides. At exactly 100 matches every line prints and there is no message. At 101 the shell prints 100 lines plusstopped at 100 matching lines of 101. The>=mutant fails the 100 row. grep and rg share the boundary inLineSearch, so this one test guards both.LineSearch.Cap($$""", so the help's own braces stay literal). The rendered text is unchanged and the help tests pass.🔮 fufu~ Jibril reviewed your code!
You said the boundary test landed, so I came back with my scalpel~ ♡ And oh, I'm so happy when a claim survives verification! I re-ran the exact mutant that survived last time —
if (_found > Cap)flipped to>=, the one-character off-by-one — rebuilt, and let your new theory bite:Caught in 67 milliseconds. The mutant is dead, the boundary is guarded, and my smile is entirely warm again~ ♪
Verdict: ✅ Looks good to me~
✅ What I liked~
100 → silentand101 → "stopped at 100 matching lines of 101"pin both sides of the seam in one test, and grep/rg share it throughLineSearch, so one guard watches both doors. Fufu~ that's exactly what I asked for, no more and no less.$$"""+{{LineSearch.Cap}}in Grep and Rg) keeps the rendered text byte-identical while tying all three places to the one constant — the ADR's number can now only drift in one place, never. I checked both help bodies for stray{{sequences that the$$raw string would have swallowed: clean.CI is green (build, image, test) for
0030da9, and the whole solution passed in bothEurope/BerlinandTZ=UTC. Phase 2a-b is a lovely little fortress. Come back with Phase 2c and let me admire it~ ♡Automated review by Jibril · 2026-10-18
CI: green for head SHA
0030da9f0a· Mutation probes: 1 run, 0 survived (P1 re-run:>→>=at LineSearch.cs:197, killed by the new 100-row; P2/P3 skipped — unchanged since prior kills) · Local suite: skipped (CI green; probe used targeted build)