refactor(management): clean up structural indirection across lib #111

Merged
yuris merged 2 commits from refactor/110-clean-structural-indirection into main 2026-09-28 19:27:23 +00:00
Owner

Closes #110.

What changed

  • Deleted apps/management/lib/types/index.ts and migrated 12 callers to direct domain slice imports.
  • Consolidated apps/management/lib/connectors/whatsapp-wwebjs/ and apps/management/lib/messaging/ into apps/management/lib/whatsapp/ (client.ts, types.ts, webhook.ts) and removed obsolete directories.
  • Pruned narrative narration, obsolete banner headers, and redundant JSDoc signatures in apps/management/lib/.

Verified

  • pnpm --filter=garage exec tsc --noEmit: 0 errors
  • pnpm --filter=garage test: 19 test files passed (431 tests)
  • .forgejo/scripts/biome-gate.sh: PASSED

Deviations

None.

Closes #110. ## What changed - Deleted apps/management/lib/types/index.ts and migrated 12 callers to direct domain slice imports. - Consolidated apps/management/lib/connectors/whatsapp-wwebjs/ and apps/management/lib/messaging/ into apps/management/lib/whatsapp/ (client.ts, types.ts, webhook.ts) and removed obsolete directories. - Pruned narrative narration, obsolete banner headers, and redundant JSDoc signatures in apps/management/lib/. ## Verified - `pnpm --filter=garage exec tsc --noEmit`: 0 errors - `pnpm --filter=garage test`: 19 test files passed (431 tests) - `.forgejo/scripts/biome-gate.sh`: PASSED ## Deviations None.
refactor(management): clean up structural indirection across lib
All checks were successful
Checks / test @garage/catalog (pull_request) Successful in 1m14s
Checks / test garage (pull_request) Successful in 1m24s
Checks / test garage-store (pull_request) Successful in 1m19s
Checks / typecheck apps/management (pull_request) Successful in 1m39s
Checks / lint (biome) (pull_request) Successful in 12s
Checks / typecheck apps/store (pull_request) Successful in 1m22s
893a19bd4c
yuris left a comment

VERDICT: request-changes
apps/management/lib/whatsapp/webhook.ts:L63: should: An incoming message with type constructor, toString, or __proto__ now passes the object lookup through inherited properties and reaches the bot instead of being discarded as it was by Set.has. Restore the Set or use Object.hasOwn(ALLOWED_TYPES, msg.type).

The deleted type barrel and WhatsApp directories have no remaining references in the repository, and the new payload is routed through the existing webhook and bot consumers. The PR description reports 431 passing tests, a clean management typecheck, and a passing Biome gate; I did not rerun commands in this read-only review, and the Forgejo status API still lists the management typecheck and lint jobs as pending. pnpm verify:management is not documented as having been run.

VERDICT: request-changes apps/management/lib/whatsapp/webhook.ts:L63: should: An incoming message with type `constructor`, `toString`, or `__proto__` now passes the object lookup through inherited properties and reaches the bot instead of being discarded as it was by `Set.has`. Restore the Set or use `Object.hasOwn(ALLOWED_TYPES, msg.type)`. The deleted type barrel and WhatsApp directories have no remaining references in the repository, and the new payload is routed through the existing webhook and bot consumers. The PR description reports 431 passing tests, a clean management typecheck, and a passing Biome gate; I did not rerun commands in this read-only review, and the Forgejo status API still lists the management typecheck and lint jobs as pending. `pnpm verify:management` is not documented as having been run.
fix(whatsapp): guard against inherited properties in ALLOWED_TYPES check
All checks were successful
Checks / lint (biome) (pull_request) Successful in 11s
Checks / test @garage/catalog (pull_request) Successful in 1m15s
Checks / test garage (pull_request) Successful in 1m24s
Checks / test garage-store (pull_request) Successful in 1m17s
Checks / typecheck apps/management (pull_request) Successful in 1m40s
Checks / typecheck apps/store (pull_request) Successful in 1m20s
fa5fd44b67
Author
Owner

Round 1 addressed

  • Updated ALLOWED_TYPES filter in apps/management/lib/whatsapp/webhook.ts to !Object.hasOwn(ALLOWED_TYPES, msg.type) so inherited property names (constructor, toString, __proto__, etc.) cannot bypass the webhook type filter.
  • Re-verified:
    • pnpm --filter=garage exec tsc --noEmit: 0 errors
    • pnpm --filter=garage test: 19 test files passed (431 tests)
    • .forgejo/scripts/biome-gate.sh: PASSED
## Round 1 addressed - Updated `ALLOWED_TYPES` filter in `apps/management/lib/whatsapp/webhook.ts` to `!Object.hasOwn(ALLOWED_TYPES, msg.type)` so inherited property names (`constructor`, `toString`, `__proto__`, etc.) cannot bypass the webhook type filter. - Re-verified: - `pnpm --filter=garage exec tsc --noEmit`: 0 errors - `pnpm --filter=garage test`: 19 test files passed (431 tests) - `.forgejo/scripts/biome-gate.sh`: PASSED
yuris left a comment

VERDICT: approve
The Round 1 finding is resolved in fa5fd44: Object.hasOwn rejects inherited property names while retaining the existing allowed message types. Re-reviewed the follow-up change only; no further issues found.

VERDICT: approve The Round 1 finding is resolved in fa5fd44: Object.hasOwn rejects inherited property names while retaining the existing allowed message types. Re-reviewed the follow-up change only; no further issues found.
Author
Owner

Pre-merge Verification Summary

  • pnpm --filter=garage exec tsc --noEmit: 0 errors
  • pnpm --filter=garage test: 19 test files passed (431 tests)
  • .forgejo/scripts/biome-gate.sh: PASSED (32 findings vs 34 baseline)
  • Review verdict: approve (Review 106)
  • pr.mergeable: true

Notice: Merging this pull request into main triggers production image build and deployment for the management service.

## Pre-merge Verification Summary - `pnpm --filter=garage exec tsc --noEmit`: 0 errors - `pnpm --filter=garage test`: 19 test files passed (431 tests) - `.forgejo/scripts/biome-gate.sh`: PASSED (32 findings vs 34 baseline) - Review verdict: `approve` (Review 106) - `pr.mergeable`: `true` > **Notice**: Merging this pull request into `main` triggers production image build and deployment for the management service.
yuris merged commit 467d38fbd3 into main 2026-09-28 19:27:23 +00:00
yuris deleted branch refactor/110-clean-structural-indirection 2026-09-28 19:27:23 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage!111
No description provided.