Skip to content

feat(rules): map and validate job export rows#4

Merged
jaeyeopme merged 1 commit into
mainfrom
export-rules
Jun 6, 2026
Merged

feat(rules): map and validate job export rows#4
jaeyeopme merged 1 commit into
mainfrom
export-rules

Conversation

@jaeyeopme

Copy link
Copy Markdown
Owner

Motivation

Add the pure data rules needed before output writing and export orchestration.

Scope

  • Add source-to-export candidate mapping.
  • Add required field, status, and date validation for mapped job rows.
  • Add deterministic duplicate handling where the first valid job id wins.
  • Add focused tests for mapping, validation, duplicate policy, and MVP rule counts.

Out of Scope

  • Reading fixture pages.
  • Writing output files.
  • Storing run history.
  • API or CLI export behavior.
  • Public docs status changes.

Modifications

  • Add mapping functions that preserve source context and compute latest update timestamps from job and related update records.
  • Add validation functions that return accepted clean jobs or rejected rows with documented reason codes.
  • Add duplicate handling that rejects later valid rows with the duplicate_record reason code.

Test Plan

  • uv run pytest tests/test_mapping.py tests/test_validation.py tests/test_duplicate_handling.py -v
  • uv run ruff check src/clean_data_export_api/mapping.py src/clean_data_export_api/validation.py tests
  • uv run basedpyright
  • uv run pytest tests/test_mapping.py tests/test_validation.py tests/test_duplicate_handling.py --cov=clean_data_export_api.mapping --cov=clean_data_export_api.validation --cov-report=term-missing
  • uv run pytest -v
  • uv run pytest --cov=clean_data_export_api --cov-report=term-missing --cov-fail-under=90
  • uv run python -m compileall src tests

Docs Impact

none

ADR Check

  • No architecture or scope decision needs a new or updated ADR.

Result

The core job export rules are deterministic, testable, and independent from file output, persistence, API, and CLI code.

Add pure mapping, validation, and duplicate-handling rules for job export rows. Invalid rows are rejected before duplicate handling, and the first valid job_id wins.

Tested: uv run pytest tests/test_mapping.py tests/test_validation.py tests/test_duplicate_handling.py -v

Tested: uv run ruff check src/clean_data_export_api/mapping.py src/clean_data_export_api/validation.py tests

Tested: uv run basedpyright

Tested: uv run pytest tests/test_mapping.py tests/test_validation.py tests/test_duplicate_handling.py --cov=clean_data_export_api.mapping --cov=clean_data_export_api.validation --cov-report=term-missing

Tested: uv run pytest -v

Tested: uv run pytest --cov=clean_data_export_api --cov-report=term-missing --cov-fail-under=90

Tested: uv run python -m compileall src tests
@jaeyeopme
jaeyeopme merged commit 26f643f into main Jun 6, 2026
2 checks passed
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.

1 participant