CCM-12869: Excel to config parser#47
Conversation
+ fix event-builder tests
…ring literals for VolumeGroupId
…arsing Excel files
9e03d8f to
261a594
Compare
# Conflicts: # AGENTS.md # README.md # package-lock.json # packages/event-builder/jest.config.ts # packages/event-builder/src/__tests__/pack-specification-event-builder.test.ts # packages/event-builder/src/letter-variant-event-builder.ts # packages/event-builder/src/pack-specification-event-builder.ts # packages/event-builder/src/supplier-allocation-event-builder.ts # packages/event-builder/src/supplier-event-builder.ts # packages/event-builder/src/supplier-pack-event-builder.ts # packages/event-builder/src/volume-group-event-builder.ts # packages/events/package.json # packages/events/src/cli/generate-erd.ts # packages/events/src/cli/generate-json.ts # packages/events/src/domain/__tests__/specification.test.ts # packages/events/src/domain/constraint.ts # packages/events/src/domain/pack-specification.ts # packages/events/src/examples/specification-examples.ts
…rser/src/__tests__/helpers/parse-excel.ts and tightened packages/excel-parser/jest.config.ts so only real *.test.ts / *.spec.ts files under __tests__ are discovered by Jest. This keeps helpers colocated with tests without executing them as suites. Also fixed temp workbook filename collisions in the shared helper by switching to randomUUID()-based filenames, which resolved intermittent failures in the full npm run test:unit --workspace=@supplier-config/excel-parser run.
There was a problem hiding this comment.
Pull request overview
Adds a new @supplier-config/excel-parser workspace to generate/parse supplier-config Excel files and emit deterministic JSON (either a single JSON blob or a file-store-compatible directory). It also updates the file-store loader to decode filename-safe record IDs written by the new tooling, and tweaks CI/version detection and local tooling.
Changes:
- Add
packages/excel-parserwith parsing logic, template generator, CLIs, deterministic JSON output, and extensive unit tests. - Update
@supplier-config/file-storeloader/tests to decode percent-encoded record IDs from JSON filenames. - Update repo tooling/config (workflow change detection, Makefile helper target, gitignore, dependency lockfile).
Reviewed changes
Copilot reviewed 25 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/file-store/src/loader/config-store-loader.ts | Decode percent-encoded record IDs from .json filenames and add ESLint security suppressions for dynamic fs paths. |
| packages/file-store/src/tests/config-store-loader.test.ts | Add tests for decoding filename-safe IDs and rejecting invalid percent-encodings. |
| packages/excel-parser/tsconfig.json | New TS config for the excel-parser workspace. |
| packages/excel-parser/src/template.ts | Generate template .xlsx with expected sheets/headers. |
| packages/excel-parser/src/parse-excel.ts | Core Excel parsing into typed domain objects + Zod validation + ParseResult assembly. |
| packages/excel-parser/src/json-output.ts | Deterministic JSON stringify with recursively sorted object keys. |
| packages/excel-parser/src/index.ts | Public exports for parsing, template generation, and file-store output writer. |
| packages/excel-parser/src/config-store-output.ts | Write parse output as file-store directory structure with filename-safe (encoded) IDs and deterministic JSON. |
| packages/excel-parser/src/cli-template.ts | CLI for generating an Excel template file. |
| packages/excel-parser/src/cli-parse.ts | CLI for parsing Excel and emitting JSON/stdout/file-store directory. |
| packages/excel-parser/src/tests/template.test.ts | Unit tests for template workbook structure and overwrite behavior. |
| packages/excel-parser/src/tests/parse-excel.volume-groups.test.ts | Unit tests for parsing VolumeGroup rows (including dates/status defaults). |
| packages/excel-parser/src/tests/parse-excel.test.ts | Unit tests validating required sheet presence. |
| packages/excel-parser/src/tests/parse-excel.suppliers.test.ts | Unit tests for supplier/allocation/supplier-pack parsing and validation behaviors. |
| packages/excel-parser/src/tests/parse-excel.pack-specifications.test.ts | Unit tests for pack-spec parsing, constraints, assembly parsing, and date handling. |
| packages/excel-parser/src/tests/parse-excel.letter-variants.test.ts | Unit tests for letter-variant parsing, constraints, priority behavior, and validation. |
| packages/excel-parser/src/tests/json-output.test.ts | Unit tests ensuring stable/deterministic JSON serialization. |
| packages/excel-parser/src/tests/helpers/parse-excel.ts | Test helpers for building/writing workbooks used by parser tests. |
| packages/excel-parser/src/tests/config-store-output.test.ts | Integration-style tests verifying generated file-store output validates and round-trips IDs via file-store loader. |
| packages/excel-parser/package.json | New workspace package definition and scripts (parse/template/test/build). |
| packages/excel-parser/jest.config.ts | Jest config for excel-parser workspace (coverage/reporting/mappers). |
| packages/excel-parser/examples/example_specifications.xlsx | Example input workbook checked into the repo. |
| packages/excel-parser/README.md | Usage docs for CLI and programmatic APIs and file-store output format. |
| packages/events/src/domain/tests/specification-supplier.test.ts | New schema validation test around supplier pack approvals. |
| package-lock.json | Lockfile updates for new workspace and dependency changes. |
| Makefile | Add internal-config target to generate config-store artifacts from a local Excel file. |
| .gitignore | Ignore root specifications.xlsx and tilde-prefixed backup files. |
| .github/workflows/stage-1-commit.yaml | Adjust “events package changed” detection to ignore test-only changes under packages/events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…epresentation preserves raw record IDs as object keys instead of sanitizing them. This keeps the in-memory/JSON parse result faithful to the Excel source, while leaving filename-safe encoding confined to the file-store output path in config-store-output.ts. Updated the split parse-excel test suites to assert against raw ID keys for packs, variants, volume groups, suppliers, allocations, and supplier packs.
masl2
left a comment
There was a problem hiding this comment.
I'm not sure how about defaulting start dates (e.g. VolumeGroup start date) since they will tie to when a supplier/campaign etc is valid from (although somthing like prio makes sense)
However, LGTM
I'm not sure which date we would default to - pick a single date, or the date the config is built? I'm going to merge for now, but we could definitely add that afterwards. At the moment we just have a placeholder date for all the volume groups. |
Description
Parses an Excel file containing the supplier config and outputs json for other tooling
Depends on #38
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.