Skip to content

fitcheb ergonomics / seam cleanup (follow-ups from #2) #4

Description

@ibell

Tracking follow-ups observed during the work on #2. Each is a small, focused item — splitting so the fixes stay reviewable.

1. Relative default paths are working-directory-dependent foot-guns

fastcheb.cpp:31-33 defines:

```cpp
extern const std::filesystem::path teqp_datapath{ "../externals/CoolProp" };
extern const std::filesystem::path output_prefix{"../output/"};
extern const std::filesystem::path check_destination{"../outputcheck/"};
```

These only resolve correctly when fitcheb is run from build/. The README has already documented this as a quirk ("The code expects that the working directory when running is a subfolder of this code"), but with -d/-o/-c now fully wired, the defaults should be anchored to argv[0]'s directory (or the repo root) instead of CWD. One-line fix with std::filesystem::canonical at startup.

2. Delete inject_superancillary.py in CoolProp

The script at externals/CoolProp/dev/scripts/inject_superancillary.py is obsoleted by fitcheb inject (#2). It also has a hardcoded wrong path (~/Documents/Code/fastchebpure/output) and no hash check. Needs a separate PR against the CoolProp repo, not this one.

3. No CLI / subcommand tests

The -d-ignored-by-fit/check bug fixed in #2 would have been caught by a minimal smoke test that runs fitcheb fit -f Argon -d /tmp/isolated-tree and asserts it actually reads from /tmp/isolated-tree. Worth adding a small Catch2 or shell-level test harness for the three subcommands — at least covering inject's hash-guard, idempotency, and atomicity paths, which are the places bugs would silently corrupt fluid JSONs.

4. --skip help string renders oddly

fitcheb --help prints:

```
-s,--skip TEXT [[Air,SES36]] ...
```

Cosmetic — CLI11's capture_default_str() formatting on a std::vector<std::string> default wraps the list in extra brackets. Either switch to a single comma-joined string or override the default-str formatter.

5. README quirk note can go away once #1 lands

The "The code expects that the working directory when running is a subfolder of this code" note in README.md exists only because of #1 above. Delete the note at the same time.


Context: see #2 for the inject subcommand work these follow-ups fall out of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions