Commit Graph

11 Commits

Author SHA1 Message Date
benvin bd1ed2efb2 Merge pull request 'Add repo scaffold and the catalog-diff CLI' (#1) from benvin/scaffold-catalog-diff into main
Reviewed-on: #1
2026-09-12 18:18:20 +10:00
unkin-agent 3f14554fae read facts from PuppetDB's query API
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
- rename internal/pdbmux to internal/puppetdb
- fetch facts with one GET /pdb/query/v4/facts AST query per node
- drop the per-node fallback route and its two response shapes
- rename --pdb to --puppetdb, CATALOG_DIFF_PDB to CATALOG_DIFF_PUPPETDB and
  pdb_url to puppetdb_url
- describe the fact source generically in the README and AGENTS.md
2026-09-12 17:49:57 +10:00
unkin-agent 5cbe4c8713 stop serving another node's factset
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
Also strip a leading BOM and stop reporting a certname mismatch as a parse error.
2026-09-12 17:35:09 +10:00
unkin-agent 496f258cb0 make the catalog fixture synthetic
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
The capture carried a production certname, real role and class names and
internal paths into a public repo.

- replace hostnames, class names and paths with fake equivalents
- keep the shape under test: catalog envelope, string version, null
  code_id, resources with and without parameters and file/line, the
  exported and sensitive_parameters cases
- document the range of --retry and --timeout
2026-09-12 17:19:28 +10:00
unkin-agent 7f2c6f16c8 accept both factset shapes and skip undecodable facts
Real PuppetDB answers /factsets/<certname> with an array; the fallback
decoded a bare object, so it only worked against pdbmux's own divergent
response.

- decode an array of factsets, picking the requested certname
- keep accepting a single bare factset object
- drop and report a fact record that will not decode instead of failing
  the whole fetch
- fail only when nothing in the response decodes
2026-09-12 17:19:28 +10:00
unkin-agent 6e4ee54203 validate flag ranges and make exitError printable when empty
A negative --retry skipped the compile loop, leaving a nil error inside
exitError that panicked when printed.

- reject a negative or oversized --retry and a non-positive --timeout as
  usage errors (exit 3)
- print an exit code when exitError carries no inner error
- cap the backoff shift so a large --retry cannot overflow
- cancel the sibling compile on the first failure, and do not report that
  cancellation as the cause
- report a context cancellation during the retry backoff instead of the
  stale compile error
2026-09-12 17:19:28 +10:00
unkin-agent 1aea8e8dbf assert line 0 with a file counts as a real source location
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
2026-09-12 17:00:41 +10:00
unkin-agent a76480d454 unwrap the catalog response and classify failures correctly
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
- unwrap the {"catalog": ...} envelope, still accepting a bare catalog
- report an environment-less response as a protocol mismatch, not an ENC problem
- make Resource.Line a pointer and Resource.Params() map absent onto empty
- render a missing manifest location as "(source unknown)"
- retry compile failures caused by the compiler's PuppetDB query
- stop retrying manifest errors the compiler returns as HTTP 500
- add a trimmed real-server response fixture and tests for each shape
2026-09-12 16:58:59 +10:00
unkin-agent dcbd810c34 keep stderr quiet when the diff exits with differences
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
2026-09-12 15:55:34 +10:00
unkin-agent 53007a9257 add repo scaffold and the catalog-diff CLI
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was canceled
ci/woodpecker/pr/test Pipeline was canceled
Compile a host's catalog in a base and a test environment over the
puppetserver API, then diff the two.

- add catalog-diff CLI with cobra flags, config precedence and exit codes
- add puppetserver mTLS client for POST /puppet/v4/catalog
- add pdbmux fact client
- add catalog normalisation, diff engine and text/JSON renderers
- add Makefile, nfpm RPM packaging and woodpecker pipelines
2026-09-12 15:54:25 +10:00
gitadmin 59c4d9a405 Initial commit 2026-09-12 15:35:49 +10:00