chore: remove dead code and the last v5-era residue - #61
Merged
Conversation
A net 171 lines out, none of it reachable.
Unreachable by construction:
- `expandComputedIncludeOrder` wrapped `getDefinition` in a try/catch. That
method is `return this.defs[defName]` — it returns `undefined` for an unknown
name and does not throw, so the catch could never fire. (`getModelAdapter`
throws; `getDefinition` does not. Easy to conflate.) The comment explaining
what an absent definition means is kept on the one-liner.
- `processRelationship` switched on `rel.type` to pick singular or plural, with a
`default:` that threw on an unknown type — but `validateRelationship` has
already rejected anything not in `RelationshipType` several lines earlier. Now
a set lookup against `SINGULAR_ACCESSOR` and no unreachable arm.
- `encodeValue` in the valkey key builder had an `else if` for scalars and an
`else` for everything else whose bodies were both `String(value)`. One
expression, and the `no-base-to-string` disable now sits on the line that
actually needs it.
Never written, and could not have been read to any effect:
- `Ormize.globalKeys` and `Ormize.hookmap`, both initialised to `{}` and marked
vestigial in their own docblocks. Removing them is nominally a `.d.ts` surface
change, which is why it lands while 7.0 is still in beta. The live `hooks`
field sitting between them is untouched, as is the unrelated `getGlobalKeys()`
method.
- `Ormize.createProxyFunction`, an `@deprecated` one-line forwarder to the free
function in `./cross-adapter` with zero call sites anywhere.
- `DeclarativeMethod`, a one-line `Pick<ExposedMethod, …>` with no consumer and
no mention in the README that enumerates that subpath's exports.
Two that look dead by the same measure are deliberately kept, and the migration
notes say so: `isClassMethodAllowed` is the only member of the `is*Allowed`
family without an internal caller, and removing one member of a symmetric gate
API leaves it lopsided for anyone composing their own checks; `CrudOp` is a
convenience type over the very-much-used `CRUD_OPS`.
v5-era residue: commented-out `graphql-relay` and `@vostro/*` imports (that scope
predates the rename), a commented `$sqlgql`-era assertion block, and a stray
`// debugger`. The largest single piece is 118 lines of commented-out
cross-adapter tests in `manager-resolve.test.ts` behind a stale "need to work on
cross adapter relations" TODO — cross-adapter relationships have since shipped,
and `ormize-adapter-valkey/__tests__/cross-adapter.test.ts` covers both of the
cases those tests were reaching for, and more, against two real backends.
Also corrects `docs/specifications.md`, which listed `replace-id-deep.ts` under
the sequelize adapter. It lives in gqlize — as the same document already said
correctly further down.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019fGumVzMfMXDZ5vS7PJGDW
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.
Group 3 of the condense/dedupe/optimise pass. Net 171 lines removed, none of it reachable.
A 7.0 cleanup pass had already been through this repo (see the existing table in
docs/migration-6-to-7.md), so the harvest is deliberately thin — this is what survived a second look, not a first sweep.Unreachable by construction
try/catcharoundgetDefinitioninexpandComputedIncludeOrdergetDefinitionisreturn this.defs[defName]— returnsundefined, never throws. (getModelAdapterthrows; easy to conflate.)default:arm ofswitch (rel.type)validateRelationshipalready rejects anything not inRelationshipType, several lines earlierelsebranch in valkey'sencodeValueelse ifabove it both readString(value)The
switchbecomes aSINGULAR_ACCESSORset lookup;encodeValuebecomes one expression, with theno-base-to-stringdisable now on the line that actually needs it. Explanatory comments are carried over, not dropped with the lines.Never written
Ormize.globalKeys,Ormize.hookmap— both initialised to{}and marked vestigial in their own docblocks. Nominally a.d.tssurface change, which is why it lands while 7.0 is in beta. The livehooksfield between them is untouched, as is the unrelatedgetGlobalKeys()method.Ormize.createProxyFunction—@deprecatedone-line forwarder, zero call sites.DeclarativeMethod— one-linePick<ExposedMethod, …>, no consumer, and absent from the README that enumerates that subpath's exports.Deliberately kept
Two exports look dead by the same measure and stay, with the reasoning recorded in the migration notes:
isClassMethodAllowed— the only member of theis*Allowedfamily without an internal caller. Removing one member of a symmetric gate API to save a line leaves it lopsided for anyone composing their own permission checks.CrudOp— a convenience type over the very-much-usedCRUD_OPS.v5-era residue
Commented-out
graphql-relayand@vostro/*imports (that scope predates the rename), a$sqlgql-era assertion block, a stray// debugger.The big one: 118 lines of commented-out cross-adapter tests in
manager-resolve.test.ts, behind a stale//TODO: need to work on cross adapter relations. Cross-adapter relationships have since shipped — I checked before deleting, andormize-adapter-valkey/__tests__/cross-adapter.test.tscovers both cases those tests reached for (and more) against two real backends.Also
docs/specifications.mdlistedreplace-id-deep.tsunder the sequelize adapter; it lives in gqlize, as the same document already said correctly further down.Verification
pnpm typecheckandpnpm lintclean at--max-warnings 0docs/migration-6-to-7.mdwith replacementsIndependent of #59 and #60 — branched off
main.🤖 Generated with Claude Code
https://claude.ai/code/session_019fGumVzMfMXDZ5vS7PJGDW