Skip to content

Latest commit

 

History

History
200 lines (151 loc) · 8.61 KB

File metadata and controls

200 lines (151 loc) · 8.61 KB

Migration Plan: cl-irc to clatter-irc

Overview

Glenn Thompson’s glenneth/clatter-refactor branch replaces cl-irc with clatter-irc, a ground-up IRC protocol library. The branch also adds 10 new plugins, a memo system, per-channel Markov contexts, keepalive PING, auto-reconnect, and a quotes table.

This document plans the merge of that work into master via the local branch fade/migrate-to-clatter.

Branch Inventory

SourceCommits+Lines-Lines
glenneth/glenneth/clatter-refactor111748392

Files changed: 17 (including 3 new files: memo.lisp, test/memo-test.lisp, bin/consort.sh, bin/run-consort.lisp, docs/clatter-refactor-difficulties.org, database/bot-schema.sql.template additions).

Pre-Merge: Blocking Issues

These must be resolved before any merge attempt.

BLOCKER 1: users.lisp :initform regression

The branch carries the :iniform typo on the ignored slot of channel-user (line 59 of users.lisp). Master already has the fix (commit ed36ea7). The branch version will revert this fix.

  • Action: After merge, ensure the :initform spelling is preserved from master. This is a simple conflict resolution.

BLOCKER 2: NickServ IDENTIFY format regression

Master’s commit 2de764e changed the IDENTIFY command from IDENTIFY <password> to IDENTIFY <nick> <password> to fix multi-word password parsing on networks that expect the two-argument form. The branch uses the old single-argument form.

  • Action: Port the two-argument IDENTIFY format into the clatter-irc hook code. The relevant code is in the on-notice NickServ handler in irc-client.lisp.

BLOCKER 3: clatter-irc library availability

clatter-irc is not present in Quicklisp or in ~/SourceCode/lisp/. The system definition in harlie.asd depends on :clatter-irc but the library must be sourced.

  • Action: Obtain clatter-irc source. Confirm Glenn’s repo location, clone to ~/SourceCode/lisp/clatter-irc/, verify ASDF can find it via the existing source registry tree scan.

Merge Strategy

Given that the branch touches 17 files with 1748 insertions across 11 commits, a selective cherry-pick or rebase is impractical. The recommended approach:

  1. Merge glenneth/glenneth/clatter-refactor into fade/migrate-to-clatter.
  2. Resolve conflicts (at minimum: users.lisp, irc-client.lisp).
  3. Apply fixups as separate commits on the migration branch.
  4. Test compilation, then runtime against a test IRC server.
  5. Merge fade/migrate-to-clatter into master once validated.

Phase 1: Library & Build (compile gate)

Goal: harlie compiles cleanly with clatter-irc as its IRC backend.

TaskStatus
Obtain and install clatter-ircTODO
Merge branch into fade/migrate-to-clatterTODO
Resolve users.lisp initform conflictTODO
Resolve irc-client.lisp conflicts with masterTODO
Fix NickServ IDENTIFY two-arg formatTODO
Clear FASL cache, compile from clean stateTODO
Verify all ASDF systems load: harlie,TODO
harlie/test/fake-irc-server,
harlie/test/nickserv-flow,
harlie/test/memo

Phase 2: Database Schema (schema gate)

Goal: PostgreSQL schema supports all new features.

TaskStatus
Review quotes table addition in schemaTODO
Run bot-schema.sql.template against test DBTODO
Verify existing tables unaffectedTODO
Write migration SQL for live botdbTODO

Phase 3: Test Suite (test gate)

Goal: All existing and new tests pass.

TaskStatus
Run harlie/test/nickserv-flowTODO
Run harlie/test/memoTODO
Run harlie/test/db testsTODO
Run harlie/test/allTODO
Manual test: MCP eval-lisp-form toolTODO

Phase 4: Runtime Validation (integration gate)

Goal: Bot connects, joins channels, and operates correctly.

TaskStatus
Start bot against irc.srh.org (local test)TODO
Verify channel join on all configured channelsTODO
Verify NickServ identification on LiberaTODO
Verify keepalive PING thread activeTODO
Verify auto-reconnect on disconnectTODO
Test !metar, !tell, !wiki, !quote pluginsTODO
Test Markov chain trigger/responseTODO
Test ignore system (per-user, per-channel)TODO
Verify no HARLIE::E or SETF VISIBILITY errorsTODO

Phase 5: Merge to Master

TaskStatus
Squash or tidy commit historyTODO
Final review of diff against masterTODO
Merge fade/migrate-to-clatter into masterTODO
Push to originTODO
Deploy to outrider.deepsky.comTODO

Architecture Changes to Understand

Hook System Migration

cl-irc hooks were keyed by message class names (irc::irc-privmsg-message) and dispatched through CLOS generic functions (default-hook, :after methods). clatter-irc uses named event symbols:

cl-irc hook classclatter-irc hook
irc::irc-privmsg-messageon-privmsg
irc::irc-notice-messageon-notice
irc::irc-join-messageon-join
irc::irc-part-messageon-part
irc::irc-quit-messageon-quit
irc::irc-nick-messageon-nick
irc::irc-rpl_welcome-messageon-numeric (001)
irc::irc-rpl_namreply-messageon-numeric (353)
irc::irc-ping-message(handled internally)
irc::ctcp-action-messageon-ctcp

Hook signatures change from (lambda (message)) to parsed components: (lambda (conn sender target text)) or similar per hook type.

Connection Class Thinning

bot-irc-connection now only carries: last-message, message-q, mq-task, bot-state, nickserv-password, nickserv-email.

Previously it also carried channel hashes, user tracking, ignore lists, and connection state — all now handled by clatter-irc natively.

Read Loop Removal

The manual (loop (handler-case (read-message connection) ...)) in the thunk is replaced by clatter-irc’s internal read thread. The thunk now calls (bt:join-thread (connection-read-thread connection)) to block until disconnection. This eliminates the class of bugs where hook errors killed the read loop.

What Our Recent Fixes Address

The fix/guard-nil-channel-in-namreply (cl-irc) and fix/harden-namreply-after-hook (harlie) branches fix bugs in the cl-irc code path. Once clatter-irc replaces cl-irc, these fixes become moot — clatter-irc handles channel tracking internally and the default-hook :after methods are removed entirely.

However, the fixes remain valuable as long as:

  1. We are testing on master before the migration branch is ready.
  2. We need a fallback if the migration stalls.

Risks and Mitigations

RiskMitigation
clatter-irc not available / won’t loadObtain source before starting merge
Unknown numeric handling regressionVerify clatter-irc silently ignores
unrecognised server numerics
Memo system unbounded memory growthAdd TTL or max-count to memo store
Plugin external API failures (wiki, gh)Verify timeout/error handling
!eval sandbox escapeAudit whitelisted symbols carefully
Per-channel contexts break shared stateTest with existing botdb data
FASL cache serving stale compiled codeClear cache at every phase boundary