refactor: consolidate dir/slug/error/heading/sleep helpers (plan 020)#91
Open
DavertMik wants to merge 1 commit into
Open
refactor: consolidate dir/slug/error/heading/sleep helpers (plan 020)#91DavertMik wants to merge 1 commit into
DavertMik wants to merge 1 commit into
Conversation
…e owners (plan 020) Seven small-but-everywhere duplications collapsed to single owners, all output-identical: - ConfigParser.getProjectRoot()/resolveProjectDir() (6 dir-resolution copies) - utils/strings.slugify() (3 on-disk slug chains; getStateHash byte-identical, pinned by strings-slugify.test.ts) - browserErrorMessage() adopted at 11 error-ternary sites (documented exclusions preserved) - context-formatter.formatHeadings() (5 H1-H4 ladders) - single exported sleep() in page-readiness - utils/markdown-files.loadMarkdownFiles() (knowledge + experience loaders) - experience-compactor COMPACT_MAX_LENGTH const + basename() derivations Deviations from the plan (both forced): Step 5's waitForPageReadiness config-defaulting was skipped — reading config internally throws in the config-less page-readiness unit test (the plan's own STOP condition); only the sleep consolidation was done. loadMarkdownFiles gained an opt-in `recursive` flag so knowledge-tracker keeps its recursive scan. tools.ts (plan 018) and StateManager knowledge (plan 010) untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Explorbot Self-RegressionCommit
Attempt details
Session analysis — basic (native): Session AnalysisAll core issue filtering and search functionality works correctly. The Issues list page supports filtering by label (bug, feature), searching by text, viewing issue details, and clearing filters to show all issues. Coverage
What works
Execution Issues
|
DenysKuchma
requested changes
Jul 13, 2026
| debugLog(`Failed to read experience file ${file}:`, error); | ||
| } | ||
| } | ||
| allFiles.push(...loadMarkdownFiles(experienceDir)); |
Collaborator
There was a problem hiding this comment.
loadMarkdownFiles silently swallows per-file read errors. debugLog(Failed to read experience file ${file}:, error); - is better
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.
Plan 020 — Consolidate small-but-everywhere duplications into shared utils
Seven tiny patterns were copy-pasted across the codebase. Each is now a single owner (per the CLAUDE.md Code Ownership Map). Every change is output-identical.
ConfigParser.getProjectRoot()/resolveProjectDir()utils/strings.slugify()error instanceof Error ?→ messagebrowserErrorMessage()(existing)context-formatter.formatHeadings()sleep()page-readiness.sleeputils/markdown-files.loadMarkdownFiles()COMPACT_MAX_LENGTH+basename()Byte-identity gate
getStateHashnames files on disk — a changed hash orphans existing state/experience/cache files. Newtests/unit/strings-slugify.test.tspinsslugifyagainst hardcoded old-chain expectations and assertsgetStateHashreturns its exact pre-refactor value (admin_users_h1_user_list). Each adopter keeps its own pre/post steps (100-char pre-slice + 200-cap ingetStateHash; protocol-strip +generalfallback ingenerateFilename;.substring(0,200)ingenerateBasicHash).Deviations from the plan (both forced)
waitForPageReadinessto read config internally and collapse the wrappers. Butpage-readiness.test.tsruns with no config loaded andConfigParser.getConfig()throws there — the plan's own STOP condition. Only thesleepconsolidation was done; both wrappers keep passing their explicit config options.loadMarkdownFilesgained an opt-inrecursiveflag. knowledge-tracker scans recursively; experience-tracker does not. The flag preserves both behaviors exactly.Out of scope (coordinated)
src/ai/tools.ts— owned by plan 018 (refactor: extract shared tool boilerplate in tools.ts (plan 018) #89).generateBasicHash's slug was touched.Verification
bun test tests/unit→ 769 pass / 0 fail (+5 slugify tests).bun test tests/integration/→ 63 pass / 0 fail.bun run lint→ clean;tsctotal 641 → 640 (no new errors).🤖 Generated with Claude Code