Add poe2arb upload for syncing local ARB changes with POEditor#96
Open
Albert221 wants to merge 3 commits into
Open
Add poe2arb upload for syncing local ARB changes with POEditor#96Albert221 wants to merge 3 commits into
poe2arb upload for syncing local ARB changes with POEditor#96Albert221 wants to merge 3 commits into
Conversation
Unlike `seed`, `upload` is meant for keeping POEditor in sync with ongoing local ARB edits. It overwrites existing translations and term definitions, adds new terms and missing languages. Before uploading, the command lists project terms and compares them with the local template ARB. If any orphaned remote terms are found, the upload aborts and prints them; passing `--force` deletes them via /terms/delete and proceeds. Term-prefix scope is respected so sibling packages sharing one POEditor project are unaffected. The deletion step uses /terms/delete with a per-term list rather than the upload endpoint's `sync_terms` flag, which would otherwise wipe terms belonging to other prefixes in the same project.
…upload `poe2arb upload --dry-run` now reports: - terms to be added (in local but not in POEditor) - terms to be removed (in POEditor but not local; need --force) - per-language summary of how many translations would be added, updated, or are unchanged, plus whether each language would be created in the POEditor project It performs one /terms/list call per language to compare local vs. remote translations exactly. No mutating endpoints are called. A new GitHub Actions job `write-integration-test` exercises seed and upload end-to-end against a dedicated POEditor project. It: 1. Seeds an empty project from stage1 fixtures and verifies via `upload --dry-run` that the state is consistent (zero changes). 2. Modifies ARBs (adds + updates terms), checks the dry-run output, uploads, then re-checks with dry-run. 3. Removes a term, verifies the dry-run flags it for deletion, asserts that `upload` without --force aborts non-zero, then `upload --force` succeeds; finally re-downloads via `poe poe` and confirms the term is gone. The job is gated on `vars.POEDITOR_INTEGRATION_TESTS_WRITE_PROJECT_ID` so it skips on forks and contributor PRs lacking the test-project configuration. It uses a `concurrency` group to prevent concurrent runs from racing on the shared test project.
Both jobs hit the same rate-limited POEditor account. Share a single `poeditor-integration` concurrency group so the read-only and write jobs never run in parallel.
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
Adds a new
poe2arb uploadsubcommand that synchronizes local ARB file changes back to POEditor. Unlikeseed(which is meant for one-shot first-time imports and deliberately never overwrites),uploadis intended for the day-to-day workflow of pushing local ARB edits to POEditor — including changes to terms that already exist remotely.Behavior
/terms/list(asking for the template language so we can show translations as a preview).--forcedeletes them via/terms/deleteand proceeds.seed).overwrite=1, template language first so term definitions get registered before non-template translations come in. Same paid/free rate-limit handling asseed.Design notes
/terms/deletewith an explicit list rather than the upload endpoint'ssync_terms=1. The latter deletes every term in the project that's not in the upload, which would silently wipe terms belonging to other prefixes (sibling packages in a multi-package POE project). The explicit-list approach respects the existing--term-prefixscoping:termInPrefixScopeonly flags remote terms whose prefix matches the local one for deletion.Client.Uploadsignature was extended to take anUploadOptions{Overwrite}struct;seeduses the zero value, preserving its non-destructive default.Tests
poeditor/client_test.gocoversListTerms(with translation parsing for both string and plural-object content forms),DeleteTerms(incl. empty-input no-op),Upload(overwrite=0/overwrite=1/rate-limit error propagation),GetProjectLanguages, andAddLanguageagainst anhttptest.Servermock.cmd/upload_test.gocovers the prefix-scope diff logic (termInPrefixScope,termsToDelete), template-ARB term parsing (readLocalTermNames), and ARB-file discovery / template ordering helpers.Test plan
go build ./...go test ./...go tool staticcheck -checks=all ./...go tool gofumpt -dcleanpoe2arb upload(expect abort listing orphan terms), thenpoe2arb upload --force(expect deletion + overwriting upload).README
Adds a new "Synchronizing local ARB changes with POEditor" section under Usage, documenting the workflow, the
--forceflag, and the prefix-scope safety guarantee.Generated by Claude Code