Repository navigation
fix(conformance): render server values and multi-line details safely (#277 follow-up) - #284
Merged
Merged
Conversation
Review follow-ups to #277 (Refs #271): - spec/document/full-linkage named an orphaned `included` member with `String(type)`/`String(id ?? lid)`, which throws on valid JSON such as `{"type":{"toString":1}}`, so the rule came out Errored, not Failed. Both it and spec/document/no-duplicate-resources now render through one `resourceLabel`: a string as itself, anything else via Formatter.format; the duplicate rule also names a lid-only resource by its lid. - Conformance.format hangs the continuation lines of a multi-line WRITES entry (a cleanup-failed detail) and of a multi-line finding detail, instead of starting them at the margin or repeating the bullet. - The fixture-throw it.each gains a Proxy whose traps throw, an object whose toString throws and an Error whose name getter throws. - renderThrown's doc, the Outcome JSDoc, docs/conformance.md and the pending changeset no longer claim every value that throws when inspected becomes `[unrenderable defect]`. Claude-Session: https://claude.ai/code/session_0187g2QpzaHqEzX8GJxiJBVc Co-Authored-By: Claude <noreply@anthropic.com>
no-duplicate-resources rendered a duplicate with String(id ?? lid), so
a duplicated {type, id: {toString: 1}, lid} made the rule Errored, not
Failed; the label also named an id the comparison ignored. Both rules
now pick the member identity keys on (a string id, else a string lid)
and pin it with tests.
Hang a multi-line expected/observed under its label, add a fixture row
for an Error named by an object whose toString throws, and state the
[unrenderable defect] cases exactly (a revoked Proxy or one whose
getPrototypeOf trap throws; an Error whose name or message throws when
read or cannot become a string).
Refs #271.
Claude-Session: https://claude.ai/code/session_0187g2QpzaHqEzX8GJxiJBVc
Co-Authored-By: Claude <noreply@anthropic.com>
9 tasks done
This was referenced Oct 9, 2026
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.
Summary
Follow-up to #277. Refs #271.
The review follow-ups to #277, each checked against
trunkbefore the change, plus a second commit for this PR's own review (items 5–7):Fixture-throw rows. The
fixtureValuesit.eachinsrc/Conformance.test.tsgains four values. Each runs across all four member modes (createthrows,updatethrows,cleanupthrows,cleanupfails with):Proxy, aProxywhose traps throw and anErrorwhosemessageornamegetter throws, the two the table lacked: aProxywhose traps throw and anErrorwhosenamegetter throws, both rendered as[unrenderable defect];toStringthrows, rendered as[toString threw](effectFormatter's own marker). It is the contrast case, a value that throws when part of it is read but is not unrenderable;Errorwhosenameis an object whosetoStringthrows, rendered as[unrenderable defect].These pin fix(Conformance): render a throwing write fixture's value totally (#271) #277's fix. They pass on
trunkand fail under the mutations below.Multi-line values in
format.report.tsgains ahanghelper (first line after one prefix, later lines after another):WRITESentries: acleanup-faileddetail that spans lines keeps its later lines at the entry's sub-line indent (6 spaces) instead of the margin.detail: it went throughindent(…, " · "), so each later line got its own bullet and read as a second finding. Details can quote server data, such as a member name. Only the first line now carries·; later lines hang at 8 spaces.expected:/observed:(item 6 below): later lines hang 2 deeper than the label, not at the label's column, where a servertypeof"a\nb"would read as another field.indent:DIEDmessages, skip reasons,Passednotes and the rule reference. Each is the last thing in its outcome block, so a later line cannot be mistaken for a sibling field.JSON.stringify'd.targetis the caller's own label, not server data.Doc over-claims. These texts said every value that throws when inspected becomes
[unrenderable defect]: therenderThrowndoc (core.ts), theConformance.OutcomeJSDoc (both places), the pending changeset.changeset/conformance-rule-defect-outcome.md(both sentences) anddocs/conformance.md§ cleanup. All of them now say only a value the kit cannot read at all gets the marker; item 5 makes the list exact.Stringon server values (pre-existing bug). Two rules inspec.tsrenderedincludedmembers withString, which throws on valid JSON such as{"toString":1}, so the rule came outErroredinstead ofFailed:spec/document/full-linkage:String(resource["type"])andString(resource["id"] ?? resource["lid"])on orphaned members."included":[{"type":{"toString":1},"id":"2"}]made itErrored.spec/document/no-duplicate-resources(spec.ts~670):String(resource["id"]).identityrequires a stringtype, but not a stringid: it keys a member on itslidwhenever itsidis not a string. So two copies of{"type":"people","id":{"toString":1},"lid":"9"}inincludedmade the ruleErroredontrunk. It also printedpeople:undefinedfor a member identified only bylid.A new
resourceLabelhelper renders a string as itself and any other value throughFormatter.format. Normal reports keeppeople:404instead of switching to quoted JSON. Both rules use it. It names the memberidentitycompares on (item 6).spec.ts,profile.ts,write.ts,core.ts) forString(, template interpolation and.joinover server-supplied values. Those two rules are the only sites. The otherString(calls take kit-side values: schema property names incore.ts:208, the caller client's typedHttpClientErrorincore.ts:492and a numeric status inspec.ts:987.Second commit: this PR's review
The
[unrenderable defect]cases, stated exactly. I checked each claim by callingrenderThrowndirectly:Proxy[unrenderable defect]ProxywhosegetPrototypeOftrap throws[unrenderable defect]Proxywhose only throwing trap isget[inspection threw]Errorwhosemessage/namegetter throws[unrenderable defect]Errorwhosemessage/nameis a Symbol[unrenderable defect]Errorwhosemessage/nameis an object whosetoStringthrows[unrenderable defect]Errorwhosenameis a number42: ztoStringthrows[toString threw]{"a":"[property access threw]"}The
OutcomeJSDoc (src/Conformance.ts), the changeset and therenderThrowndoc now read "a revokedProxy, or one whosegetPrototypeOftrap throws, or anErrorwhosenameormessagethrows when read or cannot become a string (a Symbol, or an object whosetoStringthrows)". TheUNRENDERABLEdoc no longer says "throws when it is inspected". TheerrorMessagedoc now coversmessageas well asname. TherenderThrowndoc also names[inspection threw]for aProxywhosegettrap throws.resourceLabelnames the memberidentitycompares on. It usedid ?? lid, so two copies of{"type":"people","id":7,"lid":"8"}readpeople:7, though they were found equal onlid. It now picksisString(id) ? id : isString(lid) ? lid : (id ?? lid), so the label readspeople:8, infull-linkageas well. When neither member is a string there is no key, and theid ?? lidfallback keeps naming whichever is present:people:5for{"lid":5}, notpeople:undefined. That fallback is the one deviation from the review's suggested… : id.Multi-line
expected:/observed:now usehangas well (item 2). It is two lines, the same helper and the same "later lines sit 2 deeper than what they belong to" rule as theWRITESand finding-detail cases.Tests (test-first) and mutation checks
trunk(fix(Conformance): render a throwing write fixture's value totally (#271) #277 already fixed the behaviour).renderThrown'scatch: () => UNRENDERABLEchanged to rethrow. All 8 bug: a write fixture that throws an unstringifiable value is reported as Errored, not Skipped #271[unrenderable defect]rows fail (Proxy whose traps throw, andErrorwhosenamegetter throws, × 4 modes). In the second commit, the same mutation also fails all 4 rows of the newan error named by an object whose toString throwsrow (24 of 36fixtureValuescases fail in all). The new rows pass when the mutation is reverted.Formatter.format(thrown)changed toString(thrown). All 4toString throwsrows fail, along with the existing null-prototype rows.core.tswas byte-identical afterwards.keeps a cleanup failure that spans lines inside its write's entry(cleanupEffect.fails with a taggedFixtureBroke({ message: "a\nb" })) failed before thereport.tschange and passes after it. So doesmarks only the first line of a finding that spans lines as a finding. I used the tagged error in place ofnew Error("a\nb")so the test adds no neweffect(avoid-untagged-errors)warning. The rendered detail has the same shape:FixtureBroke: a\nb.hangs an expected or observed value that spans lines under its labelfailed whileexpected:/observed:usedindent, and passes withhang.names an orphaned included resource whose type or id is not a stringfailed before the fix (expected 'Errored' to be 'Failed').names a duplicated included resource by its lid when it has no idalso failed before it (people:undefined at /included/0 and /included/1).names a duplicated included resource whose id is not a string by its lidandnames an included resource by the member its identity is keyed on. Before the second commit they readpeople:{"toString":1} at …andpeople:7 at …; they pass after it.no-duplicate-resourcessite reverted to`${String(resource["type"])}:${String(resource["id"] ?? resource["lid"])}`. The{toString:1}case fails withexpected 'Errored' to be 'Failed'.resourceLabel's member reverted toid ?? lid. Both new tests fail.Verification
Run in order on the second commit's tree, in a fresh clone:
pnpm install --frozen-lockfile: passvp run build: passvp check: pass (0 errors). Total warnings 4340, the same as before this commit, so none were added.vp run check(sources, type-level tests, examples, emitted declarations): pass ("every type gate green")vp run -r test:unit: pass (root 2374 tests, examples 45 + 41 + 54)vp run docgen(every JSDoc@examplecompiled and executed): pass ("Docs generation succeeded!")fallow audit --base origin/trunk: pass ("No issues in 8 changed files"; 23 inherited findings excluded by the new-only gate)./node_modules/.bin/fallow audit --format json --quiet --explain --gate-marker agent: verdictpassChangeset
.changeset/conformance-render-server-values.md(patch):full-linkageandno-duplicate-resourcesno longer die on a non-stringtype/id. That includesno-duplicate-resources'Erroredon a duplicated{"id":{"toString":1},"lid":"9"}.people:9for alid, andpeople:8for{"id":7,"lid":"8"}.formathangs multi-lineWRITESdetails, finding details, andexpected:/observed:values..changeset/conformance-rule-defect-outcome.mdis reworded only (items 3 and 5). Its bump is unchanged.Notes
type/idstays bare and anything else goes throughFormatter.format. Quoting everything throughJSON.stringify, as the neighbouring single-value rules do, would have changed everyfull-linkage/no-duplicate-resourcesobserved(people:404→"people":"404"). As before, a numericidand its string spelling print alike (people:1), unless a stringlidis present (item 6).src/internal/define.ts,src/Assemble.ts,src/Handlers.ts,src/Middleware.tsand its tests,src/internal/schemaExt.ts,src/Resource.ts,src/Atomic.ts,README.md, and thereject-*/ include/sort changesets.Closesline: fix(Conformance): render a throwing write fixture's value totally (#271) #277 already closed bug: a write fixture that throws an unstringifiable value is reported as Errored, not Skipped #271.🤖 Generated with Claude Code
Generated by Claude Code