mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 21:14:01 +01:00
266 -> 204, with the warmed qalc coprocess (its four _CALC_Q* state vars
and four functions) in calc-live-qalc.zsh at 74.
The source line uses ${0:A:h}, matching what the file already does for
_CALC_EVAL_PY. That is load-bearing here: this file is loaded as
~/.oh-my-zsh/custom/calc-live.zsh, a symlink into the repo, so a naive
$0 would look for the sibling in the oh-my-zsh custom dir, where it does
not exist -- and break every new shell, not just one script run.
So it is verified THROUGH the symlink, not the repo path: sources clean,
functions defined across the seam, and the qalc path in the new file
answers end to end ("=5 ft to cm" -> 152.4 cm). Seven expressions give
byte-identical results to HEAD, and _calc_is_expr still accepts "2+2"
while rejecting "ls -la".
zsh -n is the parse check here; shellcheck cannot read zsh and the
repo's hook excludes it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
49 lines
3.7 KiB
JSON
49 lines
3.7 KiB
JSON
{
|
|
"intent": "Bring calc-live.zsh under the 250-line cap by extracting the warmed qalc coprocess into a sibling file, without changing what the live prompt calculator computes.",
|
|
"scope": [
|
|
"linux_configuration/zsh/calc-live.zsh (266 -> 204 lines)",
|
|
"New: linux_configuration/zsh/calc-live-qalc.zsh (74 lines)",
|
|
"Non-goal: changing the evaluator, the expression heuristic, or the ZLE bindings"
|
|
],
|
|
"changes": [
|
|
"Moved the qalc coprocess block -- its four _CALC_Q* state variables and _calc_qalc_line, _calc_qco_start, _calc_qco_stop, _calc_qalc_eval -- into calc-live-qalc.zsh, sourced from calc-live.zsh after _CALC_QALC_BIN and _CALC_TIMEOUT_BIN are set.",
|
|
"The source line uses ${0:A:h}, the same idiom the file already relies on for _CALC_EVAL_PY. This matters here more than usual: the file is loaded as ~/.oh-my-zsh/custom/calc-live.zsh, a symlink into the repo, so a naive $0 would resolve into the oh-my-zsh custom directory where the sibling does not exist."
|
|
],
|
|
"verification": [
|
|
{
|
|
"command": "zsh -c 'source ~/.oh-my-zsh/custom/calc-live.zsh; ...' -- through the real symlink, not the repo path",
|
|
"result": "pass",
|
|
"evidence": "Sources without error, all five probed functions are defined across the seam, _calc_eval '10/4' returns 2.5, and the qalc path in the NEW file works end to end: _calc_qalc_line '=5 ft to cm' strips to '5 ft to cm' and _calc_qalc_eval returns '152.4 cm'. This is the check that matters, since the symlink is how the file is actually loaded."
|
|
},
|
|
{
|
|
"command": "seven expressions evaluated under HEAD and under the split, compared",
|
|
"result": "pass",
|
|
"evidence": "Identical for all seven: 2+2=4, 1/3=0.333333333333, sqrt(2)*3=4.24264068712, sin(pi/2)=1, 2^10=1024, 10/4=2.5, factorial(5)=120. _calc_is_expr still accepts '2+2' and still rejects 'ls -la', so ordinary commands remain untouched."
|
|
},
|
|
{
|
|
"command": "zsh -n on both files",
|
|
"result": "pass",
|
|
"evidence": "Both parse. zsh is the right parser here; shellcheck cannot read zsh syntax and the repo's shellcheck hook excludes zsh files, so the zsh-syntax hook is the gate."
|
|
},
|
|
{
|
|
"command": "bash ~/utils/scripts/check_file_length.sh",
|
|
"result": "pass",
|
|
"evidence": "calc-live.zsh 204, calc-live-qalc.zsh 74. Neither appears in the violation list."
|
|
},
|
|
{
|
|
"command": "function-set and line-set diff against HEAD",
|
|
"result": "pass",
|
|
"evidence": "All ten functions preserved and identical. Zero executable lines lost; the single addition is the source line."
|
|
}
|
|
],
|
|
"risks": [
|
|
"This is a live interactive component: a broken source line would break every new shell, not just a script run on demand. That is why it was verified through the oh-my-zsh symlink rather than the repo path -- the symlink is the only path that actually exercises ${0:A:h}.",
|
|
"The coprocess variables are shared across the seam by design: calc-live-qalc.zsh sets _CALC_QRESULT and _CALC_QEXPR, which _calc_preview and _calc_accept_line in the main file read. This is a sourced-into-the-same-shell relationship, not two processes, and the end-to-end qalc test exercises exactly that path.",
|
|
"Already-running shells keep the old single-file version in memory until they exit; nothing needs restarting, but a shell opened mid-commit could source a half-written pair. Both files were written before either was staged."
|
|
],
|
|
"rollback": [
|
|
"git revert the commit; calc-live.zsh returns to its 266-line single-file form and the sibling disappears. No symlink change is needed -- the oh-my-zsh symlink points at calc-live.zsh either way.",
|
|
"After rollback, open a new shell and type '2+2' to confirm the live preview still appears."
|
|
]
|
|
}
|