Skip to content

Commit a0ff153

Browse files
committed
feat(libs/Logging): add logging library, integrate datadog, replace it in webapp
1 parent dd77654 commit a0ff153

File tree

111 files changed

+15221
-589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+15221
-589
lines changed

.github/copilot-instructions.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ apps/
1111
│ └── app-config/ # Webapp configuration
1212
└── server/ # Node.js/Express backend API
1313
└── src/ # Server source code
14+
libraries/ # Shared libraries
15+
└── Logger/ # Unified logging library
1416
docs/ # Project documentation
1517
package.json # Root dependencies (use yarn commands)
1618
```
@@ -44,32 +46,25 @@ Use these exact formats:
4446

4547
ALWAYS verify these items in EVERY PR:
4648

47-
✓ Input validation and sanitization
48-
✓ API response validation and error handling
49-
✓ No dangerouslySetInnerHTML without sanitization
50-
✓ No hardcoded secrets, tokens, or API keys
51-
✓ Safe URL handling and redirect validation
52-
✓ Proper authentication and authorization
49+
✓ Input validation and sanitization ✓ API response validation and error handling ✓ No dangerouslySetInnerHTML without sanitization ✓ No hardcoded secrets, tokens, or API keys ✓ Safe URL handling and redirect validation ✓ Proper authentication and authorization
5350

5451
## ACCESSIBILITY CHECKLIST
5552

5653
For UI changes in apps/webapp/src/:
5754

58-
✓ Keyboard navigation (Tab, Enter, Space, Escape, Arrow keys)
59-
✓ Focus management (visible focus, proper trapping in modals)
60-
✓ ARIA labels and roles (icon buttons need action-focused labels)
61-
✓ Form accessibility (labels tied to inputs, error descriptions)
62-
✓ Screen reader support (aria-live for dynamic content)
55+
✓ Keyboard navigation (Tab, Enter, Space, Escape, Arrow keys) ✓ Focus management (visible focus, proper trapping in modals) ✓ ARIA labels and roles (icon buttons need action-focused labels) ✓ Form accessibility (labels tied to inputs, error descriptions) ✓ Screen reader support (aria-live for dynamic content)
6356

6457
## REVIEW SCOPE
6558

6659
REVIEW these files:
60+
6761
- Security: All code changes (especially APIs and user input)
68-
- Accessibility: apps/webapp/src/**/*
69-
- TypeScript: apps/**/*.{ts,tsx}
70-
- React: apps/webapp/src/**/*.{tsx,jsx}
62+
- Accessibility: apps/webapp/src/\*_/_
63+
- TypeScript: apps/\*_/_.{ts,tsx}
64+
- React: apps/webapp/src/\*_/_.{tsx,jsx}
7165

7266
DO NOT REVIEW:
67+
7368
- Code formatting (handled by prettier/eslint)
7469
- Import ordering (automated)
7570
- Trivial naming preferences
@@ -81,29 +76,34 @@ DO NOT REVIEW:
8176

8277
## SPECIALIZED INSTRUCTION FILES
8378

84-
- Security: .github/instructions/security.instructions.md (apps/**/*)
85-
- Accessibility: .github/instructions/accessibility.instructions.md (apps/webapp/src/**/*)
86-
- React: .github/instructions/react.instructions.md (apps/webapp/src/**/*.{tsx,jsx})
87-
- TypeScript: .github/instructions/typescript.instructions.md (apps/**/*.{ts,tsx})
79+
- Security: .github/instructions/security.instructions.md (apps/\*_/_)
80+
- Accessibility: .github/instructions/accessibility.instructions.md (apps/webapp/src/\*_/_)
81+
- React: .github/instructions/react.instructions.md (apps/webapp/src/\*_/_.{tsx,jsx})
82+
- TypeScript: .github/instructions/typescript.instructions.md (apps/\*_/_.{ts,tsx})
8883

8984
## Pull Request Review Process
9085

9186
### When Reviewing PRs
87+
9288
**Your Approach:**
89+
9390
1. Review only the code changes shown in the diff
9491
2. Focus on security, accessibility, and critical functionality
9592
3. Use clear severity levels in comments
9693
4. Provide specific, actionable feedback with code examples when helpful
9794

9895
### Comment Guidelines
96+
9997
**Format each comment with:**
98+
10099
- Severity level: **[Blocker]**, **[Important]**, or **[Suggestion]**
101100
- File location and line numbers
102101
- Clear explanation of the issue
103102
- Specific fix suggestion when appropriate
104103

105104
**Example:**
106-
```
105+
106+
````
107107
**[Blocker]** - Security vulnerability in authentication.ts:45
108108
109109
The password validation logic allows empty strings. This could allow unauthorized access.
@@ -113,7 +113,8 @@ The password validation logic allows empty strings. This could allow unauthorize
113113
if (!password || password.trim().length === 0) {
114114
throw new Error('Password cannot be empty');
115115
}
116-
```
116+
````
117+
117118
```
118119
119120
### Security Review Checklist
@@ -151,3 +152,4 @@ When new dependencies are added:
151152
- Any **[Blocker]** issues exist
152153
- Critical security vulnerabilities are found
153154
- Essential accessibility features are missing
155+
```

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ updates:
6363
- dependency-name: 'typescript'
6464
- dependency-name: '@types/node'
6565

66+
# Logger library dependencies
67+
- package-ecosystem: npm
68+
directory: '/libraries/Logger'
69+
schedule:
70+
interval: weekly
71+
day: sunday
72+
time: '16:00'
73+
timezone: 'Europe/Berlin'
74+
open-pull-requests-limit: 99
75+
labels:
76+
- 'type: chore 🧹'
77+
ignore:
78+
- dependency-name: 'typescript'
79+
- dependency-name: '@types/node'
80+
6681
# Github actions
6782
- package-ecosystem: 'github-actions'
6883
directory: '/'

.github/labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
- 'apps/server/.*'
4040

4141
# Libraries
42+
'lib: logger':
43+
files:
44+
- 'libraries/Logger/.*'
4245

4346
# Components
4447
'comp: calling':
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Release Libraries
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
paths:
7+
- 'libraries/**'
8+
workflow_dispatch:
9+
inputs:
10+
force_publish:
11+
description: 'Force publish?'
12+
required: true
13+
default: false
14+
type: boolean
15+
16+
permissions:
17+
id-token: write # Required for NPM Trusted Publishing
18+
contents: write # Required for creating tags and releases
19+
20+
jobs:
21+
release_libraries:
22+
runs-on: ubuntu-latest
23+
env:
24+
COMMITTER: ${{ github.triggering_actor || github.actor }}
25+
COMMIT_URL: ${{ github.event.head_commit.url || format('{0}/{1}', github.server_url, github.repository) }}
26+
FORCE_PUBLISH: ${{ github.event.inputs.force_publish || false }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Set environment variables
35+
run: |
36+
echo "BRANCH_NAME=$(git branch --show-current)" >> $GITHUB_ENV
37+
echo "TAG=$(git tag --points-at ${{github.sha}})" >> $GITHUB_ENV
38+
echo "COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{github.sha}} | head -n 1)" >> $GITHUB_ENV
39+
40+
- name: Set TITLE
41+
env:
42+
PR_TITLE: ${{github.event.pull_request.title || env.COMMIT_MESSAGE}}
43+
run: echo "TITLE=$PR_TITLE" >> $GITHUB_ENV
44+
45+
- name: Print environment variables
46+
run: |
47+
echo -e "BRANCH_NAME = ${BRANCH_NAME}"
48+
echo -e "TAG = ${TAG}"
49+
echo -e "TITLE = ${TITLE}"
50+
echo -e "COMMIT_MESSAGE = ${COMMIT_MESSAGE}"
51+
echo -e "COMMIT_URL = ${COMMIT_URL}"
52+
echo -e "COMMITTER = ${COMMITTER}"
53+
echo -e "FORCE_PUBLISH = ${FORCE_PUBLISH}"
54+
55+
- name: Validate branch
56+
if: github.event_name == 'workflow_dispatch' && env.FORCE_PUBLISH == 'true'
57+
run: |
58+
echo "Validating branch (${BRANCH_NAME})..."
59+
60+
# Only allow manual publish from main
61+
if [[ "${BRANCH_NAME}" != "main" ]]; then
62+
echo "Error: Manual publish is only allowed from 'main' branch (got '${BRANCH_NAME}')."
63+
exit 1
64+
fi
65+
66+
echo "Branch validation passed ✅"
67+
68+
- name: Skip CI
69+
if: |
70+
contains(env.TITLE || env.COMMIT_MESSAGE, '[skip ci]') ||
71+
contains(env.TITLE || env.COMMIT_MESSAGE, '[ci skip]')
72+
uses: andymckay/cancel-action@0.4
73+
74+
- name: Setup Node.js
75+
uses: actions/setup-node@v6
76+
with:
77+
node-version-file: '.nvmrc'
78+
cache: 'yarn'
79+
registry-url: 'https://registry.npmjs.org'
80+
81+
- name: Install JS dependencies
82+
run: yarn --immutable
83+
84+
- name: Build libraries
85+
run: yarn nx run-many -t build --projects=libraries/*
86+
87+
- name: Test libraries
88+
run: yarn nx run-many -t test --projects=libraries/*
89+
90+
- name: Configure git user
91+
run: |
92+
git config --global user.name "${GITHUB_ACTOR}"
93+
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
94+
95+
# Automatic release on main (push / merge)
96+
- name: Release libraries (Trusted Publishing)
97+
if: |
98+
env.BRANCH_NAME == 'main' &&
99+
github.event_name != 'workflow_dispatch'
100+
env:
101+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
102+
run: yarn release:libs
103+
104+
# Manual force publish on main via "Run workflow" button
105+
- name: Manual force publish libraries (Trusted Publishing)
106+
if: |
107+
env.BRANCH_NAME == 'main' &&
108+
github.event_name == 'workflow_dispatch' &&
109+
env.FORCE_PUBLISH == 'true'
110+
env:
111+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
112+
run: yarn release:libs
113+
114+
- name: Notify CI error
115+
if: failure() && github.event_name != 'pull_request'
116+
uses: wireapp/github-action-wire-messenger@v2.0.0
117+
with:
118+
email: ${{secrets.WIRE_EMAIL}}
119+
password: ${{secrets.WIRE_PASSWORD}}
120+
conversation: 'b2cc7120-4154-4be4-b0c0-45a8c361c4d1'
121+
text: '🔴 Library release failed! ${{env.COMMITTER}} on "${{env.BRANCH_NAME}}" branch with [${{env.TITLE}}](${{env.COMMIT_URL}})'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.DS_Store
44
.idea
55
.vscode
6+
/plans
67
/config
78
/coverage
89
/keys

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apps/webapp/src/i18n/
22
.vscode/
3+
/charts
34
/config
45
/docs/auth-coverage
56
/docs/coverage

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,38 @@ Once translations are uploaded on Crowdin, our (and external) translators can tr
153153
1. Approve translation on Crowdin
154154
1. Run `yarn translate:download`
155155

156+
## Documentation
157+
158+
- [Adding New Projects](./docs/adding-new-projects.md) - Guide for adding libraries or applications to the monorepo
159+
- [Architecture Decision Records (ADRs)](./docs/ADRs/intro.md) - Historical context for architectural decisions
160+
- [Nx Monorepo Migration](./docs/ADRs/2025-12-29-nx-monorepo-migration.md)
161+
- [Unified Logging Library](./docs/ADRs/2025-12-29-unified-logging-library.md)
162+
- [Coding Standards](./docs/coding-standards.md)
163+
- [Accessibility Practices](./docs/accessibility-practices.md)
164+
- [Tech Radar](./docs/tech-radar.md)
165+
166+
## Releases
167+
168+
### Library Releases (Automated via GitHub Actions)
169+
170+
Libraries are published automatically when merged to `main` via the [Release Libraries workflow](./.github/workflows/release-libraries.yml):
171+
172+
```bash
173+
# Manual release commands (for local testing)
174+
yarn release:libs # Interactive release
175+
yarn release:libs:version # Version only
176+
yarn release:libs:publish # Publish only
177+
yarn release:libs:dry-run # Preview changes
178+
```
179+
180+
### Application Releases
181+
182+
```bash
183+
yarn release:staging # Release to staging
184+
yarn release:production # Release to production
185+
yarn release:custom # Custom release
186+
```
187+
156188
## Contributing
157189

158190
Contributions are welcome! Feel free to check our [issues page](https://github.com/wireapp/wire-webapp/issues).

apps/server/eslint.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Wire
3+
* Server ESLint configuration (ESLint 9+)
4+
*/
5+
6+
import path from 'path';
7+
import {createBaseConfig} from '../../eslint.config.base';
8+
import type {Linter} from 'eslint';
9+
10+
const __dirname = path.dirname(new URL(import.meta.url).pathname);
11+
const projectRoot = __dirname;
12+
13+
const config: Linter.Config[] = [
14+
...createBaseConfig({
15+
projectRoot: path.join(__dirname, '../..'), // workspace root
16+
tsconfigPath: path.join(projectRoot, 'tsconfig.json'),
17+
additionalIgnores: ['apps/server/bin/', 'apps/server/dist/', 'apps/server/node_modules/'],
18+
}),
19+
];
20+
21+
export default config;

apps/server/project.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
}
5252
}
5353
},
54+
"lint": {
55+
"executor": "nx:run-commands",
56+
"options": {
57+
"command": "eslint --quiet --config {projectRoot}/eslint.config.ts --ext .js,.ts {projectRoot}"
58+
}
59+
},
5460
"type-check": {
5561
"executor": "nx:run-commands",
5662
"options": {

0 commit comments

Comments
 (0)