Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions pm-stack/aggregator/src/needs-drew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,3 +764,55 @@ export async function listAnswers(file: string): Promise<NeedsDrewQuestion[]> {
const items = await readNeedsDrewItems(file);
return items.filter((i) => i.answer);
}

// ---------------------------------------------------------------------
// #13507 item 4 (C, TS side): needsUser alias surface.
//
// This module is the "needs-drew" ledger/census module; its public
// identifiers migrate to the needsUser vocabulary here first, as
// aliases of the existing exports, so consumers can switch
// incrementally during the alias window (the same dual-accept shape
// as slices A4/A10/A11). The file itself is NOT renamed to
// needs-user.ts: that name is already taken by the #14084
// needs-user list module (src/needs-user.ts), which imports this
// module — the file rename needs a distinct target name and is a
// separate slice, recorded on #13507.

export const NEEDS_USER_LABELS = NEEDS_DREW_LABELS;
export type NeedsUserLabel = NeedsDrewLabel;
export type NeedsUserItem = NeedsDrewItem;
export type NeedsUserHands = NeedsDrewHands;
export type NeedsUserWait = NeedsDrewWait;
export type NeedsUserSourceStatus = NeedsDrewSourceStatus;
export type NeedsUserCensus = NeedsDrewCensus;
export type NeedsUserFetchPage = NeedsDrewFetchPage;
export const needsUserListUrl = needsDrewListUrl;
export const extractNeedsUserReason = extractNeedsDrewReason;
export const extractNeedsUserHands = extractNeedsDrewHands;
export const needsUserWait = needsDrewWait;
export const needsUserOwnerItems = needsDrewOwnerItems;
export const needsUserWaitCounts = needsDrewWaitCounts;
export const needsUserSweepTtlMs = needsDrewSweepTtlMs;
export type NeedsUserSweeperOptions = NeedsDrewSweeperOptions;
export const shouldFetchNeedsUserCensus = shouldFetchNeedsDrewCensus;
export const createNeedsUserSweeper = createNeedsDrewSweeper;
export const buildNeedsUserCensus = buildNeedsDrewCensus;
export type NeedsUserOption = NeedsDrewOption;
export const NEEDS_USER_ANSWER_TYPES = NEEDS_DREW_ANSWER_TYPES;
export type NeedsUserAnswerType = NeedsDrewAnswerType;
export const NEEDS_USER_RESOLUTION_RULES = NEEDS_DREW_RESOLUTION_RULES;
export type NeedsUserResolutionRule = NeedsDrewResolutionRule;
export type NeedsUserOptionSetRef = NeedsDrewOptionSetRef;
export type NeedsUserAnswer = NeedsDrewAnswer;
export type NeedsUserBrokerMapping = NeedsDrewBrokerMapping;
export type NeedsUserQuestion = NeedsDrewQuestion;
export type NeedsUserInput = NeedsDrewInput;
export const NEEDS_USER_OPEN_MAX_AGE_MS = NEEDS_DREW_OPEN_MAX_AGE_MS;
export const defaultNeedsUserFile = defaultNeedsDrewFile;
export const validateNeedsUser = validateNeedsDrew;
export const raiseNeedsUser = raiseNeedsDrew;
export const needsUserAnswerHandle = needsDrewAnswerHandle;
export type NeedsUserBrokerResolution = NeedsDrewBrokerResolution;
export const getNeedsUser = getNeedsDrew;
export const needsUserIncidentKey = needsDrewIncidentKey;
export const listOpenNeedsUser = listOpenNeedsDrew;
65 changes: 65 additions & 0 deletions pm-stack/aggregator/test/needs-user-aliases-13507.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// #13507 item 4: the needsUser alias surface of the needs-drew
// module. Oracle: identity — every alias must be the same
// value/function as its needsDrew original, so a consumer switching
// identifiers changes no behavior during the alias window.
import { describe, expect, test } from "bun:test";
import * as drew from "../src/needs-drew.ts";
import {
NEEDS_USER_ANSWER_TYPES,
NEEDS_USER_LABELS,
NEEDS_USER_OPEN_MAX_AGE_MS,
NEEDS_USER_RESOLUTION_RULES,
buildNeedsUserCensus,
createNeedsUserSweeper,
defaultNeedsUserFile,
extractNeedsUserHands,
extractNeedsUserReason,
getNeedsUser,
listOpenNeedsUser,
needsUserAnswerHandle,
needsUserIncidentKey,
needsUserListUrl,
needsUserOwnerItems,
needsUserSweepTtlMs,
needsUserWait,
needsUserWaitCounts,
raiseNeedsUser,
shouldFetchNeedsUserCensus,
validateNeedsUser,
} from "../src/needs-drew.ts";

describe("needsUser aliases are the needsDrew originals", () => {
test("constants alias by identity", () => {
expect(NEEDS_USER_LABELS).toBe(drew.NEEDS_DREW_LABELS);
expect(NEEDS_USER_ANSWER_TYPES).toBe(drew.NEEDS_DREW_ANSWER_TYPES);
expect(NEEDS_USER_RESOLUTION_RULES).toBe(drew.NEEDS_DREW_RESOLUTION_RULES);
expect(NEEDS_USER_OPEN_MAX_AGE_MS).toBe(drew.NEEDS_DREW_OPEN_MAX_AGE_MS);
});

test("functions alias by identity", () => {
expect(needsUserListUrl).toBe(drew.needsDrewListUrl);
expect(extractNeedsUserReason).toBe(drew.extractNeedsDrewReason);
expect(extractNeedsUserHands).toBe(drew.extractNeedsDrewHands);
expect(needsUserWait).toBe(drew.needsDrewWait);
expect(needsUserOwnerItems).toBe(drew.needsDrewOwnerItems);
expect(needsUserWaitCounts).toBe(drew.needsDrewWaitCounts);
expect(needsUserSweepTtlMs).toBe(drew.needsDrewSweepTtlMs);
expect(shouldFetchNeedsUserCensus).toBe(drew.shouldFetchNeedsDrewCensus);
expect(createNeedsUserSweeper).toBe(drew.createNeedsDrewSweeper);
expect(buildNeedsUserCensus).toBe(drew.buildNeedsDrewCensus);
expect(defaultNeedsUserFile).toBe(drew.defaultNeedsDrewFile);
expect(validateNeedsUser).toBe(drew.validateNeedsDrew);
expect(raiseNeedsUser).toBe(drew.raiseNeedsDrew);
expect(needsUserAnswerHandle).toBe(drew.needsDrewAnswerHandle);
expect(getNeedsUser).toBe(drew.getNeedsDrew);
expect(needsUserIncidentKey).toBe(drew.needsDrewIncidentKey);
expect(listOpenNeedsUser).toBe(drew.listOpenNeedsDrew);
});

test("an alias computes the same result as the original", () => {
expect(needsUserListUrl("developing-today/code", "user/review", 2)).toBe(
drew.needsDrewListUrl("developing-today/code", "user/review", 2),
);
expect(needsUserWaitCounts).toBe(drew.needsDrewWaitCounts);
});
});