Skip to content

Commit 5f8d9a4

Browse files
authored
feat: ship stoopid-logging v0.1 across Python, TypeScript, and Rust (#12)
* feat: ship stoopid-logging v0.1 across Python, TypeScript, and Rust Implements the foundation phase's first deliverable: the three `stoopid-logging` packages (`-py`, `-ts`, `-rs`) plus the shared JSON schema they all emit against, plus the ADR resolving [ADR-0004](docs/adrs/0004-shared-logging-json-schema.md)'s two open design questions. All three packages emit JSON conforming to a single contract. The schema is closed at the top level (`additionalProperties: false`); user-supplied bindings nest under `context`; OpenTelemetry `trace_id`/`span_id` auto-populate at the top level when an OTel SDK is loaded and a span is active. * style: apply prettier defaults across repo * ci: remove docker checks until base packages need them The docker job, docker.yml workflow, and hadolint pre-commit hook all gated on Dockerfile changes but also triggered on workflow edits, so they ran on every PR with no Dockerfile to lint. Drop them; re-add via PR when a Dockerfile lands. * ci(typescript): build packages before tsc --noEmit The root tsconfig includes examples/ts-*/**/*.ts which import stoopid-logging by name. pnpm symlinks the workspace package, but its types field points to ./dist/index.d.ts, so tsc fails to resolve types until the package is built. * ci: bump commitlint body/footer line length to 200 * ci(coverage): point diff-cover at jest's per-package cobertura output jest writes coverage to <pkg>/coverage/cobertura-coverage.xml because it runs in each workspace package's cwd, but the workflow looked for it at the repo root. diff-cover failed to find it, no markdown report was written, and the sticky-comment step then failed with the misleading "Either message or path input is required". Discover all per-package cobertura files via find so this scales as more TS packages land. * test(stoopid-logging-rs): bring changed-line coverage from 46% → 92% Adds inline unit tests for the env-var helpers (resolve_level, resolve_service_name, resolve_service_version), the layer's level_to_str/normalize_ts/JsonVisitor primitives, and a new tests/builder_init.rs integration suite for the Builder/init/try_init public surface. Adds serial_test as a dev-dep so the env-reading helpers can be tested without races against the existing emit_and_validate suite. * style(stoopid-logging-rs): apply rustfmt to new test code * fix(stoopid-logging-rs): resolve clippy lints on new tests - doc_markdown: backtick identifiers (try_init, AlreadyInitialized, LOG_LEVEL) in tests/builder_init.rs doc comments - match_wildcard_for_single_variants: bind the unmatched arm to AlreadyInitialized explicitly in resolve_level_unknown_returns_error - float_equality_without_abs: wrap the subtraction (not the operand) in .abs() for the f64 assertions in JsonVisitor tests
1 parent 784bc68 commit 5f8d9a4

79 files changed

Lines changed: 10013 additions & 310 deletions

Some content is hidden

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

.github/workflows/adr-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- "scripts/adr-lint.py"
88
- ".github/workflows/adr-lint.yml"
99
push:
10-
branches: [ main ]
10+
branches: [main]
1111
paths:
1212
- "docs/adrs/**"
1313
- "scripts/adr-lint.py"

.github/workflows/ci.yml

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66
push:
7-
branches: [ main ]
7+
branches: [main]
88

99
# Cancel in-progress runs for the same branch when a new commit is pushed
1010
concurrency:
@@ -27,7 +27,6 @@ jobs:
2727
typescript: ${{ steps.filter.outputs.typescript }}
2828
rust: ${{ steps.filter.outputs.rust }}
2929
terraform: ${{ steps.filter.outputs.terraform }}
30-
docker: ${{ steps.filter.outputs.docker }}
3130
workflows: ${{ steps.filter.outputs.workflows }}
3231
steps:
3332
- uses: actions/checkout@v6
@@ -65,12 +64,6 @@ jobs:
6564
- '**/*.tfvars'
6665
- '**/*.hcl'
6766
- '.terraform-version'
68-
docker:
69-
- '**/Dockerfile'
70-
- '**/Dockerfile.*'
71-
- '**/.dockerignore'
72-
- '**/docker-compose*.yml'
73-
- '**/compose*.yml'
7467
workflows:
7568
- '.github/workflows/**'
7669
- '.github/actions/**'
@@ -155,6 +148,9 @@ jobs:
155148
- name: Format check
156149
run: pnpm exec prettier --check .
157150

151+
- name: Build (emits dist/ + .d.ts that examples consume)
152+
run: pnpm -r --if-present run build
153+
158154
- name: Type check
159155
run: pnpm exec tsc --noEmit
160156

@@ -233,31 +229,13 @@ jobs:
233229
echo "::endgroup::"
234230
done
235231
236-
# ===========================================================================
237-
# Docker: lint Dockerfiles
238-
# ===========================================================================
239-
docker:
240-
name: Docker
241-
needs: changes
242-
if: needs.changes.outputs.docker == 'true' || needs.changes.outputs.workflows ==
243-
'true'
244-
runs-on: ubuntu-latest
245-
steps:
246-
- uses: actions/checkout@v6
247-
248-
- name: Lint Dockerfiles (hadolint)
249-
uses: hadolint/hadolint-action@v3.3.0
250-
with:
251-
recursive: true
252-
ignore: DL3008,DL3018 # version-pin warnings; tune per project
253-
254232
# ===========================================================================
255233
# Aggregator — single required check that gates merge
256234
# ===========================================================================
257235
ci-passed:
258236
name: CI passed
259237
runs-on: ubuntu-latest
260-
needs: [ changes, python, typescript, rust, terraform, docker ]
238+
needs: [changes, python, typescript, rust, terraform]
261239
if: always()
262240
steps:
263241
- name: Verify all required jobs succeeded or were skipped

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CodeQL
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88
schedule:
99
# Weekly scan, Monday 08:00 ET (12:00 UTC standard / 13:00 UTC EDT)
1010
- cron: "0 13 * * 1"

.github/workflows/commit-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Commit Lint
22

33
on:
44
pull_request:
5-
branches: [ main ]
6-
types: [ opened, reopened, synchronize ]
5+
branches: [main]
6+
types: [opened, reopened, synchronize]
77

88
permissions:
99
contents: read
@@ -36,8 +36,8 @@ jobs:
3636
rules: {
3737
'subject-case': [2, 'never', ['upper-case', 'pascal-case', 'start-case']],
3838
'header-max-length': [2, 'always', 100],
39-
'body-max-line-length': [2, 'always', 100],
40-
'footer-max-line-length': [2, 'always', 100],
39+
'body-max-line-length': [2, 'always', 200],
40+
'footer-max-line-length': [2, 'always', 200],
4141
},
4242
};
4343
EOF

.github/workflows/coverage.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Coverage
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66
push:
7-
branches: [ main ]
7+
branches: [main]
88

99
concurrency:
1010
group: coverage-${{ github.workflow }}-${{ github.ref }}
@@ -158,7 +158,16 @@ jobs:
158158
- name: Enforce coverage on changed lines
159159
if: github.event_name == 'pull_request'
160160
run: |
161-
diff-cover coverage/cobertura-coverage.xml \
161+
# jest writes coverage under each package's <pkg>/coverage/. Discover
162+
# all per-package cobertura files and pass them to diff-cover.
163+
mapfile -t cov_files < <(find . -path '*/coverage/cobertura-coverage.xml' \
164+
-not -path '*/node_modules/*' | sort)
165+
if [ "${#cov_files[@]}" -eq 0 ]; then
166+
echo "::error::no cobertura-coverage.xml found under any package's coverage/ dir"
167+
exit 1
168+
fi
169+
echo "Coverage inputs: ${cov_files[*]}"
170+
diff-cover "${cov_files[@]}" \
162171
--compare-branch=origin/${{ github.base_ref }} \
163172
--fail-under=${{ env.COVERAGE_THRESHOLD }} \
164173
--html-report=diff-cover-typescript.html \
@@ -252,7 +261,7 @@ jobs:
252261
coverage-passed:
253262
name: Coverage passed
254263
runs-on: ubuntu-latest
255-
needs: [ changes, python, typescript, rust ]
264+
needs: [changes, python, typescript, rust]
256265
if: always()
257266
steps:
258267
- name: Verify all coverage jobs succeeded or were skipped

.github/workflows/docker.yml

Lines changed: 0 additions & 218 deletions
This file was deleted.

.github/workflows/pr-title.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: PR Title Lint
22

33
on:
44
pull_request_target:
5-
branches: [ main ]
6-
types: [ opened, edited, reopened, synchronize ]
5+
branches: [main]
6+
types: [opened, edited, reopened, synchronize]
77

88
permissions:
99
contents: read

0 commit comments

Comments
 (0)