Repository navigation
Keep rows with placeholder cells, report row removals, guard bad-cell filters - #21
Merged
Merged
Conversation
… filters Executor - Record rows_removed (and bad_cell_rows) per rule in _execution and log every removal. - type_cast accepts null_values: placeholder codes become null, the row is kept. - Comparison filters (gt/lt/...) keep rows whose value is missing or unparseable. - trim_whitespace strips only text, so numbers in mixed columns stay numbers. - __orig_<col> sidecars are kept only when a value lost information; rename and column_header_normalize move the sidecar with its column (it used to be snake-cased to orig_<col> and leak into the deliverable). - Bad-cell guard: count rows a filter/drop_nulls removed only because of one placeholder or non-number cell in an otherwise valid row; skip such a rule in auto mode, where nobody approved it. App - suggest-transforms flags such rules (parameters._guard, src/lib/rule-guard.ts) before they are shown; the rule card shows the warning and the type_cast alternative, "Approve all" skips flagged rules and auto-validate rejects them. - Prompt: placeholders in mostly numeric columns -> type_cast to null, not filter. - Run page: rows removed per rule and in the summary, plus bad-cell counts. Docs: docs/transform-rules.md. Tests: college-list fixture, guard unit tests in Python and TS (including legitimate filters that are not flagged), contract test for the shared placeholder list.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the issues from a small xlsx run where every suggested rule was approved: the
Brownrow (.in its three numeric cells) disappeared, three numeric columns gotorig_<col>copies in the deliverable, and theCOLLEGEPOND REFERENCElabel row was gone. Adds a deterministic guard for row-removing AI suggestions.Root causes
type_castturns.into null and keeps the row). Brown could only be removed by a row filter on a ranking column. Two paths in the old code: aneq "."filter (the prompt told the model to "filter to exclude" sentinels), or a comparison filter (gt 0), which treated.and nulls as failing the comparison. Nothing recorded how many rows a rule removed, so the loss was silent.orig_<col>columns:trim_whitespaceturned numbers into strings (34became"34"), so the later cast wrote__orig_sidecars for every value.column_header_normalizethen snake-cased__orig_Xtoorig_x, sosplit_deliverableno longer saw them as sidecars and they leaked intooutput.xlsx.rows_removedmakes it visible.Changes
Executor (
lambdas/executor/handler.py)rows_removedper rule goes into_executionand the log.type_castacceptsnull_values(placeholder codes become null and the row is kept).trim_whitespacestrips only text.renameandcolumn_header_normalizemove the sidecar with its column.bad_cell_rows()): counts the rows afilter/filter_extended/drop_nullsremoved only because of one placeholder or non-number cell in an otherwise valid row (at least half of the other cells filled in). This is recorded as_execution.bad_cell_rows. In auto mode such a rule is skipped and the rows are kept. A rule a person approved still runs and is reported.App
src/lib/rule-guard.ts: after the AI returns rules and before they are stored, flagged rules getparameters._guard(reason plus atype_cast/null_valuesalternative). The rule card shows the warning, "Approve all" skips flagged rules, and auto-validate never approves one.type_castto null, with a filter only when the whole row is invalid. This is generic, with no dataset-specific tokens.The guard does not flag legitimate filters: comparisons, keep-only matches (
eq/in/regex), numeric values, real text values (neq "deleted",not_in ["test"]), blank removal, or mostly empty rows.PLACEHOLDER_TOKENSis shared between TS and Python and checked by a contract test.Tests
lambdas/tests/test_college_list.py: fixture shaped like the real file.lambdas/tests/test_bad_cell_guard.pyandsrc/lib/rule-guard.test.ts: flagged and not-flagged cases.Docs:
docs/transform-rules.md.After merge: redeploy the executor Lambda (zip-swap). The profiler is unchanged.