beads/internal/tracker
Jim Wordelman 50003b803b
feat(storage): refuse test DBs on production dolt servers (AD-01) (#3632)
* feat(storage): be-c5p AD-01 isProductionPort + DB-name firewall

Generalize the BEADS_TEST_MODE production-port guard so deployments
on non-3307 ports (BEADS_PRODUCTION_PORT env, BeadsDir/dolt-server.port
file) are also caught, and add a defense-in-depth database-name
firewall that refuses test-named DBs on any server unless the operator
opts into the dedicated test-server lane via BEADS_TEST_SERVER=1.

Both defenses honor BEADS_TEST_SERVER=1 as the single opt-in for
test-server connections, so each test harness flips one env var rather
than each layer reasoning about test/prod independently. Adds benchdb_
to testDatabasePrefixes (per-bench scratch DBs from cmd/bd/dolt.go)
and updates the doc-block to call out the two sibling prefix lists
that need to converge under be-avn.

Test harnesses across cmd/bd, internal/storage/dolt, internal/molecules,
internal/tracker, internal/utils, doctor, doctor/fix, protocol,
regression, and the root suite now set BEADS_TEST_SERVER=1 alongside
BEADS_TEST_MODE=1 in TestMain. The cross-rig integration test that
filters BEADS_* env on subprocess Cmd.Env adds it back explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: release gate PASS for be-c5p-firewall (be-m1u/47dcc380)

* fix(test): adapt store_unit_test.go for BEADS_DOLT_SERVER_PORT (rebase compat)

Tests that exercise applyConfigDefaults now clear BEADS_DOLT_SERVER_PORT (added
to main after this branch was cut) so the legacy BEADS_DOLT_PORT path runs as
intended. Without this, a GC-city environment with BEADS_DOLT_SERVER_PORT set
causes the tests to resolve an unexpected port.

* fix(dolt): stop BEADS_TEST_SERVER=1 from suppressing DefaultSQLPort detection

Restructure productionPortReasons so Rule 1 (cfg.ServerPort ==
DefaultSQLPort) is evaluated unconditionally; BEADS_TEST_SERVER=1 now only
suppresses the BEADS_PRODUCTION_PORT and dolt-server.port heuristics (Rules
2 and 3). isProductionPort loses its independent whole-function bypass and
becomes a thin wrapper. Update doc comments on both functions and the
buildTestModeProductionPortPanic fix list (which no longer lists
BEADS_TEST_SERVER=1 as a fix when port 3307 is the matched reason) to match.
Add TestApplyConfigDefaults_TestModeBlocksProdPort_EvenWithTestServerOptIn
asserting port 3307 is still refused with the opt-in set.

Also: drop a redundant explicit db.Close() in openServerConnection's
firewall-refusal path (already covered by the connReady defer), and fix two
comments that referenced a non-existent uniqueBenchDBName, pointing them at
the real generator (cmd/bd/template_test.go newTemplateBenchmarkStore) with
the correct benchdb_ name format.

Agent-Signature: claude-sonnet-medium on behalf of matt wilkie

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
2026-07-24 01:28:51 -07:00
..
engine.go fix(tracker): gate externalRefChangedAfter on capability, not DB() presence (#4549) (#4734) 2026-07-12 14:12:54 -07:00
engine_external_ref_history_test.go fix(tracker): gate externalRefChangedAfter on capability, not DB() presence (#4549) (#4734) 2026-07-12 14:12:54 -07:00
engine_history_gate_cgo_test.go fix(tracker): gate externalRefChangedAfter on capability, not DB() presence (#4549) (#4734) 2026-07-12 14:12:54 -07:00
engine_ratelimit_test.go test: split tracker pure-go helpers (#4183) 2026-05-26 16:31:17 -07:00
engine_selective_test.go feat: add IssueIDs filter to SyncOptions for selective sync (#2957) 2026-04-05 22:24:47 -07:00
engine_test.go feat(linear): linear.exclude_id_prefix and linear.exclude_id_patterns (#4613) 2026-07-06 22:33:06 -07:00
errors.go github: classify rate-limit 403s and stop the push loop when one hits (#3624) 2026-05-02 14:24:57 -07:00
multiproject.go feat: multi-project/team support for Linear, Jira, and ADO 2026-03-28 13:40:39 -07:00
multiproject_test.go feat: multi-project/team support for Linear, Jira, and ADO 2026-03-28 13:40:39 -07:00
registry.go feat: add plugin-based issue tracker framework (GH#1150) 2026-02-14 14:09:40 -08:00
registry_test.go feat: add plugin-based issue tracker framework (GH#1150) 2026-02-14 14:09:40 -08:00
test_helpers_pure_test.go fix(tracker): repair sync engine bugs unmasked by born-failing engine tests (bd-578h9.1) 2026-06-11 10:26:36 -04:00
testmain_test.go feat(storage): refuse test DBs on production dolt servers (AD-01) (#3632) 2026-07-24 01:28:51 -07:00
tracker.go feat: reimplement Notion sync on REST data sources (fix-merge PR #2759) 2026-03-27 19:20:40 -07:00
types.go feat(gitlab): sync issue dependency links on push (#4294) 2026-07-08 08:00:41 -07:00