Skip to content

CCM-12869: Excel to config parser#47

Merged
m-houston merged 41 commits into
mainfrom
CCM-12869-excel-parser
Apr 24, 2026
Merged

CCM-12869: Excel to config parser#47
m-houston merged 41 commits into
mainfrom
CCM-12869-excel-parser

Conversation

@m-houston

@m-houston m-houston commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Description

Parses an Excel file containing the supplier config and outputs json for other tooling

Depends on #38

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

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.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@m-houston m-houston force-pushed the CCM-12869-excel-parser branch from 9e03d8f to 261a594 Compare February 3, 2026 11:27
# 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.
@m-houston m-houston marked this pull request as ready for review April 23, 2026 21:04
@m-houston m-houston requested a review from a team as a code owner April 23, 2026 21:04
Copilot AI review requested due to automatic review settings April 23, 2026 21:04
@m-houston m-houston requested a review from a team as a code owner April 23, 2026 21:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-parser with parsing logic, template generator, CLIs, deterministic JSON output, and extensive unit tests.
  • Update @supplier-config/file-store loader/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.

Comment thread packages/excel-parser/README.md
Comment thread packages/events/src/domain/__tests__/specification-supplier.test.ts
Comment thread packages/excel-parser/src/template.ts
Comment thread packages/excel-parser/src/parse-excel.ts Outdated
m-houston and others added 3 commits April 23, 2026 22:24
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 masl2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@m-houston

Copy link
Copy Markdown
Contributor Author

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.

@m-houston m-houston merged commit eff51e6 into main Apr 24, 2026
34 checks passed
@m-houston m-houston deleted the CCM-12869-excel-parser branch April 24, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants