Skip to content

fix(mappers): MapTags(drop_unmapped=True) predicts the system tags it keeps (ITL-1363) - #484

Merged
eywalker merged 1 commit into
mainfrom
eywalker/itl-1363-maptagsdrop_unmappedtrue-the-predicted
Nov 23, 2026
Merged

eywalker merged 1 commit into
mainfrom
eywalker/itl-1363-maptagsdrop_unmappedtrue-the-predicted

Conversation

@eywalker

@eywalker eywalker commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes ITL-1363

Problem

MapTags(drop_unmapped=True) predicted an output schema without the system-tag columns: its unary_output_schema kept a tag only if it was a key of name_map, and system tags never are. Under output_schema(columns={"system_tags": True}) or all_info=True the prediction and the computed table disagreed. MapData's prediction filtered its data schema by the same rule (no column the data schema holds today was affected).

Fix

One rule, mappers._plan_group: only user columns (tags, non-meta data columns) are renamed or, with drop_unmapped, dropped; system tags, source info, context and meta columns never are. MapTags' and MapData's predictions and MapColumns._plan use it. The table was already right; no row, column, hash, stored path or golden value changes (generate_golden_hashes.py --check matches).

Checked across operators

Every exported operator's predicted column names were compared with static_process(...).output_schema(...) under every column configuration (default, system_tags, source, meta, context, content_hash, all_info). Only the mappers had this defect. The Select/Drop column operators already derive their drop sets from the input's user columns.

Tests

  • New tests/test_core/operators/test_mapper_schema_prediction.py (57 tests): MapTags (with and without tag_only), MapData and MapColumns, with and without drop_unmapped, a two-entry name_map in both orders, over every arrangement of a 3-tag/3-data source (each tag order, table layout and tag role: plain, data-tags, mixed), for every column configuration. The prediction is compared with static_process(...).output_schema(...), and the async rows are checked against the sync rows and the predicted system tags. It also includes a columns-only check that every exported operator predicts the columns of its result. 9 of these tests fail on main.
  • The ITL-1135 sweep (tests/test_pipeline/test_zero_row_column_order.py) gains map_tags_drop, map_data_drop, map_columns and map_columns_drop steps. It had no drop_unmapped step before, which is why this bug slipped through. 16 of its cases fail on main.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed output previews for tag mapping when unmapped columns are dropped. System-tag columns retained in the computed result are now also shown in the prediction.
    • Improved consistency between predicted and computed columns across tag, data, and column mapping, including cases with zero rows.

… keeps (ITL-1363)

MapTags' and MapData's schema predictions filtered the whole schema by the
names of name_map, so with drop_unmapped the system-tag columns (named by no
name_map, kept by the table) were missing under system_tags=True/all_info=True.
One rule, mappers._plan_group, now decides renames and drops over the input's
user columns only; MapTags, MapData and MapColumns use it. No row, column,
hash or stored path changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a8de44c and 4996462.

Files selected for processing: 5

  • changelog.d/ITL-1363.md
  • docs/dev/design_issues/ITL-1363-MT1.md
  • src/orcapod/core/operators/mappers.py
  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py

Limit details: You’ve used the included review currently available. Your 90 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Recent review details

Context from checks skipped due to timeout: 2

  • GitHub Check: CodeRabbit
  • GitHub Check: Tests (3.13)
Additional context used

Code guidelines: 1

CLAUDE.md — auto-discovered
Path-based instructions: 13

Source excerpt: What runs where (developer, November 16, 2026; ITL-1181): Existing type errors and warnings are recorded in `.basedpyright/baseline.json`, a debt list to pay down.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • src/orcapod/core/operators/mappers.py
  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Source excerpt: Define each label in exactly one place, as a constant beside its algorithm.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • src/orcapod/core/operators/mappers.py
  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Source excerpt: This is a greenfield project pre-v0.1.0.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • changelog.d/ITL-1363.md
  • docs/dev/design_issues/ITL-1363-MT1.md
  • src/orcapod/core/operators/mappers.py
  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Source excerpt: Every place that produces or reads a digest is listed, with its class (into a hash, stored value, in a name, row identifier, id from a recipe, display only), in the "Hash site inventory" of `docs/reference/hashing.md`.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • src/orcapod/core/operators/mappers.py
  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Source excerpt: Tests and golden fixtures that build a source with tag columns pass `tag_only_columns=True` unless the test is about the default (developer, November 16, 2026, ITL-1159).

CodeRabbit inference engine (CLAUDE.md)

Files:

  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Source excerpt: What is published is decided in `scripts/docs_site_content.py` (`PUBLISHED_FILES`, `PUBLISHED_FOLDERS`, `EXCLUDED`).

CodeRabbit inference engine (CLAUDE.md)

Files:

  • docs/dev/design_issues/ITL-1363-MT1.md
Source excerpt: A pull request never edits `CHANGELOG.md` (developer, November 11, 2026; ITL-961).

CodeRabbit inference engine (CLAUDE.md)

Files:

  • changelog.d/ITL-1363.md
Source excerpt: An entry is the file `docs/dev/design_issues/-.md` (e.g.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • docs/dev/design_issues/ITL-1363-MT1.md
Source excerpt: The file holds only the text that would have gone under the release heading in `CHANGELOG.md`: the same category headings `CHANGELOG.md` uses (`### Breaking changes and migration`, `### Added`, `### Changed`, `### Fixed`, `#...

CodeRabbit inference engine (CLAUDE.md)

Files:

  • changelog.d/ITL-1363.md
Source excerpt: `docs/` is the only source.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • docs/dev/design_issues/ITL-1363-MT1.md
Source excerpt: Tests use the **public interface** wherever possible (developer, November 10, 2026): drive an operator by calling it, `op(stream)`, and read the result through the stream's public methods.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Source excerpt: Documents written during development are kept in the repository, under `docs/dev/` (developer, November 16, 2026; ITL-1169): Never put them in the published documentation (`docs/` outside `docs/dev/`) or at the top level of...

CodeRabbit inference engine (CLAUDE.md)

Files:

  • docs/dev/design_issues/ITL-1363-MT1.md
Source excerpt: Use [Google style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) Python docstrings everywhere.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • src/orcapod/core/operators/mappers.py
  • tests/test_core/operators/test_mapper_schema_prediction.py
  • tests/test_pipeline/test_zero_row_column_order.py
Learnings: 3

Learning: 2026-11-20T22:22:42.419Z

Learnt from: CR
Repo: metamorphic-labs/orcapod-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-20T22:22:42.419Z
Learning: Applies to changelog.d/*.md : Source excerpt:
# Claude Code instructions for orcapod-python

## Changelog

- The file holds only the text that would have gone under the release heading in
  `CHANGELOG.md`: the same category headings `CHANGELOG.md` uses
  (`### Breaking changes and migration`, `### Added`, `### Changed`, `### Fixed`,
  `### Known limitations`), each followed by its text: bullet lines, or `####` sub-headings
  with paragraphs, as `CHANGELOG.md` itself has. No version heading, no date, no other
  `#`, `##` or `###` heading, and no empty category.

Applied to files:

  • changelog.d/ITL-1363.md
Learning: 2026-11-21T23:23:55.273Z

Learnt from: CR
Repo: metamorphic-labs/orcapod-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-21T23:23:55.273Z
Learning: Applies to tests/**/*.py : Source excerpt:
# Claude Code instructions for orcapod-python

## Testing conventions

Every argument or input that can take several items (column names, a mapping, keywords,
input streams, sources to bind, output keys) is tested (developer, November 17, 2026,
ITL-1236): with two or more items; in more than one order, asserting what the order does or
must not change (rows, column order, content hash, pipeline hash, system-tag column names);
in each role it accepts (plain tag, data, data-tag: build the role you test, whatever the
`tag_only_columns` default above says); on inputs with two or more tag columns AND two or
more data columns, in more than one arrangement (tag order, table layout); and on the sync
and the async path. A test whose streams have one tag and one data column does not test an
operator. The shared family of such inputs is `tests/test_core/operators/several_items.py`;
the inventory is `docs/dev/specs/itl-1236-several-item-test-audit.md`. The...

Applied to files:

  • tests/test_core/operators/test_mapper_schema_prediction.py
Learning: 2026-11-21T23:23:55.273Z

Learnt from: CR
Repo: metamorphic-labs/orcapod-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-21T23:23:55.273Z
Learning: Applies to tests/**/*.py : Source excerpt:
# Claude Code instructions for orcapod-python

## Testing conventions

Tests use the **public interface** wherever possible (developer, November 10, 2026): drive an
operator by calling it, `op(stream)`, and read the result through the stream's public methods.
Use a non-public entry point (`unary_static_process`, `static_process`,
`binary_static_process`, `_private` helpers) only when the test is specifically about that
entry point. The standing exception is verifying a schema prediction, which must compare
against `static_process(...).output_schema(...)`; see "Important implementation details".

Applied to files:

  • tests/test_core/operators/test_mapper_schema_prediction.py
Additional comments: 4

src/orcapod/core/operators/mappers.py: 1

57-80: LGTM!

Also applies to: 279-284, 286-286, 288-288, 551-555, 557-557, 564-564, 722-726, 728-728

tests/test_pipeline/test_zero_row_column_order.py: 1

40-40: LGTM!

Also applies to: 171-181, 557-562

docs/dev/design_issues/ITL-1363-MT1.md: 1

1-25: LGTM!

changelog.d/ITL-1363.md: 1

1-8: LGTM!

Walkthrough

Mapper schema prediction now uses shared planning for user-column renames and drops. Tests compare predictions with computed schemas and extend zero-row column-order coverage for mapper cases.

Changes: Mapper schema prediction

Layer / File(s) Summary
Shared mapper schema planning
src/orcapod/core/operators/mappers.py
A shared helper plans renames and drops for listed columns. MapData, MapTags, and MapColumns use this planning logic.
Prediction validation and issue records
tests/test_core/operators/test_mapper_schema_prediction.py, tests/test_pipeline/test_zero_row_column_order.py, docs/dev/design_issues/ITL-1363-MT1.md, changelog.d/ITL-1363.md
Tests compare predicted and computed schemas, check system tags and row fingerprints, and add mapper cases to zero-row column-order coverage. The design-issue document and changelog describe the change.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 49964

Mapper schema prediction now matches the computed output by keeping system-tag columns when unmapped columns are dropped. The change is limited to schema prediction, and no row, hash, or stored-path changes are reported. No merge-blocking risk was found.

Security architecture risk: Minimal · up to 49964

The change aligns predicted schemas with existing mapper results. The inspected changes preserve reserved-column naming controls and introduce no demonstrated increase in privileges, data exposure, or persistent-state risk.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated change affects schema descriptions consumed by downstream users of these in-process mapper operators. Preserving explicitly requested system-tag schema entries does not itself establish new access to row values or increased authority.

Trust Boundaries and Controls

  • observed — Existing mapper constructors validate rename targets before storing the mapping. They reject meta names, system-tag and source-info prefixes, the reserved context name, and source-token separator ambiguity. The PR leaves these controls intact.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: MapTags with drop_unmapped=True now predicts the system-tag columns it keeps. The changeset matches this. The mappers.py changes, the new schema prediction tests, and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: MapTags with drop_unmapped=True now predicts the system-tag columns it keeps. The changeset matches this. The mappers.py changes, the new schema prediction tests, and the changelog all address this behavior. The title includes the ticket ID ITL-1363, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/orcapod/core/operators/mappers.py 99.34% <100.00%> (+<0.01%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eywalker
eywalker merged commit e98f8b4 into main Nov 23, 2026
16 checks passed
@eywalker
eywalker deleted the eywalker/itl-1363-maptagsdrop_unmappedtrue-the-predicted branch November 23, 2026 00:47
eywalker added a commit that referenced this pull request Nov 23, 2026
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