feat(installer): add ibcmd backend (headless, ~30s vs DESIGNER 3-8min) - #21
Draft
rilhoms wants to merge 1 commit into
Draft
feat(installer): add ibcmd backend (headless, ~30s vs DESIGNER 3-8min)#21rilhoms wants to merge 1 commit into
rilhoms wants to merge 1 commit into
Conversation
Adds an alternative installer backend using `ibcmd config import` for
extension deployment. Selected via new flag `--installer=ibcmd`. The
default `--installer=designer` keeps current behaviour.
Why
---
`1cv8.exe DESIGNER` batch mode has several pain points:
- 3-8 min per install (DESIGNER startup + GUI init + config compile)
- Opens a GUI window — causes Session 0 hangs on Windows Server
- Limited support on Linux 1C servers (X-libs)
- Needs careful `/WA-` `/DisableStartupDialogs` flags
`ibcmd` (ships with platform since 8.3.18) is purpose-built for headless
deploys: ~30s, no GUI, native Linux support.
What
----
- New file `installer/ibcmd.go` — ibcmd backend (~340 lines)
- New `installer/ibcmd_test.go` — 7 unit tests (5 pass, 1 skipped on
non-Windows, all gotchas asserted)
- `cmd/mcp-1c/main.go`:
- `--installer={designer|ibcmd}` (default `designer`)
- `--ibcmd-timeout` (default 60s; bump for busy bases)
- `--ibcmd-db-server` (required for cluster bases — see "Server mode"
below)
Server mode design note
-----------------------
DESIGNER and ibcmd have fundamentally different connection models:
- DESIGNER uses cluster path `cluster:1541\db` (1C cluster routes to PG)
- ibcmd bypasses cluster — connects directly to DBMS
For `--server` mode with `--installer=ibcmd`, the user must provide:
--install <db-name> --ibcmd-db-server "<dbms-host> port=<port>"
Or pack both into --install (legacy split):
--install "<dbms-host>\<db-name>" --installer=ibcmd
Clear error message guides users through this distinction.
Gotchas codified (from real-world testing on platform 8.3.27.1859)
------------------------------------------------------------------
1. `--db-server="host port=6432"` syntax requires NO trailing `;`
despite official docs claim (asserted in `TestBuildConnectionArgs_*`)
2. `--user X` with no `--password` causes ibcmd to read STDIN, hanging
forever; we reject this combination upfront
3. Per-call hard timeout via `context.WithTimeout` (no orphan processes)
4. `--data` dir is per-run temp, auto-cleaned (no stale lock files)
5. Clear actionable error on lock contention with 3 fallback hints
Backward compatibility
----------------------
- Default unchanged: `--installer=designer` keeps full current behaviour
- All existing flags work identically
- No changes to embedded BSL extension, MCP tools, or HTTP client
- Existing tests pass with `-race`; new tests are isolated to installer/
Testing
-------
- Unit: 7 tests in `installer/ibcmd_test.go`, including timeout enforcement
via subprocess hang simulation
- Regression: `go test ./... -race` — all packages green
- Integration: deploy attempt on real platform 8.3.27.1859 + Yandex
Managed PostgreSQL 16; ibcmd connection + timeout enforcement work
end-to-end as designed (lock contention triggered expected timeout
with full actionable error message)
Refs: <to be filled in PR description>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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 an alternative installer backend using headless
ibcmd config importfor extension deployment. Selected via new flag--installer=ibcmd. The default--installer=designerkeeps current behaviour for full backward compatibility.Speed: ~30 seconds vs DESIGNER's 3-8 minutes.
Why
1cv8.exe DESIGNERbatch mode has several pain points users hit in production:/WA-/DisableStartupDialogs/DisableStartupMessagesmagicibcmd(ships with platform since 8.3.18) is purpose-built for this scenario: native headless CLI, no GUI, works equally well on Windows and Linux 1C.What changed
New flags
--installer={designer|ibcmd}designer--ibcmd-timeout=<duration>60s--ibcmd-db-server=<host>Server mode design note
DESIGNER and ibcmd have fundamentally different connection models that need to be exposed clearly to users:
cluster:1541\db— 1C cluster routes to the DBMS internallyFor
--servermode with--installer=ibcmd, the user provides:A clear error message guides users through this distinction if they pass a cluster path by mistake.
Backward compatibility
--installer=designerkeeps the full current behaviour-race; new tests are isolated toinstaller/Gotchas codified
While implementing this I hit several non-obvious issues. The code asserts each one in tests so they can't regress:
--db-server="host port=6432"requires NO trailing;— docs sayport=N;but with the semicolon ibcmd silently uses default port 5432.TestBuildConnectionArgs_ServerModeasserts the absence.--db-user Xrequires--db-pwd Ypaired — without password, ibcmd enters interactive--request-db-pwdSTDIN mode. With redirected/closed STDIN, it hangs forever (visible process, 0% CPU, no network traffic).TestBuildConnectionArgs_UserWithoutPasswordRejectedrejects this combination upfront.--datadirectory must be per-run — stale lock files in a shared--datadirectory block subsequent runs. We allocate a temp dir viaos.MkdirTempand clean up withdefer os.RemoveAll.config import filesis selective (positional files),config import <path>is whole-directory — easy mistake; the former with--base-diralone errors with «Путь не найден». We use the whole-directory form.Lock contention on busy bases — when extension metadata is actively held by rphost sessions, ibcmd waits for exclusive lock indefinitely. We enforce a hard
context.WithTimeoutand classify the error with three actionable hints (wait/increase-timeout/fallback to designer).Testing
Unit tests (
installer/ibcmd_test.go)TestBuildConnectionArgs_FileMode— file-mode produces only--db-pathTestBuildConnectionArgs_ServerMode— verifies port syntax + no trailing;TestBuildConnectionArgs_UserWithoutPasswordRejected— prevents STDIN hangTestBuildConnectionArgs_ServerModeWithoutBackslashRejected— validates DBPath shapeTestFindIbcmd_NextToPlatform— exe path resolution (Windows-only, skips on Linux)TestRunIbcmd_TimeoutKills— hard timeout enforcement, verified by sleeping subprocessTestClassifyIbcmdError_TimeoutMessage— actionable error message contentRegression
go test ./... -race— all packages green (bsl, dump, installer, internal/config, onec, prompts, server, tools).Integration
Tested end-to-end on platform 8.3.27.1859 + Yandex Managed PostgreSQL 16 + cluster-managed infobase. Confirmed:
When to use which backend
ibcmd(no GUI, deterministic, fast)ibcmd(DESIGNER is flaky there)designer(ibcmd not available)designerremains the well-trodden pathdesigneroribcmd --ibcmd-timeout=300sNotes for review
--ibcmd-db-serverflag exists because ibcmd's connection model differs from DESIGNER's; alternative API designs welcome in review.🤖 Generated with Claude Code