Skip to content

chore: remove dead code and the last v5-era residue - #61

Merged
Azerothian merged 1 commit into
mainfrom
chore/dead-code
Sep 1, 2026
Merged

chore: remove dead code and the last v5-era residue#61
Azerothian merged 1 commit into
mainfrom
chore/dead-code

Conversation

@Azerothian

Copy link
Copy Markdown
Owner

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

What Why it could never run
try/catch around getDefinition in expandComputedIncludeOrder getDefinition is return this.defs[defName] — returns undefined, never throws. (getModelAdapter throws; easy to conflate.)
default: arm of switch (rel.type) validateRelationship already rejects anything not in RelationshipType, several lines earlier
else branch in valkey's encodeValue it and the else if above it both read String(value)

The switch becomes a SINGULAR_ACCESSOR set lookup; encodeValue becomes one expression, with the no-base-to-string disable 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.ts surface change, which is why it lands while 7.0 is in beta. The live hooks field between them is untouched, as is the unrelated getGlobalKeys() method.
  • Ormize.createProxyFunction@deprecated one-line forwarder, zero call sites.
  • DeclarativeMethod — one-line Pick<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 the is*Allowed family 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-used CRUD_OPS.

v5-era residue

Commented-out graphql-relay and @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, and ormize-adapter-valkey/__tests__/cross-adapter.test.ts covers both cases those tests reached for (and more) against two real backends.

Also

docs/specifications.md listed replace-id-deep.ts under the sequelize adapter; it lives in gqlize, as the same document already said correctly further down.

Verification

  • 1518 tests pass, pnpm typecheck and pnpm lint clean at --max-warnings 0
  • Breaking removals documented in docs/migration-6-to-7.md with replacements

Independent of #59 and #60 — branched off main.

🤖 Generated with Claude Code

https://claude.ai/code/session_019fGumVzMfMXDZ5vS7PJGDW

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
@Azerothian
Azerothian merged commit c6611cc into main Sep 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant