Skip to content

fix(tm1): validate results-CSV header to prevent measure drift (#169)#170

Merged
MariusWirtz merged 1 commit into
masterfrom
fix/issue-169-results-header-validation
Jul 9, 2026
Merged

fix(tm1): validate results-CSV header to prevent measure drift (#169)#170
MariusWirtz merged 1 commit into
masterfrom
fix/issue-169-results-header-validation

Conversation

@nicolasbisurgi

Copy link
Copy Markdown
Collaborator

Description

Fixes #169 — execution results written to the wrong TM1 measures.

}rushti.load.results maps result-CSV columns to its TI variables by position (asciiHeaderRecords=1 simply skipped the header). In 2.3.0 the chore measure was inserted at column 7 (between process and parameters). A cube/process built by a pre-2.3.0 rushti and then upgraded in place without re-running rushti build ends up with a CSV that has a chore column its stale TI doesn't read — so every value from chore/parameters onward is read one position early and written to the next measure over (parameters → status, status → start_time, …). Exactly the symptom reported, and it silently scrambles rather than erroring.

Fix

  • Read the header row (asciiHeaderRecords=0) so the metadata tab can see it.
  • Validate each CSV column against the variable it feeds; on any mismatch, log the offending columns and ProcessQuit (fail loudly) instead of writing scrambled data.
  • Skip the header row in both the metadata and data passes so it is never loaded as data.
  • The validation block is generated from PROCESS_VARIABLES, so it can't drift from the CSV column contract.

The guard only turns future drift into a clear error — the remedy for an already-stale deployment is still to re-run rushti build --tm1-instance <inst> (now documented in the migration guide + changelog).

Verification

Unit suite green (793 passed) with 5 new contract tests. Verified end-to-end on live TM1 v11 (11.8) and v12 (12.5):

v11 v12
New TI body deployed
All measures aligned (no shift)
Header not loaded as data
Guard fires on drift (QuitCalled)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Documentation update

Checklist

  • I have tested my changes locally
  • I have updated documentation if needed
  • My code follows the project's coding style
  • I have added tests if applicable

🤖 Generated with Claude Code

}rushti.load.results maps CSV columns to TI variables positionally.
A process built before 2.3.0 (pre-chore column) and left in place after
an in-place rushti upgrade silently shifted every value from chore/
parameters onward into the next measure.

Read the header row (asciiHeaderRecords=0) and validate each column
against the variable it feeds in the metadata tab; ProcessQuit with the
offending columns on mismatch instead of writing scrambled data. The
check is generated from PROCESS_VARIABLES so it can't drift from the CSV
contract. Verified end-to-end on TM1 v11 and v12.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MariusWirtz MariusWirtz added the release:patch Triggers patch version bump (e.g.: 1.4.9 → 1.4.10) label Jul 9, 2026
@nicolasbisurgi nicolasbisurgi self-assigned this Jul 9, 2026
Comment thread CHANGELOG.md
`rushti build --tm1-instance X`** to refresh the process (and additively add
any new measure element) — the guard only turns future drift into a clear
error, it does not repair an already-stale process. Existing rows written
under the wrong measures should be cleared and the workflow re-run.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just added a release tag to this PR

I think this section is no longer appropriate under Unreleased

@MariusWirtz MariusWirtz merged commit 29c7bb6 into master Jul 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:patch Triggers patch version bump (e.g.: 1.4.9 → 1.4.10)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Execution results are written to wrong measures

2 participants