Repository navigation
chore(config): drop the unread retention.execution_history_days default - #1204
Conversation
retention.execution_history_days (90) sat in DefaultSettings with no reader. Execution retention is the constant DefaultExecutionTTLDays (30), which the cleanup handler passes to CleanupOldExecutions and the plan health lookback reuses. Remove the dead entry and its test row, add a test that keeps it out, and document the real horizon in the config README. No migration: DefaultSettings is an in-memory Go slice that nothing writes to storage, and no table in the schema holds key/value settings, so there is no row on existing installs to delete. Closes LeanerCloud#88 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75. Or wait 59 minutes for your next included review. View limit details
Comment |
|
Independent review 2 (claude-fleet, cold): APPROVE b936fe1 Findings (none blocking):
Against #88: option 2 is done fully, and "no migration needed" holds.
Drift: none of main's 14 newer commits (origin/main 7eac792) touch internal/config, plan_health.go or server/handler.go. Attacked:
Verified locally, with no cloud credentials, under the heavy lock:
Reviewed by an independent agent with no author context (second reviewer). Review only: nothing was pushed, and the GitHub review state is unchanged. |
|
VERDICT: APPROVE b936fe1 Findings:
Attacked:
|
|
Local verification at
CI on this head: CI Success and pre-commit green. cristim's independent review approved this head. Migrations in this batch (000136-000139) are applied in numeric order. Nothing was run against any cloud. |
|
Marked ready and merged by IAmJSD's agent at IAmJSD's request (IAmJSD is acting owner while the maintainers are away), after cristim's independent review approving |
This PR takes the issue's option 2 (remove the dead key). It matches how execution retention works today and it is the smaller change. Option 1 (have the cleanup path read a setting) is still open if the owner wants retention to be tunable per install. That would be a new, wired setting. It wouldn't revive this seed entry, and
planHealthLookbackDayswould have to read the same value, as the issue notes.Root cause
retention.execution_history_days(value 90) was an entry in the Go sliceconfig.DefaultSettings, and nothing read it. Execution retention is actually set by the compile-time constantconfig.DefaultExecutionTTLDays(30).internal/server/handler.gopasses that constant toCleanupOldExecutions, and the plan health score'splanHealthLookbackDays(internal/api/plan_health.go) reuses it. The config README listed the 90-day key as the retention setting, which is how it came to be cited as policy in review.Fix
internal/config/defaults.go: remove the entry. A short comment in its place points atDefaultExecutionTTLDaysand its two consumers.internal/config/defaults_test.go: remove the key's row fromTestDefaultSettings_Retention. AddTestDefaultSettings_NoExecutionRetentionKey, which asserts the key is absent and thatDefaultExecutionTTLDaysis 30.internal/config/README.md: remove the key from "Data Retention". Replace it with a paragraph saying that execution retention isDefaultExecutionTTLDays(30 days), what the sweep deletes and on which column (completed byscheduled_date, canceled byupdated_at, plus theexpires_atbranch; failed executions are never deleted), and that the plan health lookback is the same constant.No migration: there is no row to delete
The issue (and the plan for this PR) assumed the key is stored as a row in a settings table on existing installs, so a migration would be needed to delete it. That assumption is wrong for the current code, so this PR adds no migration:
DefaultSettingsis an in-memory slice. Outsidedefaults.goit is referenced only bydefaults_test.goand by one comment instore_postgres.go.GetDefaultValue,GetDefaultSetting,GetDefaultsByCategoryandGetAllCategorieshave no non-test callers. Nothing writes these entries to Postgres or anywhere else.CREATE TABLEininternal/database/postgres/migrations/*.up.sqlwas checked. No key/value settings table exists. Global settings live in typed columns on the singletonglobal_configrow, and there is no retention column. No migration inserts anyretention.*key.DELETEmigration would have nothing to delete, and a down migration would have no table to re-insert into. Adding a no-op one would only use up a migration number (numbers collide often in this repo). For the same reason there is no Postgres migration test.A related point: the issue says an operator "can change it in the settings UI". No API, openapi schema, validation list or frontend code mentions the key, so it was never editable. The harm was limited to the misleading README and code entry.
Other references checked
frontend/: no reference toexecution_history_days,retentionorhistoryDaysinfrontend/srcorfrontend/tests-e2e. No frontend follow-up is needed.internal/api/openapi.yaml: the key is absent. The plan-healthcodedescription already says the "trailing execution-retention window (30 days)", which is still correct.internal/api/plan_health.go(planHealthLookbackDays) and theinternal/server/handler.gocall site: both comments already citeconfig.DefaultExecutionTTLDays, not the dead key, so they needed no change.Verification
This is unit-test and static evidence only. The change has no runtime behavior, because the entry had no reader.
Fail-before: the new test was run with only the test edit applied, against unmodified
defaults.go:Pass-after:
The tests were run with
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/nullbecause the default AWS profile on the local machine is invalid. This PR doesn't depend on it.Out of scope (noted, not changed)
DefaultSettingshas the same problem. Nothing reads any of it, includingretention.purchase_history_daysandretention.recommendation_cache_hours. Much ofinternal/config/README.mdalso describes a DynamoDB-backedConfigDBClientthat no longer exists, including an "Initialize database with defaults" example. This PR only fixes the key and section the issue covers. A wider cleanup could be its own issue.internal/purchase/execution.go(theTODO(#95)comment) sayspurchase_executionsrows have "a ~6-month retention window". That doesn't match the 30-day sweep. It belongs to sec(api): createPlan accepts target_accounts outside the caller's allowed_accounts #95's alias-removal decision, so it was left alone.Closes #88
Maintainers: please mirror the issue's triage labels onto this PR:
impact/internal,type/chore,triaged,priority/p3,severity/low,urgency/eventually,effort/s.🤖 Generated with Claude Code