Implement the bds.sync Lua namespace for bDS2 script compatibility #45
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The RuDS spec
specs/script.allium(guaranteeCoreHostApiCompatibility) currently says "bds.sync remains a future extension contract" — but this deferral was introduced in RuDS's own spec edit, not inherited from the baseline: bDS2 ships a fullbds.syncLua namespace (../bDS2/lib/bds/scripting/capabilities.ex,sync_capabilities/2, andapi_docs.exmodule "sync"). Sincedocs/scripting/API_REFERENCE.mdpromises "the same published script file can run in either application", a bDS2 script usingbds.synccurrently fails on RuDS. All underlying operations already exist in RuDS'sGitEngine(crates/bds-core/src/engine/git.rs) — this is a binding task, not new engine work.Task
Implement the
bds.syncnamespace in the Lua core host (crates/bds-core/src/scripting/core_host.rs) with bDS2-identical signatures and failure values (nil on lookup/command failure perHostApiFailureValues):check_availability()get_repo_state()get_status()get_history()get_remote_state()fetch()pull()push()commit_all(message)Requirements:
fetch,pull,push) exactly like the Git UI/CLI paths — blocked with the standard failure value, no network calls.pullmust run the same post-pull reconciliation as CLIpull(incremental cache update through the shared rebuild path) so the database reflects pulled files.../bDS2/lib/bds/scripting/capabilities.exand the capability helpers it calls); timestamps as ISO-8601 strings, enums as strings.crates/bds-core/src/scripting/manifest.rs) so generated API reference, type definitions, and editor completion data pick it up; the manifest drift-check test must pass.docs/scripting/API_REFERENCE.mdgeneration inputs sobds.syncappears; regenerate.specs/script.allium: movebds.sync(with its 9 methods) into theCoreHostApiCompatibilitycapability list and delete the "future extension contract" sentence. Validate withallium check specs/*.allium.Definition of done
bds.syncmethod runs identically on RuDS and bDS2 (modulo table field ordering).cargo test --workspacepasses.Implemented in
49447ef.Added the complete bDS2-compatible bds.sync Lua namespace with all nine methods, project-scoped GitEngine dispatch, bDS2 table shapes, string enums, ISO dates, nil failure values, airplane-mode network gating, and shared CLI/Lua post-pull incremental reconciliation. Added manifest types, frozen signature coverage, generated API/type/completion docs, README and Allium updates.
Verification uses real temporary repositories and a bare remote to exercise every method, successful fetch/pull/commit/push, database reconciliation after pull, non-repository nil behavior, blank-commit rejection, and proof that offline network calls leave local, tracking, and remote refs unchanged. Neutral review against the issue, bDS2 bridges and Git behavior, and Allium found no gaps. The formatting, clippy, build, dependency-audit, dependency-freshness, Allium check/analyse, and full workspace test gates all pass.