Repository navigation
Phase 3: idempotent workflow deploy + sync command - #414
Merged
neuromechanist merged 2 commits intoMay 10, 2026
Conversation
ensureWorkflowsDeployed: list .github/workflows once, deploy only the templates that are missing in a single tree commit. Steady-state cost drops from 4 REST calls (unconditional tree commit) to 1 (the listing). syncWorkflowTemplates: compare every template against deployed content and commit, in one tree, only the files that drift or are missing. Line-ending normalized to avoid CRLF false positives. Read failures record an error and leave the file unchanged so we never clobber a hand-edited workflow on a transient read fail. Replace the unconditional deployWorkflows() call in POST /datasets/:id/ finalize with ensureWorkflowsDeployed; surface deployed/already_present in the response. New admin route POST /admin/datasets/:id/ci/sync and CLI command nemar admin ci sync [<id>] [--all] wired through src/lib/api.ts.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR414Version: 🤖 Updated on each push. |
Result types now distinguish success-with-no-work, list-failed, and commit-failed: - ensureWorkflowsDeployed: new `listFailed` flag so callers can tell `alreadyPresent: []` apart from 'we could not check.' - syncWorkflowTemplates: `committed` flag and the `changed`/`added` lists are now preserved on commit failure (they encode 'what we intended' rather than getting zeroed out). Content normalization for sync now strips UTF-8 BOM, normalizes bare \r and CRLF to \n, and ignores trailing whitespace. A workflow that round- tripped through Windows tooling no longer triggers an infinite-rewrite loop on every sync. Listing filter accepts both `file` and `symlink` entry types so a symlinked workflow is correctly classified as present. Admin route returns HTTP 207 when `errors.length > 0` so automation and --all loops can't false-green on partial failures. Audit-log action renamed `ci_templates_synced` -> `ci_workflows_synced` for grep parity with the existing `ci_workflows_deployed` shape. Tests grew from 7 to 14, adding coverage for: - listing failure (non-404) - commit failure (both helpers) - per-file read failure (file is skipped, others still sync) - symlinked workflow treated as present - UTF-8 BOM + trailing whitespace not triggering false-positive diffs - tree-commit count assertions on every drift scenario Failure tests use 422 (terminal status) so wall-clock stays under 40ms.
Contributor
Author
Review summaryThree parallel reviewers ran (code-reviewer, pr-test-analyzer, silent-failure-hunter). Critical / High — addressed
Important — addressed
Intentionally not addressed (with reason)
Verification
|
neuromechanist
merged commit May 10, 2026
80247c4
into
feature/issue-406-epic-rate-limit-hardening
1 check passed
This was referenced May 11, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop rewriting identical workflow files on every `finalize` retry, and give operators a way to repair drift after we update a template.
Closes #407
Part of epic #406
Changes
Acceptance checklist (from #407)
Intentionally not addressed (with reason)
Test plan