Skip to content

AH subprocess Phase 3: bound terminal worker journal retention#444

Merged
MadMaxMangos merged 3 commits into
masterfrom
feature/ah-sp3-worker-maintenance
Jul 15, 2026
Merged

AH subprocess Phase 3: bound terminal worker journal retention#444
MadMaxMangos merged 3 commits into
masterfrom
feature/ah-sp3-worker-maintenance

Conversation

@MadMaxMangos

@MadMaxMangos MadMaxMangos commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Add periodic bounded retention for terminal ah_worker_journal rows.
  • Prune COMMITTED rows by created_time and APPLIED rows by resolved_time.
  • Retain an APPLIED resolution while custody_ledger still contains its resolve:<uuid> idempotency marker.
  • Drain at most 100 rows per terminal state per service-loop pass, allowing IPC and heartbeat processing between batches.
  • Start one bounded retention pass at worker startup, then use the configured cadence.
  • Stamp direct APPLIED transitions from wall time so retention does not depend on the first IPC_GAMETIME frame.

Configuration

  • Add AH.Service.JournalTerminalRetentionSec = 2592000.
  • Keep the earlier unmerged AH.Service.JournalAppliedRetentionSec name as a fallback so a staged 0 disable value remains effective.
  • Keep AH.Service.JournalPruneIntervalSec = 3600; setting either effective value to 0 disables pruning.
  • Advance the AH configuration version to 2026071400.
  • Add the worker's required read-only SELECT grant on custody_ledger; no custody write access is added.

Database Coordination

This server change requires character DB 22.5.3 from mangoszero/database#157. Apply that migration before deploying or enabling the updated worker.

Safety

  • RESOLVING, CANCEL_PREPARED, and INTENT_PENDING rows are never retention targets.
  • Custody-marker presence is checked in the delete itself as well as candidate selection.
  • Database failure stops the current drain and leaves remaining rows for the next cadence.
  • Plain --selftest remains config-free; an explicit --config opts into DB-backed checks without the scheduler fixture replacing global configuration.

Testing

  • Built mangosd, realmd, and ah-service in Release with MSVC.
  • Completed a clean CMake install and verified deployed binary hashes match build outputs.
  • Passed config-free and DB-backed installed ah-service --selftest runs.
  • Passed installed mangosd -t noop, -t ahforwardreserve, and -t ahmutresult.
  • Applied Rel22_05_003 from both a clean 22.5.2 schema and an interrupted post-DDL/pre-version state on MariaDB 10.11.
  • Verified character DB 22.5.3, both composite index definitions, configuration version/key parity, and clean staged diffs.
  • Completed independent re-review with no remaining High or Medium findings.

This change is Reviewable/

@MadMaxMangos

Copy link
Copy Markdown
Member Author

@claude

@codacy-production

codacy-production Bot commented Jul 14, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 18 complexity · 0 duplication

Metric Results
Complexity 18
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be827b55d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/modules/AhWorker/Main.cpp Outdated
Comment thread src/modules/AhWorker/ah-service.conf.dist.in Outdated
Comment thread src/modules/AhWorker/Main.cpp Outdated
Comment thread src/modules/AhWorker/Main.cpp Outdated
Comment thread src/modules/AhWorker/Main.cpp
Comment thread src/modules/AhWorker/Main.cpp Outdated
Comment thread src/modules/AhWorker/Main.cpp Outdated
@AppVeyorBot

Copy link
Copy Markdown

@MadMaxMangos MadMaxMangos changed the title AH subprocess Phase 3: prune applied worker journal rows AH subprocess Phase 3: bound terminal worker journal retention Jul 14, 2026
@MadMaxMangos

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f0e2e6fe89

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/modules/AhWorker/Journal.cpp
Comment thread src/modules/AhWorker/Journal.cpp
@AppVeyorBot

Copy link
Copy Markdown

@MadMaxMangos

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: c9b236b9c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@AppVeyorBot

Copy link
Copy Markdown

@MadMaxMangos MadMaxMangos merged commit fde0766 into master Jul 15, 2026
8 checks passed
@MadMaxMangos MadMaxMangos deleted the feature/ah-sp3-worker-maintenance branch July 15, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants