Skip to content

Commit 57d9bdc

Browse files
committed
unify monorepo docs
1 parent 002890a commit 57d9bdc

File tree

2 files changed

+92
-71
lines changed

2 files changed

+92
-71
lines changed

docs/monorepo-architecture.md

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,25 @@ node-sdk/
3131
## Packages
3232

3333
### @transloadit/node
34+
3435
- Canonical runtime implementation.
3536
- Used as the source for the legacy `transloadit` wrapper.
3637

3738
### transloadit
39+
3840
- Publishes the legacy package name.
3941
- Built from the same runtime artifacts as `@transloadit/node`.
4042
- Compatibility is verified via tarball fingerprinting.
4143
- Allowed drift is limited to `package.json` metadata and is reported explicitly.
4244

4345
### @transloadit/types
46+
4447
- Pure type package; no Zod runtime dependency.
4548
- Types are generated from Zod v3 schemas into `.d.ts` only.
4649
- Consumers get fast type‑checking without pulling in Node or Zod.
4750

4851
### @transloadit/zod
52+
4953
- Publishes Zod schemas for runtime validation.
5054
- Versioned exports:
5155
- `@transloadit/zod/v3/*`
@@ -54,11 +58,13 @@ node-sdk/
5458
## Zod sync & generation pipeline
5559

5660
### v3 sync (`packages/zod/scripts/sync-v3.ts`)
61+
5762
- Copies alphalib types into `packages/zod/src/v3`.
5863
- Rewrites `zod` imports to `zod/v3`.
5964
- Writes the v3 `index.ts` barrel.
6065

6166
### v4 sync (`packages/zod/scripts/sync-v4.ts`)
67+
6268
- Transforms `src/v3` into `src/v4`.
6369
- Rewrites imports to `zod/v4` and applies compatibility patches:
6470
- `z.record(...)` gets explicit string key types for v4.
@@ -67,17 +73,19 @@ node-sdk/
6773
- Known ai‑chat schema differences are patched (JSON value output + tool‑result optionality).
6874

6975
### Generated sources
76+
7077
- `packages/zod/src/v3` and `packages/zod/src/v4` are generated and git‑ignored.
7178
- Build output is emitted to `packages/zod/dist`.
7279

7380
## Validation gates
7481

75-
1) **Type equality**
82+
1. **Type equality**
83+
7684
- `packages/zod/test/type-equality-v3.ts`
7785
- `packages/zod/test/type-equality-v4.ts`
7886
- These assert `z.infer` output matches `@transloadit/types` exactly (non‑distributive mutual assignability).
7987

80-
2) **Runtime parity**
88+
2. **Runtime parity**
8189
- `packages/zod/test/runtime-parity.test.ts`
8290
- Uses fixtures from `packages/zod/test/fixtures/assembly-instructions.ts` and checks v3/v4 success parity.
8391

@@ -104,6 +112,88 @@ The `transloadit` tarball is compared against a recorded baseline:
104112

105113
Only `package.json` metadata drift is currently allowed; any other file difference fails the check.
106114

115+
## TODO
116+
117+
### Compatibility verification (byte-for-byte)
118+
119+
- [x] Baseline: run `npm pack` or `yarn pack` from current `transloadit`
120+
- [x] Record tarball SHA256
121+
- [x] Record file list + sizes + per-file SHA256 inside tarball
122+
- [x] Record `package.json` fields that affect install (name, version, main, types, exports, files)
123+
- [x] After refactor: run `yarn workspace transloadit pack`
124+
- [x] Compute same fingerprint
125+
- [x] Assert byte-for-byte identity
126+
127+
### Fingerprint script
128+
129+
- [x] Add `scripts/fingerprint-pack.ts`
130+
- [x] Use `npm pack --json` to get tarball name
131+
- [x] Hash the tarball SHA256
132+
- [x] Hash each file via `tar -tf` + `tar -xOf`
133+
- [x] Output JSON artifact for comparison
134+
- [x] Support `node scripts/fingerprint-pack.ts .`
135+
- [x] Support `node scripts/fingerprint-pack.ts packages/transloadit`
136+
137+
### Versioning and releases
138+
139+
- [x] Add Changesets at workspace root
140+
- [x] Use `yarn changeset` for changes
141+
- [x] Use `yarn changeset version` to bump versions
142+
- [ ] Use `yarn changeset publish` to publish packages
143+
- [x] Keep `transloadit` and `@transloadit/node` versions synchronized
144+
- [x] Decide whether `@transloadit/types` tracks same version or diverges
145+
146+
### Implementation phases
147+
148+
#### Phase 1: monorepo scaffolding
149+
150+
- [x] Add root workspace config
151+
- [x] Add Changesets config
152+
- [x] Add base tsconfig
153+
- [x] Move current package to `packages/node`
154+
- [x] Ensure existing build/test scripts still pass
155+
156+
#### Phase 2: @transloadit/types (re-export alphalib)
157+
158+
- [x] Keep alphalib as synced source of truth
159+
- [x] Re-export from `src/alphalib/types` via TS path mapping or barrel files
160+
- [x] Build `.d.ts` only, no runtime JS
161+
162+
#### Phase 3: @transloadit/zod
163+
164+
- [x] Generate Zod schemas in `packages/zod` from alphalib types
165+
- [x] Depend on `zod`
166+
167+
#### Phase 4: transloadit wrapper
168+
169+
- [x] Publish identical output to `@transloadit/node`
170+
- [x] Copy dist + transform `package.json`
171+
- [ ] Confirm publish via Changesets
172+
173+
#### Phase 5: compatibility validation
174+
175+
- [x] Record baseline fingerprint from current `transloadit`
176+
- [x] Validate refactor output matches baseline (except package name if applicable)
177+
178+
### Cross-repo validation
179+
180+
- [x] Trial the updated robot schemas in alphalib within `~/code/content` and `~/code/api2`, then run `yarn check` in both repos
181+
182+
### Refactors
183+
184+
- [x] Unify pack/build orchestration into a single script used by CI + local pack
185+
- [x] Align `@transloadit/types` export map with the generated layout (keep subpath imports stable)
186+
- [x] Centralize Zod sync export list/extension to avoid drift
187+
- [x] Document inline heavy-inference casts (helper wrappers trigger TS7056)
188+
- [x] Keep legacy `transloadit` metadata synced from `@transloadit/node` with one source of truth
189+
190+
### Zod v4 parity hardening
191+
192+
- [x] Add runtime parity fixtures by copying proven Assembly Instructions from `~/code/content` (stepParsing fixtures)
193+
- [x] Add a sync-v4 regression fixture to verify `.passthrough()``.catchall(z.unknown())` and `z.record(...)` key injection
194+
- [x] Add runtime parity coverage for `assemblyStatus` (ok/error/busy) once stable samples are selected
195+
- [x] Add a CI guard that `@transloadit/zod` exports list stays in sync with `packages/node/src/alphalib/types`
196+
107197
## Future extensions
108198

109199
- Add JSON Schema export for v4 (`@transloadit/jsonschema` or subpath) once v4 tooling is stable.

docs/todo.md

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

0 commit comments

Comments
 (0)