Repository navigation
refactor(result): read _extra through IsPlainObject instead of a cast - #92
Merged
Merged
Conversation
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.
Why
Antony wants every suppression
guardrails.suppressions.jsonallows in this repo brought to zero by fixing the code it hides, so the lint holds without escape hatches (ANT-1090). This PR removes the oneSAFETY:comment and its cast. The budget file dropssafetyfrom 1 to 0.What
DecodeRowspread the_extracell throughoverflow as RowObject | null. It now reads it throughIsPlainObject(overflow) ? { ...overflow } : {}.IsPlainObjectis the existing guard inmember.ts, which narrowsRowValueto a record without an assertion.Every state a row reaches decodes the same:
_extrais a jsonb object, which pg parses to a plain object, so it spreads as before._extrais null or the select list leaves it out, so both versions give{}.Only a non-object
_extrawould decode differently, and thejsonb NOT NULL DEFAULT '{}'column, which the adapter writes only as an object, never holds one.flowchart LR row[pg row] --> cell["_extra cell (RowValue)"] cell -->|IsPlainObject| spread["{ ...overflow }"] cell -->|null, undefined| empty["{}"] spread --> strip["drop _id, _instance"] empty --> strip strip --> doc["{ ...document, ...extra }"]SAFETY comments added
None. This PR removes one and adds none.
Proof
pnpm run checks:Checks: 11 passed, 0 failed.The behavioural probe calls the built
DecodeRowon both roots. It covers an object_extra(with shadowing_idand_instancekeys), an empty one, null, an absent one, a named instance, and an_extrakey that overrides a field. Both roots return the same JSON.API: 1 packages, 1 entries unchanged against origin/main (committed HEAD).
API: skipped .agents/skills/verify-module, private.
Runtime API: 1 packages, 1 entries unchanged against origin/main (committed HEAD).
Behavioural probe supplied.
Suppressions in authored code files (origin/main and committed HEAD). A lint directive counts once per rule it names;
*is a directive naming none.anti-slop/no-unknown-parameters@ts-expect-error@ts-ignoreSAFETY:comments