Skip to content

FORM_AN_INNER_CONNECTION - #999

Merged
tickBit merged 3 commits into
devfrom
991-feature-request-implement-daily-task-form_an_inner_connection
Sep 25, 2026
Merged

tickBit merged 3 commits into
devfrom
991-feature-request-implement-daily-task-form_an_inner_connection

Conversation

@CapoMK25

@CapoMK25 CapoMK25 commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Tested via in-memory testing as follows (passed testing locally):

[capomk@lianli Altzone-Server]$ npx ts-node -T -e '
import { ChatResponseType } from "./src/chat/enum/chatResponseType.enum";
import { ChatEmotion } from "./src/chat/enum/chatEmotion.enum";
import { ServerTaskName } from "./src/dailyTasks/enum/serverTaskName.enum";

async function runInMemoryCheck() {
  console.log("--- Issue #991 FORM_AN_INNER_CONNECTION Validation ---");

  // 1. Valid Clan Message Payload
  const validPayload = {
    playerId: "player-1",
    clanId: "clan-1",
    serverTaskName: ServerTaskName.FORM_AN_INNER_CONNECTION,
    responseType: ChatResponseType.GOOD_GAME,
    emotion: ChatEmotion.JOY,
  };

  const isResponseTypeValid = Object.values(ChatResponseType).includes(validPayload.responseType);
  const isEmotionValid = Object.values(ChatEmotion).includes(validPayload.emotion);
  console.log("1. Valid Response & Emotion Payload ->", (isResponseTypeValid && isEmotionValid) ? "PASS (Accepted)" : "FAIL");

  // 2. Unsupported Response Type Guard
  const invalidType = "INVALID_RESPONSE_TYPE" as any;
  const isInvalidTypePassed = Object.values(ChatResponseType).includes(invalidType);
  console.log("2. Unsupported Response Type ->", !isInvalidTypePassed ? "PASS (Blocked)" : "FAIL");

  // 3. Invalid Emotion Guard
  const invalidEmotion = 9999 as any;
  const isInvalidEmotionPassed = Object.values(ChatEmotion).includes(invalidEmotion);
  console.log("3. Out-of-Bounds Emotion ->", !isInvalidEmotionPassed ? "PASS (Blocked)" : "FAIL");

  // 4. Blank Emotion Support Check (-1)
  const isBlankEmotionPassed = Object.values(ChatEmotion).includes(ChatEmotion.BLANK);
  console.log("4. Neutral Blank Emotion (-1) ->", isBlankEmotionPassed ? "PASS (Supported)" : "FAIL");
}

runInMemoryCheck();
'
npm notice run altzone-server@1.0.0 npx
npm notice run 'ts-node' -T -e 
npm notice run import { ChatResponseType } from "./src/chat/enum/chatResponseType.enum";
npm notice run import { ChatEmotion } from "./src/chat/enum/chatEmotion.enum";
npm notice run import { ServerTaskName } from "./src/dailyTasks/enum/serverTaskName.enum";
npm notice run
npm notice run async function runInMemoryCheck() {
npm notice run   console.log("--- Issue #991 FORM_AN_INNER_CONNECTION Validation ---");
npm notice run
npm notice run   // 1. Valid Clan Message Payload
npm notice run   const validPayload = {
npm notice run     playerId: "player-1",
npm notice run     clanId: "clan-1",
npm notice run     serverTaskName: ServerTaskName.FORM_AN_INNER_CONNECTION,
npm notice run     responseType: ChatResponseType.GOOD_GAME,
npm notice run     emotion: ChatEmotion.JOY,
npm notice run   };
npm notice run
npm notice run   const isResponseTypeValid = Object.values(ChatResponseType).includes(validPayload.responseType);
npm notice run   const isEmotionValid = Object.values(ChatEmotion).includes(validPayload.emotion);
npm notice run   console.log("1. Valid Response & Emotion Payload ->", (isResponseTypeValid && isEmotionValid) ? "PASS (Accepted)" : "FAIL");
npm notice run
npm notice run   // 2. Unsupported Response Type Guard
npm notice run   const invalidType = "INVALID_RESPONSE_TYPE" as any;
npm notice run   const isInvalidTypePassed = Object.values(ChatResponseType).includes(invalidType);
npm notice run   console.log("2. Unsupported Response Type ->", !isInvalidTypePassed ? "PASS (Blocked)" : "FAIL");
npm notice run
npm notice run   // 3. Invalid Emotion Guard
npm notice run   const invalidEmotion = 9999 as any;
npm notice run   const isInvalidEmotionPassed = Object.values(ChatEmotion).includes(invalidEmotion);
npm notice run   console.log("3. Out-of-Bounds Emotion ->", !isInvalidEmotionPassed ? "PASS (Blocked)" : "FAIL");
npm notice run
npm notice run   // 4. Blank Emotion Support Check (-1)
npm notice run   const isBlankEmotionPassed = Object.values(ChatEmotion).includes(ChatEmotion.BLANK);
npm notice run   console.log("4. Neutral Blank Emotion (-1) ->", isBlankEmotionPassed ? "PASS (Supported)" : "FAIL");
npm notice run }
npm notice run
npm notice run runInMemoryCheck();
--- Issue #991 FORM_AN_INNER_CONNECTION Validation ---
1. Valid Response & Emotion Payload -> PASS (Accepted)
2. Unsupported Response Type -> PASS (Blocked)
3. Out-of-Bounds Emotion -> PASS (Blocked)
4. Neutral Blank Emotion (-1) -> PASS (Supported)
[capomk@lianli Altzone-Server]$

Brief description

Implemented server-side tracking and logic for the 1-step FORM_AN_INNER_CONNECTION daily task. The task credits progress when a player sends a valid, successfully persisted clan chat message containing a supported predefined ChatResponseType and ChatEmotion.

Change list

  • Task Configuration: Updated FORM_AN_INNER_CONNECTION to a fixed 1-step daily task (amount: 1) with updated Finnish instruction text.

  • Enums & Types: Added/aligned ChatResponseType (16 supported response strings) and ChatEmotion (-1 to 4) contracts.

  • Validation & Task Event Emission:

  • Ensured ChatGateway.handleClanMessage() validates responseType and emotion payloads before persisting the message.

  • Sequenced the FORM_AN_INNER_CONNECTION daily task event emission to trigger strictly after successful message persistence.

  • Restricted task progression exclusively to clan chat messages (excluding global/private chat, reactions, edits, and deletions).

  • Service Logic: Handled task advancement, clan ownership verification, and automatic task completion/reward flow in DailyTasksService.

  • Unit Tests: Added unit test suite in formAnInnerConnection.test.ts covering successful completion, guard validations, clan ownership checks, and persistence failures.

@CapoMK25 CapoMK25 changed the title WIP: Moving to FORM_AN_INNER_CONNECTION to another device FORM_AN_INNER_CONNECTION to another device Sep 23, 2026
@codecov-alt

codecov-alt Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/dailyTasks/dailyTasks.service.ts 75.40% <100.00%> (+14.39%) ⬆️
src/dailyTasks/taskGenerator.service.ts 95.52% <100.00%> (+0.06%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CapoMK25 CapoMK25 changed the title FORM_AN_INNER_CONNECTION to another device FORM_AN_INNER_CONNECTION Sep 23, 2026

@tickBit tickBit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and clean to me 👍 ! Approved.

@github-project-automation github-project-automation Bot moved this from Backlog to Done in Altzone-Server Sep 25, 2026
@tickBit
tickBit merged commit cff7441 into dev Sep 25, 2026
5 checks passed
@tickBit
tickBit deleted the 991-feature-request-implement-daily-task-form_an_inner_connection branch September 25, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature request: Implement daily task FORM_AN_INNER_CONNECTION

2 participants