Repository navigation
Conversation
workflow-engine start-dev (workflow-runtime dev) runs every service on SQLite, in memory or in a --db-file, with no authorization on 127.0.0.1, and creates "default" and each --namespace before the services start, like temporal server start-dev. The namespaces carry the WorkflowKind search attribute: when ballerina/workflow registers it at start, its first workflow is refused until the namespace cache refreshes. The in-memory database is held open for the process, since SQLite deletes it with its last connection. For two minutes after start, errors Temporal logs while services join the membership ring and acquire shards (Not enough hosts, shard status unknown, context canceled, the cluster metadata race, Frontend is not healthy yet) go to debug level; a fresh PostgreSQL start with 512 shards logged about 400 of them, now none. Also refuses service ports whose membership port (port - 300) exceeds 32767 on PostgreSQL and MySQL: Temporal stores it in a SMALLINT column and membership fails at start otherwise.
The launcher ships as bin/workflow-runtime and the engine's profile for the API server is api, not manager.
start-dev --ip 0.0.0.0 left engine.broadcastAddress empty, which the configuration refuses; dev now sets it to auto.
A fresh distribution has no data/ and SQLite creates the file but not its directory, so the quick-start's start-dev --db-file data/dev.db exited with "unable to open database file". start-dev now creates missing directories and names --db-file when it cannot.
cli_test reads the dev namespaces back from SQLite with their WorkflowKind alias and covers the --db-file directory. tools/internal/enginetest/dev_test.go starts a real start-dev with no outside setup: default and --namespace exist with WorkflowKind, a first workflow tagged with it is found by a visibility query, and both survive a restart on the same file. balsuite --database dev runs the Ballerina suites on start-dev without creating the namespace or search attribute, and the smoke matrix now includes it.
Dev mode wrote namespaces through Temporal's SQL persistence from the cli package; the new SQL boundary rule refuses that, so the code and its SQLite test move to internal/sqlschema.
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 53 minutes. View limit details
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
9681222 to
f18ad41
Compare
heshanpadmasiri
left a comment
There was a problem hiding this comment.
Review of commit f18ad4152d0567dc327330eafa1e889b9e7fe08e.
One confirmed finding is attached inline.
Validation: focused Go tests passed; the stack-tip coverage gate passed at 92.7%. The real-engine reset test passed, and a cron schedule round trip reproduced the schedule display finding. Ballerina smoke testing did not run successfully because the external Temporal CLI was unavailable.
| now func() time.Time | ||
| } | ||
|
|
||
| func newQuietLogger(l log.Logger) log.Logger { |
There was a problem hiding this comment.
[P3] Preserve the source position of non-Error log messages
Description: The constructor applies Skip(1) to the embedded logger, but only Error adds an explicit forwarding frame (engine/internal/cli/quietlog.go:56). Promoted methods such as Warn, Info and Debug consequently skip the actual logging site and report its caller. This affects ordinary production starts and points operators at the wrong source location during diagnosis.
Reproduction: Ran go test ./engine/internal/cli -run '^TestStartWithIdentityProviderAuth$' -count=1 -v on this PR. The warning emitted at engine/internal/cli/cli.go:318 reported logging-call-at: .../cli.go:230.
Correction: Preserve the original delegate for promoted methods and use an appropriately adjusted delegate for Error, or forward all methods consistently. Assert caller metadata; the existing Zap wrapper test only checks the concrete wrapper type (engine/internal/cli/quietlog_test.go:58).
There was a problem hiding this comment.
Fixed in 7538b5b. quietLogger now embeds the original logger for the promoted methods (Debug, Info, Warn, ...), which add no frame. Only Error, which does add a frame, logs through a Skip(1) copy, both when it logs as an error and when it downgrades to debug.
TestQuietLoggerKeepsTheCallersSourcePosition logs at every level, plus a downgraded transient error, through a real zap logger writing to a file. It asserts that each entry's logging-call-at is the test's own line. Before the fix, it reported testing.go for info, warn and debug. Your reproducer now reports cli.go:318 for the issuer/audience warning.
…e/dev-mode # Conflicts: # engine/internal/cli/cli.go
…e/dev-mode # Conflicts: # tools/cmd/balsuite/main.go
heshanpadmasiri
left a comment
There was a problem hiding this comment.
Reviewed the current PR diff and relevant implementation, callers, tests and documentation using AGENTS.md, gh-stack, review-loop and review-oracle (Go). No confirmed P3-or-higher introduced findings remain.
Validation: stack-tip build and unit-test coverage gate pass (91.8%); the existing real-engine reset regression passes. PostgreSQL/MySQL and the full Ballerina smoke suite were not verified in this environment.
The merge-base changed after approval.
heshanpadmasiri
left a comment
There was a problem hiding this comment.
Reviewed the current PR diff, relevant implementation, callers, tests and documentation using the repository guidelines, gh-stack, a fresh independent review-loop pass and review-oracle (Go). No confirmed P0–P2 findings in this PR.
Review scope: this PR against its declared base; findings introduced in other stack layers are assigned to those PRs. Full-stack coverage and smoke validation were attempted separately; this approval does not assert that live PostgreSQL/MySQL or Ballerina suites passed.
heshanpadmasiri
left a comment
There was a problem hiding this comment.
Review of this PR's own changes in the stack: 3 finding(s), inline.
| } | ||
|
|
||
| // quietLogger logs transient start-up errors at debug level during the grace period, everything else unchanged. | ||
| type quietLogger struct { |
There was a problem hiding this comment.
P2 quietLogger embeds only the log.Logger interface, so it no longer implements log.WithLogger (With) or log.SkipLogger (Skip), although the zap logger it wraps does. Temporal builds nearly every component logger with log.With(logger, tags...) (per service, shard and component) and log.NewThrottledLogger. Without these methods, log.With falls back to its generic withLogger wrapper and the throttled logger cannot add its skip frames. Both add a stack frame that zap's fixed skip does not account for.
Result: on every start and start-dev, for the whole life of the process and not only during the grace period, most engine log lines report the wrong source. For example, log.With(newQuietLogger(zap), tag).Info("x") reports logging-call-at: go.temporal.io/server@v1.32.1/common/log/with_logger.go:42 (:52 for Error), and a throttled logger reports throttle_logger.go:44. The same calls on the unwrapped zap logger report the real caller. The fallback also copies and prepends the tags on every call, including debug calls that are filtered out, where zap's With would have pre-encoded them. TestQuietLoggerKeepsTheCallersSourcePosition misses this because it only calls the root logger directly.
Suggested fix: implement With(tags...) so it returns a quietLogger whose Logger and errors fields are log.With(q.Logger, tags...) and log.With(q.errors, tags...), keeping the same until and now. Implement Skip(n) the same way, forwarding to the inner SkipLogger. Then extend the test to log through log.With(q, ...) and log.NewThrottledLogger(q, ...) and check logging-call-at.
|
|
||
| const usageText = `usage: workflow-engine version | ||
| workflow-engine start (--runtime-config <runtime.toml> | --config-file <temporal.yaml>) [--service <name>]... [--allow-no-auth] | ||
| workflow-engine start-dev [--ip <address>] [--port <port>] [--db-file <file>] [--namespace <name>]... [--log-level <level>] |
There was a problem hiding this comment.
P2 This PR adds workflow-engine start-dev (--ip, --port, --db-file, --namespace, --log-level), workflow-runtime dev and the balsuite --database dev option, but it does not change docs/guides/DEVELOPING.md. AGENTS.md rule 1 says a new command or flag must also update the README and DEVELOPING.md. The run section of DEVELOPING.md still documents only start --runtime-config ... --allow-no-auth, and the README mentions only "development mode" in its status line. The troubleshooting row for the missing WorkflowKind search attribute still points only to the balsuite runner, although start-dev now pre-registers that attribute. A contributor reading the developer guide will not find the new dev path.
Suggested fix: add start-dev and its flags, and workflow-runtime dev, to the build-and-run section of DEVELOPING.md. Mention --database dev where balsuite is described, and update the WorkflowKind troubleshooting row. List the command in the README or link the quick start from it.
| case "start", "render-config": | ||
| engineArgs = append([]string{command, "--runtime-config", config}, rest...) | ||
| case "dev": | ||
| engineArgs = append([]string{"start-dev"}, rest...) |
There was a problem hiding this comment.
P3 run() calls os.Chdir(home) before it starts the engine, which is why it makes WORKFLOW_RUNTIME_CONFIG absolute first ("Relative to where the caller ran the command, not to the home it changes to"). The new dev case passes rest through unchanged, so a relative --db-file is resolved against the runtime home. For example, cd ~/proj && /opt/wfr/bin/workflow-runtime dev --db-file ./dev.db creates and reuses /opt/wfr/dev.db, along with any missing directories there, and not ~/proj/dev.db. The runtime home may not be writable, and nothing in the quick start says the path is relative to it. The launcher test only checks that the argument is passed through.
Suggested fix: before the chdir, make a relative --db-file value (both --db-file x and --db-file=x) absolute against the caller's working directory, as the launcher already does for the config path, and add a test for it. Alternatively, document that the path is relative to the runtime home and test that behavior.
heshanpadmasiri
left a comment
There was a problem hiding this comment.
Two independent reviews agreed on these findings.
P1 docs (AGENTS.md rule 1): the PR adds workflow-engine start-dev (--ip, --port, --db-file, --namespace, --log-level) and workflow-runtime dev. Neither docs/guides/DEVELOPING.md nor the README documents them. DEVELOPING.md still tells developers to start with start --runtime-config tests/engine/runtime-sqlite.toml --allow-no-auth and to create the namespace by hand. The AGENTS.md Ballerina suites paragraph now lists dev but still says the runner always starts from runtime-<database>.toml and creates the namespace and search attribute, which isn't true for dev.
| } | ||
|
|
||
| // quietLogger logs transient start-up errors at debug level during the grace period, everything else unchanged. | ||
| type quietLogger struct { |
There was a problem hiding this comment.
P1: quietLogger embeds the log.Logger interface, so only the level methods are promoted. It implements neither log.WithLogger nor log.SkipLogger, although the zap logger underneath implements both. Temporal builds nearly every component logger with log.With(logger, tag...), which now falls back to the generic *withLogger wrapper. Both reviewers confirmed with a probe test (newQuietLogger(log.NewZapLogger(...)), then log.With(l, tag).Info/Error) that logging-call-at becomes go.temporal.io/server@v1.32.1/common/log/with_logger.go:42 (Info) or :52 (Error) instead of the real caller. serve() wraps the logger for every start, not only start-dev, so operators lose the source position on almost every engine log line for the whole life of the process. A fix: implement With (wrap inner.With(...), keeping errors built the same way) and Skip, then add a test that logs through log.With(...) and checks the source position. TestQuietLoggerKeepsTheCallersSourcePosition only logs through the wrapper directly, so it misses this.
There was a problem hiding this comment.
Fixed in fc1047a. quietLogger now implements With and Skip. With tags through the logger underneath (log.With(q.Logger, ...), so zap's own With) and wraps the result again with the same grace period and the errors logger rebuilt with Skip(1). Skip wraps the inner logger's Skip. TestQuietLoggerKeepsTheCallersSourcePosition now also logs through log.With(l, tag): it checks that the result is still a quietLogger, that logging-call-at is the test's own line for info, error and a transient error, and that the transient error is still downgraded to debug. On the old code it fails with *log.withLogger is not a quiet logger.
Temporal builds component loggers with log.With. Without With and Skip, quietLogger fell back to Temporal's generic wrapper, which logged its own file and line as logging-call-at for nearly every engine log line.
…e/dev-mode # Conflicts: # AGENTS.md # README.md # docs/guides/ARCHITECTURE.md # engine/internal/cli/cli.go # engine/internal/cli/cli_test.go
|
Docs (review's P1) fixed in 004f408:
|
Purpose
Resolves wso2/product-integrator#2919
Replaces #8, reopened from a wso2 branch so the PRs form a GitHub stack; its review history stays on #8.
Developers need the runtime on their own machine without a database server, TLS or an identity provider, like
temporal server start-dev. And a healthy start logged hundreds of transient errors (about 400 on a fresh PostgreSQL start), which makes it look broken.Goals
workflow-engine start-devandbin/workflow-runtime dev: every service on SQLite (in memory, or--db-file), no authorization, on127.0.0.1:7233, withdefaultand each--namespacecreated before the services start.Approach
Namespaces before start. Dev mode registers its namespaces with Temporal's
schema/sqlite.CreateNamespaces, on a database connection held open for the process (SQLite deletes an in-memory database with its last connection).WorkflowKindpre-registered. The namespaces carry theWorkflowKindsearch attribute.ballerina/workflowregisters it at start and then starts a workflow, which the frontend refused until its namespace cache refreshed. That reproduced on every fresh development engine, and is fixed by setting the column alias when the namespace is created.Grace-period logger.
quietLoggerwraps the engine's logger and matches the error tag's text against known transient causes, during the grace period only:Not enough hosts to serve the requestshard status unknowncontext canceledFrontend is not healthy yetNo new dependency is needed: zap is not in the WSO2 registry, so the logger uses Temporal's tag API.
Membership ports. Temporal's PostgreSQL and MySQL schemas store the membership port in a SMALLINT, so a service port above 33067 broke membership at start. Found by testing on high ports.
Release note
bin/workflow-runtime devstarts a development Workflow Runtime with thedefaultnamespace and no setup; transient start-up errors no longer flood the log.Documentation
docs/user-guide/quick-start.md(new); install, configure, connect, monitor, troubleshoot and the reference updated;docs/features/engine.md,docs/features/runtime-config.md, the zip README.Automation tests
start-devflags, the namespaces created before the server, and errors.devscript command.ballerina/workflowintegration ran its first workflow on a fresh in-memory development engine.--db-fileengine kept its namespaces and workflows across a restart.Security checks
Related PRs
#4, #5, #6, #7 (base).
Test environment
Go 1.26.10, macOS arm64; PostgreSQL 16 in Docker; Ballerina 2201.14.1 with
ballerina/workflow1.0.2.Summary by CodeRabbit