#1261 Attach causes to kb's loader errors and retire its lint deferral - #1272
Merged
Conversation
`KbLoaderError` accepts a second `ErrorOptions` argument, so a loader can attach the failure that produced it and a caller can reach that failure through `cause` instead of parsing it out of the message.
An error thrown by kb's loaders carries the failure that produced it as its `cause`, so a caller can inspect the original parse error instead of extracting it from the message. Messages that chain a cause join with a colon rather than an em dash. kb depends on `@williamthorsen/toolbelt.errors` for the description and chaining helpers.
A `kb` diagnostic naming a thrown error that carries no message now reports the error's class rather than trailing off after the colon.
Nine source modules adopt the constructs kb's lint configuration requires: `.includes` over a repeated-comparison chain, `Object.hasOwn` over a dynamic `in` check, `Iterator.toArray` over a spread, an awaited cleanup over a `.catch` chain, and a declaration moved past the early exit above it.
Four test modules drop the constructs kb's lint configuration rejects: the filesystem fixture binds its paths as module-scope constants instead of assigning `let` declarations from a hook, and three suites await a rejection directly rather than threading it through `.catch` or `.then`.
The two membership checks introduced for `.includes` become sets keyed for lookup, which is what kb's lint configuration requires of a constant consulted only for membership.
Every rule kb held at `warn` through a per-package deferral is enforced at the severity the shared preset sets.
foreman, lifecycle, and run-core stop declaring a source directory that was removed with their lint deferrals, so each package's declared inputs match what is on disk.
Dependency auditProduction dependency audit passed. |
williamthorsen
marked this pull request as ready for review
August 10, 2026 09:17
williamthorsen
added a commit
that referenced
this pull request
Aug 13, 2026
…e-v0.3.0 codeassembly-v0.9.0 factory-v0.2.6 codeassembly-mcp-v0.2.5 codeassembly-v0.9.0 - #1288 feat: State mutability and name the lede reader at the artifact type lists (#1303) - #1285 fix: Require plain bullets for checklists on both update-jira-ticket paths (#1302) - deps: Upgrade all deps to latest version - #1290 tooling: Upgrade eslint-config-typescript to 10 and complete manifest metadata (#1301) - #1294 feat: Specify artifact mutability and its sanctioned exceptions (#1297) - #1293 fix: Present and classify discretionary findings as actionable (#1295) - #1289 tooling: Remove shelled nmr calls from package manifests (#1291) - #1280 feat: Add a refresh path that edits an existing AGENTS.md instead of redrafting it (#1287) - #1055 feat: Replace the lede doctrine with corpus-derived guidance and retire the changelog-writer (#1286) - deps: Upgrade all deps to latest version - #1264 refactor: Consolidate error-message extraction on toolbelt.errors' describeError (#1284) - #1263 refactor: Retire the deferred-lint mechanism and adopt toolbelt.errors in agents (#1279) - #1262 refactor: Hoist unreadable for-of expressions and promote the lint rule to an error (#1276) - #1267 fix: Extend the no-hard-wrapping instruction to every GitHub composer (#1275) - #1177 fix: Rewrite links, tokens, and template variables in a Markdown file support entry (#1273) - #1176 feat: Add a ticketing-preferences hook to the skills that split and create tickets (#1268) - #1252 fix: Keep a skill's own sections out of injected guidance (#1266) - #1260 refactor: Fix lint and retire rule deferrals (#1265) - #1247 feat: Add a personal tooling-preferences rulebook (#1257) - #1251 feat: Let a rulebook declare that a guidance hook is how it is reached (#1259) - #1246 feat: Guard home-domain writes and record their provenance (#1254) - #1175 feat: Link new tickets to their blockers and parents (#1249) factory-v0.2.6 - deps: Upgrade all deps to latest version - #1290 tooling: Upgrade eslint-config-typescript to 10 and complete manifest metadata (#1301) - deps: Upgrade all deps to latest version - deps: Upgrade all deps to latest version - #1264 refactor: Consolidate error-message extraction on toolbelt.errors' describeError (#1284) kb-v0.6.0 - deps: Upgrade all deps to latest version - #1290 tooling: Upgrade eslint-config-typescript to 10 and complete manifest metadata (#1301) - #1289 tooling: Remove shelled nmr calls from package manifests (#1291) - #1264 refactor: Consolidate error-message extraction on toolbelt.errors' describeError (#1284) - #1261 feat: Attach causes to kb's loader errors and retire its lint deferral (#1272) - #1260 refactor: Fix lint and retire rule deferrals (#1265) codeassembly-lifecycle-v0.4.0 - #1290 tooling: Upgrade eslint-config-typescript to 10 and complete manifest metadata (#1301) - #1289 tooling: Remove shelled nmr calls from package manifests (#1291) - #1261 feat: Attach causes to kb's loader errors and retire its lint deferral (#1272) - #1260 refactor: Fix lint and retire rule deferrals (#1265) codeassembly-mcp-v0.2.5 - deps: Upgrade all deps to latest version - #1290 tooling: Upgrade eslint-config-typescript to 10 and complete manifest metadata (#1301) - #1289 tooling: Remove shelled nmr calls from package manifests (#1291) - #1264 refactor: Consolidate error-message extraction on toolbelt.errors' describeError (#1284) codeassembly-run-core-v0.3.0 - deps: Upgrade all deps to latest version - #1290 tooling: Upgrade eslint-config-typescript to 10 and complete manifest metadata (#1301) - #1289 tooling: Remove shelled nmr calls from package manifests (#1291) - #1264 refactor: Consolidate error-message extraction on toolbelt.errors' describeError (#1284) - #1261 feat: Attach causes to kb's loader errors and retire its lint deferral (#1272) - #1260 refactor: Fix lint and retire rule deferrals (#1265)
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
Errors
kbraises on malformed input now carry the underlying parse error as their cause. Callers constructing one of these errors themselves can attach a cause. Whenkbreports a thrown error that carries no message, the diagnostic now names the error's class instead of trailing off empty.Why
kb's loaders folded a caught error's message into a new error and discarded the error itself, leaving a caller that needed the original parse failure to scrape it back out of the message text. The lint rule that catches this saw two of the six sites: the other four throw
KbLoaderError, whose constructor took no cause, so the rule had nothing to flag. kb was also one of the last two packages holding its lint rules atwarnthrough a per-package deferral, which kept nine rules advisory across the package.Details
🎉 Features
KbLoaderErrortakes an optionalErrorOptionssecond argument and forwards it toError.cause: the registry, alias, config, and taxonomy loaders, and the taxonomy writer.:, matching the shape of the shared chaining helper. Messages kb composes itself keep the em dash.🐛 Bug fixes
♻️ Refactoring
instanceof Error ? … : String(…)ternary delegate to the shared description helper.Object.hasOwnfor a dynamicincheck,Iterator.prototype.toArray()for spreads of a map's keys or values, an awaited cleanup in place of a.catch(() => {})chain, and a declaration moved past the early exit above it.🧪 Tests
letdeclarations from a hook; three suites await a rejection directly rather than threading it through.catchor.then.KbLoaderErrorconstructor and one pinning the empty-message rendering.⚙️ Tooling
eslint.config.tsimport andtsconfig.jsoninclude that reached them. The nine rules return to the severity the shared preset sets..config/**/*.tstsconfig include, left behind when their own deferrals were retired.📦 Dependencies
@williamthorsen/toolbelt.errors0.2.0, kb's first@williamthorsen/*runtime dependency, for its description and chaining helpers.Closes #1261