HarperFast / HarperFast/harper-pro

Clone node mangles component config keys containing underscores (prometheus_exporter → prometheus.exporter)

Open
#167 0 comments 0 reactions 0 assignees View on GitHub
bug from-jira
Dominant language
JavaScript
Stars
3
Forks
0
Avg merge
1d 21h
Merged PRs (30d)
80

Description

After `clone node` runs to recover a database, the resulting `harperdb-config.yaml` rewrites component keys that contain `_` into nested objects, breaking the deployment.

## Reproduction

Original config:
```yaml
prometheus_exporter:
package: git+https://github.com/HarperDB/prometheus-exporter.git#semver:v1.1.0-beta.1
```

After clone:
```yaml
prometheus:
exporter:
package: git+https://github.com/HarperDB/prometheus-exporter.git#semver:v1.1.0-beta.1
```

Application loading then fails:
```
[error]: Could not load file '/home/harperdb/hdb/components/prometheus_exporter/resources.js' for application '/home/harperdb/hdb/components/prometheus_exporter' due to:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'prom-client'
```

Repro steps (from Jira): on any `[customer-node].harperdbcloud.com` server, stop harperdb, delete `data.mdb`, run clone node from a sibling. After clone completes, check the config and the logs.

## Suspected cause

`cloneNode/cloneNode.ts` reads the existing config and calls `flattenConfig(hdbConfigJson)` on it. The reverse — un-flattening on write — appears to be treating `_` as a nesting delimiter (so `prometheus_exporter` becomes `prometheus.exporter`). Either the flatten step or the inverse on write is mishandling underscore-containing keys.

## Acceptance criteria

- Component keys with `_` survive a clone round-trip unchanged.
- Regression test: clone a config with at least one underscore-containing component name; assert the post-clone YAML preserves the original key.

## Reported on

Harper 4.5.36. Worth checking whether this still reproduces on 5.x — but given the `flattenConfig` path is still active, it likely does.

---

Tracked in Jira: [CORE-3022](https://harperdb.atlassian.net/browse/CORE-3022)

🤖 Filed by Claude on behalf of Kris.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.