Skip to content

Render order-sensitive ini config files from an ordered list - #945

Open
khusmann wants to merge 3 commits into
mainfrom
ordered-config-library
Open

khusmann wants to merge 3 commits into
mainfrom
ordered-config-library

Conversation

@khusmann

@khusmann khusmann commented Sep 25, 2026 •

Copy link
Copy Markdown

Part 1 of 2 for #944.

rstudio-library's ini helpers render a config file from a map, and Go templates iterate maps in sorted key order. For files whose behavior depends on the order of their sections or entries — /etc/rstudio/profiles, launcher.*.profiles.conf, launcher.*.resources.conf, repos.conf — that silently changes what the file does, and nothing in values.yaml shows it.

This PR adds the order-preserving form to the library. Part 2 bumps rstudio-workbench onto it, adds the deprecation warning for the map form, and updates the docs — it has to wait until rstudio-library 0.1.38 is published, since consumers resolve the library from helm.rstudio.com rather than the working tree.

Changes

A file's contents may now be a list, and it renders in the order written:

config:
  server:
    profiles:
      - "*":
          max-memory-mb: 1024
      - "@analysts":
          max-memory-mb: 4096
  session:
    repos.conf:
      - Internal: https://pkgs.example.com/internal
      - CRAN: https://packagemanager.posit.co/cran/latest

Each list item is a map, rendered as one of:

Item shape Renders as
one key, map value a [name] section with its key=value lines
one key, scalar value a single name=value line
two or more keys key=value lines followed by a blank line (a record)
  • rstudio-library.config.ini (_config.tpl) accepts the list form anywhere it renders a file, via a new rstudio-library.config.ini.entry helper. Previously a list of single-entry maps rendered broken lines like *=map[max-memory-mb:1024], with no section headers at all.
  • rstudio-library.profiles.ini.advanced, .singleFile, and .json-from-overrides-config (_profiles.tpl) accept the same list form for a profiles file's sections, including the job-json-overrides merging. When an ordered list omits a [*] section, the chart-supplied job-json-overrides defaults are prepended as one, matching what the map form produced.
  • New rstudio-library.config.entries helper normalizes either form into an ordered list of entries.

Compatibility

The multi-key record shape is deliberate: config.session.r-versions already uses a list, and /etc/rstudio/r-versions separates R entries by blank lines. Keying on item arity — the "list of one-entry maps" from #944 — lets both forms coexist.

Verified byte-identical output: rendering every values file under charts/rstudio-workbench/{lint,ci}/ and charts/rstudio-connect/{lint,ci}/ before and after this change produces identical manifests.

One behavior change: a list item with exactly one key and a scalar value no longer emits a trailing blank line, since it is now an ordered entry rather than a one-field record. This only affects a single-field r-versions record (e.g. a lone - Path: /opt/R/4.0.2); two-or-more-field records are unchanged.

Testing

other-charts/rstudio-library-test covers, for both config.ini and the profiles helpers:

  • the list form for each order-sensitive file — sections and entries render in order, with headers where the file has them
  • the map form — renders sorted by name, as it does today
  • the raw string form — still verbatim
  • multi-field list items — still blank-line separated records
  • repeated section names (launcher.conf's cluster: list) — unchanged
  • a non-map list item — fails with a clear message

Ran the CI test loop (helm dependency update + helm unittest per chart) against a clean worktree: 452 tests pass across all 5 charts, with the other product charts still on their published library pins. check-uncommitted-changes.sh and check-news-entries.sh both pass.

@khusmann
khusmann requested review from a team as code owners September 25, 2026 00:50

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.

1 participant