Read the CIT PY notes from the workspace rather than a path that moved - #33
Merged
Merged
Conversation
The /citpy page has been rendering an empty table locally. .env pinned COTMETRICS_CITPY at /Users/matts/code/citpy/data/citrini_outputs, citpy has since moved under trading_workspace, and nothing said so: CITPY_DIR pointed at a directory that no longer existed, get_citpy_files_grouped hit its os.path.exists guard, and an empty result looks exactly like a generator that has not run yet. Derive the directory from the sibling layout instead, the same convention cotmetrics-config already uses, so it cannot go stale again when a checkout moves. It runs after .env is sourced, so an explicit COTMETRICS_CITPY still wins. A COTMETRICS_CITPY that is set but absent now warns, because that is the case that was silent. The old $COTDATA_STORE/citpy warning became unreachable once the variable is always set, so it is now unconditional and reworded as what it actually is, a tripwire against a sync recreating a directory nothing reads. Resolving the workspace needed fixing first. _WORKSPACE was $REPO/.., which inside a worktree is the .claude/worktrees dir, so every sibling lookup missed at once. The notes are the mild version of that. cotmetrics-config is the serious one: a miss there does not fail, it falls back to the sample 6-symbol universe and the app comes up looking fine. git-common-dir names the main checkout from either place, with a fallback for a non-git deploy. .env and .venv follow the same checkout, since both describe the machine rather than the branch and neither follows a worktree, which is what made a worktree run impossible rather than merely wrong. Verified in a browser and not just in the config: 25 dated rows, all three links per row resolving under trading_workspace, and /citpy/view rendering the 2026-08-09 Citrindex as a grid. run-local.sh only ever runs locally; the deployed unit uses server-side/launch-cot-analyzer.sh and is untouched. Also drop a DEBUG print that dumped the whole grouped-files dict to the log on every page load, unterminated, so it ran into the following line. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
/citpypage has been rendering an empty table on local runs..envpinnedCOTMETRICS_CITPYat/Users/matts/code/citpy/data/citrini_outputs; citpy has since movedunder
trading_workspace, and nothing said so.CITPY_DIRpointed at a directory that nolonger existed,
get_citpy_files_groupedhit itsos.path.existsguard and returned{},and an empty result looks exactly like a generator that has not run yet.
run-local.shnow derives the directory from the sibling layout, the same conventioncotmetrics-configalready uses, so it cannot go stale again when a checkout moves. It runsafter
.envis sourced, so an explicitCOTMETRICS_CITPYstill wins.Why the diff is bigger than that
Resolving the workspace had to be fixed first.
_WORKSPACEwas$REPO/.., which inside aworktree is the
.claude/worktreesdir, so every sibling lookup missed at once. The notes arethe mild version of that.
cotmetrics-configis the serious one: a miss there does not fail,it falls back to the sample 6-symbol universe and the app comes up looking fine.
git rev-parse --git-common-dirnames the main checkout from either place (relative in theordinary case, absolute from a worktree), with a fallback for a non-git deploy.
.envand.venvthen follow that same checkout, since both describe the machine rather than the branchand neither follows a worktree. Without those two a worktree run was impossible rather than
merely wrong: it died on the
COTDATA_STOREcheck having never had a chance to read an.env.Also in here:
COTMETRICS_CITPYthat is set but absent now warns. That is the case that was silent.$COTDATA_STORE/citpywarning became unreachable once the variable is always set, so itis now unconditional and reworded as what it actually is: a tripwire against a sync
recreating a directory nothing reads.
DEBUGprint incitpy.pythat dumped the whole grouped-files dict to the log onevery page load, unterminated, so it ran into the following line.
Verification
Ran the app from a worktree and checked in a browser rather than only in the config:
TradingView) resolving under
trading_workspace/citpy/viewrenders the 2026-08-09 Citrindex as a grid, so the path guard incitpy_view.pyaccepts the new locationHTTP 200All three resolution branches exercised: relative
.git(main checkout), absolute (worktree),and the no-git fallback.
Scope
run-local.shonly ever runs locally. The deployed unit usesserver-side/launch-cot-analyzer.shand is untouched. The.envfix is deliberately not inthis PR, since it is gitignored machine-local config; the stale line is commented out on the
one affected machine, and a fresh clone gets the sibling default with no
.enventry at all.No test in this repo references
citpyorrun-local.sh.🤖 Generated with Claude Code