Repository navigation
fix(kuna): report document failures as typed codes - #8064
Conversation
Kuna JSON, graphs, xrefs, spans, and command checks threw Error and published the sentence. Those refusals are now KunaDocumentError codes with the field or path that failed. Output errors keep the code as reason and the same facts in diagnostics.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@gensokyo-dev @dandgabr Kuna document admission now uses |
[Medium impact] The PR appears safe to merge; no blocking issue was found. SummaryThe PR gives Kuna document failures stable codes. The latest changes also preserve the failed address field through incoming-reference errors.
Reviews (2) · Last reviewed commit: "fix(kuna): keep incoming-reference addre..." · Reviewed by Greptile |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
Kuna document, reference, string-inventory, and command admission still threw
Errorand treated the English sentence as the failure identity. Callers that wrap those failures now keep a stable code and the structured fields that identify the row, field, or address.Problem and expected behavior
KunaJsonStream, reference-file checks, string inventory, project reads, and target commands threw messages such as "functions row codeC must be null" and "shorter than its recorded span". A short span or a non-numeric count was identifiable only by matching that sentence.Those failures now throw
KunaDocumentError. Itscodeis the stable identity, and optionaldetailholds member, field, and similar facts. The JSON stream maps that error toAnalysisOutputErrorwithreasonset to the code and the same facts indiagnostics. The user message stays${label} cannot be usedand no longer copies the code into prose.Incoming-reference parsing returns
{ code, field }when an address field fails.fieldis the JSON key fromKunaDocumentError.detail, and the reference adapter copies both intoProviderAdapterErrordiagnostics.Change and scope
KunaDocumentErrorowns document and command admission.KunaJsonStream.#rejectstill passesAnalysisResourceConstraintErrorthrough and still wraps unexpected causes withunusable. Reference-fileResulterrors now carry the code, and incoming-reference address failures also carryfield.No hardcoded limit was changed, so no new
REA_setting. The 64-code-unit Kuna number bound stays a format constant. No provider code moved into the application layer. Ghidra, Wasm, process, EVM, and filesystem throws are a separate change.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
AnalysisOutputError.reasonanddiagnostics.codeare the code. Incoming-reference address failures also reportdiagnostics.field. Consumers that matchedError.messagesentences now matchcode.KunaDocumentErrorwith codespan_short.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
kunaStringInventory.test.tsassertsAnalysisOutputErrorreasonnot_kuna_numberand diagnostics{ code, field: "count" }.kunaSpanCloseOwnership.test.tsasserts cause_tagKunaDocumentErrorand codespan_short.kunaReferenceFiles.test.tsasserts reasonrow_must_be_nulland diagnostics{ member: "functions", field: "codeC" }, and incoming-reference address failures assert{ code, field: "from_address" }forinvalid_addressandaddress_exceeds_u64.Kuna's ${label} cannot be usedplus the code. The reason field is the code. Incoming-reference diagnostics includefieldwhen an address field failed.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
Kuna document admission and span-close ownership are the boundaries covered. The span-short path still fails closed during cleanup. No new lifecycle stage was added.
For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/providers/kuna/kunaStringInventory.test.ts— 41 passed.npm run test:focused -- tests/boundary/providers/kuna/kunaSpanCloseOwnership.test.ts— 20 passed.npm run test:focused -- tests/boundary/providers/kuna/kunaReferenceFiles.test.ts— 21 passed, including the address-field cases.npm run test:focused -- tests/boundary/providers/kuna/kunaReferences.test.ts— 17 passed.npm run test:focused -- tests/boundary/providers/kuna/kunaQueryErrors.test.ts— 10 passed.npm run format:check— passed.npm run check:fast— typecheck and lint passed. The pre-push hook rancheck:fastagain and it passed.Compatibility, safety, and release
Error.messagetext need to switch onKunaDocumentError.codeorAnalysisOutputError.reasonanddiagnostics. Incoming-reference failures are{ code, field? }instead of a sentence. Accepted documents are unchanged.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.