Skip to content

fix(sof): neutralise formula-like CSV header cells as data cells are - #2957

Open
angela-helios wants to merge 1 commit into
mainfrom
fix/sof-csv-header-formula
Open

angela-helios wants to merge 1 commit into
mainfrom
fix/sof-csv-header-formula

Conversation

@angela-helios

Copy link
Copy Markdown
Contributor

Stacked on #2901. This branch starts from #2901's branch so that Test FHIRPath passes against the current fhir-test-cases master; its commit leaves this diff once #2901 merges.

Closes #2956

Summary

CSV data cells went through neutralize_csv_formula, but every header row was written raw. A ViewDefinition or Library author controls the column names, so a column named =HYPERLINK(...) reached other users' spreadsheets as a live formula.

  • helios_sof::csv_header_cells(columns) neutralises each name as a string cell is. The three header writes in helios-sof use it: format_csv, write_csv_header, and the streaming row writer's first record. The csv crate quotes the cells as before.
  • crates/rest/src/export/in_memory.rs routes its header through its own csv_cell. That neutralises the names and also quotes them: before, the names were joined with , unquoted, so a column named b,c shifted every column after it.

Tests

  • helios-sof: every_csv_header_writer_neutralizes_formula_column_names. The buffered format_csv header and the streaming write_csv_header both write "'=HYPERLINK(""x"")",b,'@c.
  • helios-rest: view_and_query_csv_writers_agree_on_formula_column_names. The in-memory view writer writes '=1+2,"b,c" and matches helios_sof::format_csv byte for byte.

With the header neutralisation removed and the old REST header restored, both tests fail; with the fix they pass. The CSV tests in helios-sof (6) and the export::in_memory tests in helios-rest (44) pass. Clippy on both crates (--lib --tests) is clean.

CSV data cells went through neutralize_csv_formula, but every header row
was written raw, so an author's column named =HYPERLINK(...) reached
other users' spreadsheets as a formula. The three helios-sof header
writes and HFS's in-memory export header now neutralise the names; the
latter also quotes them.

Closes #2956
@claude

claude Bot commented Nov 26, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

This branch has not been deployed

No deployments
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.

SQL-on-FHIR CSV header cells skip the formula neutralisation

1 participant