Skip to content

Commit 877247e

Browse files
saby1101claude
andcommitted
chore: upgrades and quality gates for 2.16.0
@google-cloud/storage 7 -> 8. Verified the eight methods the code calls still exist on the real client, since the suite mocks GCS and cannot catch an API change. Fixes #11: src/types.ts now augments FastifyInstance with FileStore, and index.ts imports it. Nothing referenced types.ts before, so even the existing FastifySchema augmentation never reached consumers. Verified by building wms against a packed candidate: 0 errors across all 23 projects, so the merge with wms's own declaration is safe. ts-jest type checking is on. Removing diagnostics:false surfaced four unsafe casts in the specs. Enabling it needs an explicit types:[jest,node], and warning 151002 is ignored because its suggested fix zeroes function coverage for index.ts. Coverage threshold pinned at 100 so a regression fails rather than being reported and ignored; bail removed so CI shows every failure. ESLint added — there was no linting at all. Type-aware rules on src, relaxed for the provider file and specs where SDK and mock types are any by nature. A MinIO integration test covers the real S3 wire protocol. Skipped unless MINIO_TEST_ENDPOINT is set, so the default suite needs no Docker. The mocked suite could not have caught the NoSuchKey/NotFound mismatch fixed in #9. CI runs lint and build alongside tests; Sonar now runs on pull requests instead of only after merge. Dependabot watches npm, not just actions. Deleted the event-bus plan docs describing a plugin removed in c001efc. skipLibCheck stays on: disabling it fails on thread-stream's .d.ts, not our code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent f39f33d commit 877247e

18 files changed

Lines changed: 1045 additions & 1654 deletions

‎.github/dependabot.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
groups:
9+
# One PR per ecosystem keeps review manageable; majors stay separate so a
10+
# breaking change is never bundled with routine patches.
11+
aws-sdk:
12+
patterns: ["@aws-sdk/*"]
13+
update-types: ["minor", "patch"]
14+
azure-sdk:
15+
patterns: ["@azure/*"]
16+
update-types: ["minor", "patch"]
17+
dev-tooling:
18+
dependency-type: development
19+
update-types: ["minor", "patch"]
20+
- package-ecosystem: github-actions
21+
directory: /
22+
schedule:
23+
interval: weekly

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
pull_request:
78

89
jobs:
910
build:

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ jobs:
2020
node-version: ${{ env.NODE_VERSION }}
2121
cache: pnpm
2222
- run: pnpm install --frozen-lockfile
23+
- run: pnpm run lint
24+
- run: pnpm run build
2325
- run: pnpm test

‎CLAUDE.md‎

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
77
- **Build**: `pnpm run build` — cleans `dist` and compiles TypeScript
88
- **Test**: `pnpm test` — runs the Jest suite
99
- **Test with coverage**: `pnpm run test:coverage`
10+
- **Lint**: `pnpm run lint` (`pnpm run lint:fix` to autofix)
11+
- **Integration test**: `pnpm run test:integration` — needs MinIO, see below
1012
- **Format code**: `pnpm run pretty` — Prettier over `src/**`
1113
- **Clean**: `pnpm run clean` — removes `dist`
1214
- **Transpile**: `pnpm run transpile` — TypeScript compilation only
1315

1416
These are the only scripts defined in `package.json`. CI (`.github/workflows/`) runs
15-
`pnpm install --frozen-lockfile` + `pnpm test` on Node 24; the package declares
17+
`pnpm install --frozen-lockfile`, then lint, build and test on Node 24; the package declares
1618
`engines: node >=22`.
1719

1820
**pnpm only** — never npm or yarn. `pnpm-lock.yaml` is committed and CI installs
@@ -30,12 +32,13 @@ plugin for Stackbox applications.
3032
- **File Store Plugin** (`src/file-store.ts`): cloud storage abstraction over AWS S3,
3133
GCS, Azure Blob Storage, MinIO, and the local filesystem
3234
- **`src/utils.ts`**: `streamToBuffer`, safe with both buffer- and string-mode streams
33-
- **`src/types.ts`**: augments `FastifySchema` with `operationId` / `summary` /
34-
`description`; imported for its side effect
35+
- **`src/types.ts`**: augments `FastifySchema` and adds `FastifyInstance.FileStore`.
36+
`index.ts` imports it for its side effect — without that import the augmentations
37+
never reach consumers, since TypeScript only applies them if the declaring file is
38+
pulled into the consumer's compilation.
3539

3640
An event-bus plugin (RabbitMQ / GCP Pub/Sub / Azure Service Bus / NATS JetStream)
37-
used to live here and was removed in `c001efc`. Ignore references to it in
38-
`docs/superpowers/plans/` — those are historical planning records, not current design.
41+
used to live here and was removed in `c001efc`.
3942

4043
### File Store System
4144

@@ -58,8 +61,23 @@ provider: `file-store.local.spec.ts`, `.gcs.`, `.s3.`, `.azure.`, plus the origi
5861
`file-store.spec.ts` and `integration.spec.ts`. Coverage is 100% on statements,
5962
branches, functions and lines — keep it there.
6063

61-
Cloud SDKs are mocked with `jest.mock(...)`; only `LocalFileStore` is exercised
62-
against the real filesystem, using temp dirs. No test performs real network I/O.
64+
Cloud SDKs are mocked with `jest.mock(...)`; `LocalFileStore` runs against the real
65+
filesystem in temp dirs.
66+
67+
`file-store.minio.integration.spec.ts` is the one test that speaks a real S3 wire
68+
protocol. It is skipped unless `MINIO_TEST_ENDPOINT` is set, so the default suite
69+
needs no Docker:
70+
71+
```bash
72+
docker run -d --name fp-minio -p 19000:9000 \
73+
-e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin \
74+
minio/minio:latest server /data
75+
pnpm run test:integration
76+
```
77+
78+
Mocked tests cannot catch a behavioural change in an SDK — the NoSuchKey/NotFound
79+
mismatch fixed in #9 was invisible to them. Add to the integration spec when touching
80+
S3 or MinIO behaviour.
6381

6482
## Build Configuration
6583

@@ -87,12 +105,17 @@ the issue thread or the PR that resolves it.
87105
expand on compile, so coverage gets attributed to imports and comments and reads
88106
several points low. `jest.config.js` overrides `sourceMap: true` for the transform
89107
only. Do not remove it or coverage numbers become meaningless.
90-
- **`diagnostics: false` in `jest.config.js`** suppresses TypeScript errors during
91-
test runs, which masks real type gaps — see issue #11.
108+
- **ts-jest type checking is on.** `diagnostics: false` used to suppress TypeScript
109+
errors in tests, which is how the missing `FastifyInstance` augmentation went
110+
unnoticed. Only ts-jest config warning 151002 is ignored: the fix it suggests
111+
(`isolatedModules: true`) zeroes function coverage for `index.ts`.
112+
- **`types: ["jest", "node"]`** is set explicitly in the ts-jest tsconfig override.
113+
Without it, enabling diagnostics fails every spec with `Cannot find name 'describe'`.
92114
- **Pre-commit hooks**: Husky + lint-staged run Prettier on staged
93115
`.js/.ts/.json/.md` files.
94-
- **`tsconfig.build.json` sets `skipLibCheck: true`** — a workaround retained from
95-
when this package depended on `@nats-io/jetstream`.
116+
- **`tsconfig.build.json` sets `skipLibCheck: true`** — still required. Turning it off
117+
fails on `thread-stream@4.2.0` (a pino dependency), whose `.d.ts` references
118+
`TransferListItem`, a name its `worker_threads` types do not export.
96119
- **Releasing**: version bumps happen on `main`, in their own commit named just the
97120
version (`2.16.0`). Do not put a version bump in a feature PR and do not create
98121
tags by hand — publishing is triggered by creating a GitHub Release. See

‎CONTRIBUTING.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ updated lockfile.
2020

2121
- `main` requires one approving review, and `require_last_push_approval` is set — any
2222
push after an approval dismisses it, so get the branch final before requesting review.
23-
- Keep coverage at 100%; `pnpm run test:coverage` reports it.
23+
- Keep coverage at 100% — `jest.config.js` enforces it as a threshold, so a drop
24+
fails the build rather than being reported and ignored.
25+
- `pnpm run lint` must pass; CI runs lint, build and test.
26+
- Touching S3 or MinIO behaviour? Run the integration suite against real MinIO:
27+
```bash
28+
docker run -d --name fp-minio -p 19000:9000 \
29+
-e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin \
30+
minio/minio:latest server /data
31+
pnpm run test:integration
32+
```
2433
- Bugs and follow-ups go in **GitHub issues**, not a tracked file in the repo.
2534

2635
## Releases

0 commit comments

Comments
 (0)