Skip to content

protocol-recorded-by-null.test.ts declares recorded_by with the rejected alias referenceTo under a comment claiming it is "the real declaration" #14535

Description

@os-musk

Found while running the spelling census for #13543. Filed unassigned, out of scope for that card's PR — that card is about master-detail.ts, and this fixture declares a lookup, so it never reaches that resolver.

What is there

packages/objectql/src/protocol-recorded-by-null.test.ts:81

// The real declaration, not a `text` stand-in — see the file header.
recorded_by: {
    name: 'recorded_by', label: 'Recorded By',
    type: 'lookup' as const, referenceTo: 'sys_user', readonly: true,
},

The file header says the same thing in prose:

recorded_by is declared here as the real thing — a readonly lookup to sys_user — rather than the text stub the older repo-path suite uses, because that is what makes the second half of the file meaningful.

The real declaration is packages/metadata-core/src/objects/sys-metadata-history.object.ts:166:

recorded_by: Field.lookup('sys_user', { ... })

Field.lookup emits the canonical reference key (packages/spec/src/data/field.zod.ts:2171). So the fixture spells referenceTo, which is not what the platform object spells, and which FieldSchema refuses by name with "Did you mean referenceToreference?" (#11567, "one key, one answer").

Why this is worth a card rather than a silent rename

The fixture is not decorative — the file header makes its fidelity load-bearing. Its second half exists to exercise the #4441 referential-integrity exemption for readonly fields, i.e. behaviour that keys off recorded_by being a resolvable lookup to sys_user. With the target spelled under a key nothing canonical reads, it is worth checking whether the exemption under test is being exercised against a field the integrity check can actually resolve a target for, or against one it treats as having none. The suite passes either way, which is exactly the shape that hides the question.

So the fix is plausibly a one-word rename, but the thing to establish first is which of the two the test has been proving. If it turns out the branch was never reached, the rename changes what the suite covers and that belongs in the same change.

Scope note

This is a fixture, not a population. The #13543 census counted it in the "reader pins and test fixtures" row and explicitly did not count it as evidence that any deployment spells the alias — see that card's census comment. Nothing here claims the platform object is wrong; it is correct.

Related

#13543 (the census that surfaced it) · #4441 (the readonly exemption the file exercises) · #4556 (the sentinel the file was written for) · #11567 (reference is the only declared spelling) · #12252 (the closed sweep of reference_to fixtures — snake_case, a different spelling and a different file set, so not a duplicate)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions