mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
fix(ci): repair server and shared gates after the place identities change
Push run 46275645144 on dev (f69a4c1a2) was red in these jobs:
- Server types: UserPlacesRepository.create, UserPlaceMergesRepository.create
and UserPlaceLinksRepository.insert shadowed MikroORM's EntityRepository
methods with other signatures (TS2416), which also broke defineEntity on the
three entities (TS2769). They are createOwn, record and insertUses now.
- Server lint: collections.service.ts had grown to 1411 lines against 1410.
The trip tag lookup of a copy moved into collections.helpers.ts
(tripTagIdsOf, tagKeyOf); the size baseline is lowered to the 1398 it holds.
- ASTCAP-001/002/005b: the trip chat core had taken in PlacesLibraryMcp,
PlaceIdentitiesMcp and TripCollectionsMcp, so core and the tours group
offered 132 tools against 128. They load with the collections group now.
- PLIB-001, PLIB-MCP-001 and the places library e2e: the two entries named
Museum tie on the name and go by their anchor, which the expected order
hard coded the other way. The fixture orders every tie by its anchors.
- ENT-003 and CLASSFIELD-002: the five new entities and their 18 NOT NULL
columns without a default are counted.
- Shared tests: collections.ratingBadge was missing in 26 locales; each has
its translation now.
This commit is contained in:
@@ -154,9 +154,10 @@ export async function seedLibrary(orm: FactoryOrm) {
|
||||
export type LibraryFixture = Awaited<ReturnType<typeof seedLibrary>>;
|
||||
|
||||
/**
|
||||
* The keys of `me`'s entries by name. Café Central's two entries tie on the
|
||||
* name and then go by their anchor (`id * 4 + kind`, a trip place's kind 1,
|
||||
* a saved place's 2), so their order follows the ids the seed got.
|
||||
* The keys of `me`'s entries by name. Two entries of the same name go by their
|
||||
* anchor (`id * 4 + kind`, a trip place's kind 1, a saved place's 2; a saved
|
||||
* place grouped with a trip place takes the trip place's), so the order of a
|
||||
* tie follows the ids the seed got.
|
||||
*/
|
||||
export function expectedKeysByName(f: LibraryFixture): string[] {
|
||||
const { places, saved } = f;
|
||||
@@ -167,16 +168,23 @@ export function expectedKeysByName(f: LibraryFixture): string[] {
|
||||
`list:${saved.hiddenCopy.id}`,
|
||||
`trip:${places.hotel.id}`,
|
||||
`list:${saved.lunch.id}`,
|
||||
`list:${saved.namesake.id}`,
|
||||
`trip:${places.museum.id}`,
|
||||
...museumTie(f),
|
||||
`list:${saved.pantheon.id}`,
|
||||
];
|
||||
}
|
||||
|
||||
/** Two entries of one name, in the order their anchors give. */
|
||||
function byAnchor(trip: number, list: number): string[] {
|
||||
const pair = [`list:${list}`, `trip:${trip}`];
|
||||
return list * 4 + 2 < trip * 4 + 1 ? pair : [...pair].reverse();
|
||||
}
|
||||
|
||||
/** The two entries named Café Central, in the order their anchors give. */
|
||||
export function cafeTie(f: LibraryFixture): string[] {
|
||||
const conflicting = f.saved.conflicting.id * 4 + 2;
|
||||
const cafe = f.places.cafe.id * 4 + 1;
|
||||
const pair = [`list:${f.saved.conflicting.id}`, `trip:${f.places.cafe.id}`];
|
||||
return conflicting < cafe ? pair : [...pair].reverse();
|
||||
return byAnchor(f.places.cafe.id, f.saved.conflicting.id);
|
||||
}
|
||||
|
||||
/** The two entries named Museum (the trip place with its saved copy, and the namesake), as their anchors give. */
|
||||
export function museumTie(f: LibraryFixture): string[] {
|
||||
return byAnchor(f.places.museum.id, f.saved.namesake.id);
|
||||
}
|
||||
|
||||
@@ -60,14 +60,17 @@ describe('ALL_ENTITIES', () => {
|
||||
* + assistant_attachments, the files attached in the trip chat, kept with their conversation
|
||||
* + mail_ingest_addresses, _prefs, _cursor, _messages and _candidates, the forwarded
|
||||
* booking mails, the bookings read from them and the switches and addresses behind them
|
||||
* + trip_addon_overrides, the owner's per-trip on or off for a trip addon)
|
||||
* + trip_addon_overrides, the owner's per-trip on or off for a trip addon
|
||||
* + user_places, user_place_links, user_place_merges and user_place_merge_dismissals,
|
||||
* a user's own place identities, the uses they group, the merges and the dismissed pairs
|
||||
* + trip_collection_links, the lists a trip links)
|
||||
* is registered, and no two share a class name (a silent duplicate would
|
||||
* shadow one of them in `orm.getMetadata()`, exactly the kind of drift
|
||||
* `entity-schema-parity.test.ts` can't see — it iterates the metadata map,
|
||||
* which de-duplicates by class name).
|
||||
*/
|
||||
it('ENT-003: exactly 174 entities, every class name unique', () => {
|
||||
expect(ALL_ENTITIES.length).toBe(174);
|
||||
it('ENT-003: exactly 179 entities, every class name unique', () => {
|
||||
expect(ALL_ENTITIES.length).toBe(179);
|
||||
const names = ALL_ENTITIES.map((s) => s.meta.className);
|
||||
expect(new Set(names).size).toBe(names.length);
|
||||
});
|
||||
|
||||
@@ -67,7 +67,10 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest';
|
||||
// id, transport, mailbox; mail_ingest_messages: id, transport, dedupe_hash, user_id, size; mail_ingest_candidates:
|
||||
// id, message_id, user_id (each row is written whole by the mail import, which always knows all of them).
|
||||
// + trip_addon_overrides: trip_id, addon_id, enabled (an override is only ever written whole, by the trip owner).
|
||||
const KNOWN_UNINITIALISED_NOT_NULL_SCALARS = 635;
|
||||
// + user_places: id, user_id, name; user_place_links: id, user_place_id, user_id; user_place_merges: id, user_id,
|
||||
// leading_id, merged_id, moved_link_ids; user_place_merge_dismissals: id, user_id, key_a, key_b;
|
||||
// trip_collection_links: id, trip_id, collection_id (each row is written whole by the places library or the trip).
|
||||
const KNOWN_UNINITIALISED_NOT_NULL_SCALARS = 653;
|
||||
|
||||
describe('entity class fields never carry a NaN initialiser (task-4-review-shape.md, Important 1)', () => {
|
||||
it('CLASSFIELD-001: new X() has no own property whose value is NaN, across all 133 entities', () => {
|
||||
|
||||
@@ -13,7 +13,13 @@ import { PlacesLibraryService, type LibraryUser } from '../../../../src/nest/pla
|
||||
import { createSnapshotTestDb } from '../../../helpers/db-mock';
|
||||
import { updateRows } from '../../../helpers/factories/rows';
|
||||
import { oneByOne } from '../../../helpers/one-by-one';
|
||||
import { cafeTie, expectedKeysByName, seedLibrary, type LibraryFixture } from '../../../helpers/places-library-fixture';
|
||||
import {
|
||||
cafeTie,
|
||||
expectedKeysByName,
|
||||
museumTie,
|
||||
seedLibrary,
|
||||
type LibraryFixture,
|
||||
} from '../../../helpers/places-library-fixture';
|
||||
import { resetTestDb } from '../../../helpers/test-db';
|
||||
import { createTestModule, type TestModule } from '../../../helpers/test-module';
|
||||
import { createTestOrm, type TestOrm } from '../../../helpers/test-orm';
|
||||
@@ -148,8 +154,7 @@ describe('PlacesLibraryService.list', () => {
|
||||
...cafeTie(f),
|
||||
`list:${f.saved.hiddenCopy.id}`,
|
||||
`list:${f.saved.lunch.id}`,
|
||||
`list:${f.saved.namesake.id}`,
|
||||
`trip:${f.places.museum.id}`,
|
||||
...museumTie(f),
|
||||
]);
|
||||
expect(await by({ trip_id: f.rome.id })).toEqual([`trip:${f.places.forum.id}`]);
|
||||
expect(await by({ status: 'visited' })).toEqual([`list:${f.saved.pantheon.id}`]);
|
||||
|
||||
Reference in New Issue
Block a user