Repository navigation
task 1 brief
Xopher edited this page Oct 28, 2026
·
1 revision
Files:
- Modify:
src/lib/databases/AchievementDb.ts(theAchievementinterface, L17-83) - Modify:
src/lib/engine/quests/QuestSchedule.ts(deadlineDayOfL229,isQuestActiveOnL282) - Test:
tests/unit/QuestScheduleProjectQuests.spec.ts
Interfaces:
-
Produces:
interface ProjectQuestLink { projectId: string; floor: string; dueOn: string /* YYYY-MM-DD */; wokenAt?: string /* ISO */ }exported fromAchievementDb.ts;Achievement.project?: ProjectQuestLink;isProjectQuest(quest): quest is Achievement & { project: ProjectQuestLink }exported fromQuestSchedule.ts. -
Step 1: Write the failing tests
describe("project quests", () => {
const base = { ...AchievementDb.getDefault(), id: "pq-x", basicSchedule: "once", startsOn: "2027-04-03", dueByTime: "20:00" };
it("hides a project quest until its floor wakes", () => {
expect(isQuestActiveOn({ ...base, project: { projectId: "p", floor: "2F", dueOn: "2027-04-09" } }, new Date(2027, 3, 5))).toBe(false);
});
it("shows a woken project quest before its startsOn", () => {
const woken = { ...base, project: { projectId: "p", floor: "2F", dueOn: "2027-04-09", wokenAt: "2027-04-01T10:00:00Z" } };
expect(isQuestActiveOn(woken, new Date(2027, 3, 1))).toBe(true);
});
it("is due on project.dueOn at its due time", () => {
const woken = { ...base, project: { projectId: "p", floor: "1F", dueOn: "2027-04-09", wokenAt: "2027-04-03T08:00:00Z" } };
expect(effectiveDeadline(woken, undefined, new Date(2027, 3, 5))).toEqual(new Date(2027, 3, 9, 20, 0));
});
it("leaves a once quest without a project link as it was", () => { /* deadline day = startsOn, hidden before startsOn */ });
});- Step 2: Run
chemx test tests/unit/QuestScheduleProjectQuests.spec.ts. Expected: FAIL (projectunknown / assertions fail). - Step 3: Implement. Add
ProjectQuestLinkand the optional field. InQuestSchedule.tsaddisProjectQuest;deadlineDayOfreturnsparseLocalDate(quest.project.dueOn)for a project quest (before the snooze/extension rules it already applies);isQuestActiveOnreturnsBoolean(quest.project.wokenAt)for a project quest, otherwise its current rule. Search every caller ofisQuestActiveOn/deadlineDayOf(chemx q -g "isQuestActiveOn") and confirm none hides a once quest beforestartsOnby another path; if one does, route it throughisQuestActiveOn. - Step 4: Run the spec and
tests/unit/QuestSchedule.spec.ts. Expected: PASS. - Step 5: Lead commits
feat(quests): project quests: hidden until their floor wakes, due on project.dueOn.
- Architecture
- Component-Library
- Hooks-Reference
- Temple-System
- Battle-Field-Architecture
- current_context - For AI/Human Handoff
- User Menu
- General Settings
- Family Settings
- Sound Settings
- Notification Settings
- Reward Settings
- Party Settings
- Theme Settings
- Chore Settings