<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="https://riceball.com/wp-content/plugins/pretty-rss-feeds/xslt/pretty-feed.xsl" type="text/xsl" media="screen" ?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thaura - 🍙</title>
	<atom:link href="https://riceball.com/tag/thaura/feed/" rel="self" type="application/rss+xml" />
	<link>https://riceball.com</link>
	<description></description>
	<lastBuildDate>Wed, 25 Nov 2026 23:39:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://riceball.com/wp-content/uploads/sites/2/2025/10/onigiri-150x150.png</url>
	<title>Thaura - 🍙</title>
	<link>https://riceball.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Thaura: Cleaning up Firewalls</title>
		<link>https://riceball.com/2026/11/25/thaura-cleaning-up-firewalls/</link>
					<comments>https://riceball.com/2026/11/25/thaura-cleaning-up-firewalls/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 25 Nov 2026 23:17:13 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31566</guid>

					<description><![CDATA[<p>This is a quick way to use nmap and ufw to figure out what ports are open, but not being used. Example nmap output, taken from outside of the server: 21/tcp closed ftp22/tcp open ssh25/tcp closed smtp53/tcp closed domain80/tcp open http110/tcp closed pop3143/tcp closed imap443/tcp open https465/tcp closed smtps873/tcp open rsync Example uwf status numbered [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/11/25/thaura-cleaning-up-firewalls/">Thaura: Cleaning up Firewalls</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">This is a quick way to use nmap and ufw to figure out what ports are open, but not being used.</p>


<pre class="wp-block-code"><span><code class="hljs language-xml shcb-wrap-lines">I need to clean up my UFW firewall. Here's a list of the rules, followed by an external nmap of the server. make a command to remove unusued ports.

(Pasted in a copy of the results of <span class="hljs-tag">&lt;<span class="hljs-name">code</span>&gt;</span>sudo nmap example.com)<span class="hljs-tag">&lt;/<span class="hljs-name">code</span>&gt;</span>
(Pasted in the results of <span class="hljs-tag">&lt;<span class="hljs-name">code</span>&gt;</span>sudo ufw status numbered)<span class="hljs-tag">&lt;/<span class="hljs-name">code</span>&gt;</span></code></span></pre>


<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Example nmap output, taken from outside of the server:</p>



<p class="wp-block-paragraph">21/tcp closed ftp<br>22/tcp open ssh<br>25/tcp closed smtp<br>53/tcp closed domain<br>80/tcp open http<br>110/tcp closed pop3<br>143/tcp closed imap<br>443/tcp open https<br>465/tcp closed smtps<br>873/tcp open rsync</p>



<p class="wp-block-paragraph">Example uwf status numbered output, taken from inside the server:</p>



<p class="wp-block-paragraph">[ 5] 22/tcp ALLOW IN Anywhere<br>[ 6] 443/tcp ALLOW IN Anywhere<br>[ 7] 80/tcp ALLOW IN Anywhere<br>[ 8] 143/tcp ALLOW IN Anywhere<br>[ 9] 993/tcp ALLOW IN Anywhere<br>[10] 25/tcp ALLOW IN Anywhere<br>[11] 465/tcp ALLOW IN Anywhere<br>[12] 110 ALLOW IN Anywhere<br>[13] 995 ALLOW IN Anywhere</p>



<p class="wp-block-paragraph">The prompt matches ports to rules. If a port is &#8220;closed&#8221; but the firewall says &#8220;ALLOW IN&#8221;, it means the port is open, but it doesn&#8217;t go to any service.</p>



<p class="wp-block-paragraph">A good example is port 25. I had port 25 opened, but the nmap scan says it&#8217;s closed.</p>



<p class="wp-block-paragraph">The prompt will produce a command that deletes the ufw firewall rules.</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript"><span class="hljs-keyword">for</span> p <span class="hljs-keyword">in</span> <span class="hljs-number">21</span>/tcp <span class="hljs-number">25</span> <span class="hljs-number">53</span> <span class="hljs-number">110</span> <span class="hljs-number">143</span> <span class="hljs-number">465</span> <span class="hljs-number">993</span> <span class="hljs-number">995</span> <span class="hljs-number">1022</span> <span class="hljs-number">1723</span> \                       
         <span class="hljs-number">3030</span> <span class="hljs-number">3031</span> <span class="hljs-number">6667</span> <span class="hljs-number">7070</span> <span class="hljs-number">8001</span> <span class="hljs-number">8008</span> <span class="hljs-number">8021</span> <span class="hljs-number">8031</span> <span class="hljs-number">8080</span> \
         <span class="hljs-number">9000</span> <span class="hljs-number">9001</span> <span class="hljs-number">9002</span> <span class="hljs-number">9010</span> <span class="hljs-number">9090</span> <span class="hljs-number">9091</span>; <span class="hljs-keyword">do</span>
  sudo ufw <span class="hljs-keyword">delete</span> allow <span class="hljs-string">"$p"</span>
done</code></span></pre><p>The post <a href="https://riceball.com/2026/11/25/thaura-cleaning-up-firewalls/">Thaura: Cleaning up Firewalls</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/11/25/thaura-cleaning-up-firewalls/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Refactoring Legacy PHP, Pipelines</title>
		<link>https://riceball.com/2026/11/21/thaura-refactoring-legacy-php-pipelines/</link>
					<comments>https://riceball.com/2026/11/21/thaura-refactoring-legacy-php-pipelines/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 22 Nov 2026 06:24:29 +0000</pubDate>
				<category><![CDATA[Human Learning]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31540</guid>

					<description><![CDATA[<p>A brief show-and-tell about one pattern to use for refactoring. The LLM produced this, and I&#8217;m explaining it. I generally let the LLM pick names, coding style, and how to chop up the code. My big goals: Refactoring Long Functions I remembered lots of long scripts with long, complicated logic. One of the challenges was [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/11/21/thaura-refactoring-legacy-php-pipelines/">Thaura: Refactoring Legacy PHP, Pipelines</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">A brief show-and-tell about one pattern to use for refactoring. The LLM produced this, and I&#8217;m explaining it. I generally let the LLM pick names, coding style, and how to chop up the code.</p>



<p class="wp-block-paragraph">My big goals:</p>



<ul class="wp-block-list">
<li>Reduce code file size, so it more easily fits in small contexts.</li>



<li>Define more boundaries, inputs, and outputs, so you can reason more easily about the code, and find duplicated code, opportunities to create a library, and maybe eliminate code.</li>



<li>Make the code more testable, and make tests.</li>
</ul>



<h3 class="wp-block-heading">Refactoring Long Functions</h3>



<p class="wp-block-paragraph">I remembered lots of long scripts with long, complicated logic. One of the challenges was figuring out where one part ended, and another started.</p>



<p class="wp-block-paragraph">I asked it to refactor the code into a &#8220;flow&#8221;, using a small framework to run the parts. I should have said &#8220;pipeline&#8221;, because it created a class called Pipeline.</p>



<p class="wp-block-paragraph">It works like unix pipes, sort of.</p>



<p class="wp-block-paragraph">The upper part creates the pipeline. The lower part creates an array, and passes it through the pipeline. more explanation below.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Deja-Vu-Mono.ttf" style="font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    public static function create(Request $request, bool $isComment): \Api\Response
    {
        $payload = \LAACTIVE\Pipeline::of(
            PublishFlowStages::restoreRawPost(...),
            PublishFlowStages::normalizeFileCount(...),
            PublishFlowStages::resolveParent(...),
            PublishFlowStages::validateCsrf(...),
            Stage::on('post', PublishFlowStages::defaultLanguage(...), 'response'),
            PublishFlowStages::checkForm(...),
            PublishFlowStages::receiveUploads(...),
            Stage::derive('fields', &#91;'post', 'files', 'received'&#93;, PublishFlowStages::storyFieldsFrom(...), 'response'),
            PublishFlowStages::createStory(...),
            PublishFlowStages::createComment(...),
            PublishFlowStages::createAttachments(...),
            PublishFlowStages::regenerateListings(...),
        )->process([
            'request' => $request,
            'files' => $request->files(),
            'isComment' => $isComment,
            'post' => [],
            'topId' => 0,
            'received' => null,
            'fields' => null,
            'id' => 0,
            'parentConstant' => '',
            'response' => null,
        ]);

        return $payload&#91;'response'&#93; ?? \Api\Response::redirect(
            '/publish2/success?id=' . rawurlencode((string) $payload&#91;'parentConstant'&#93;)
            . '&amp;type=' . ($payload&#91;'isComment'&#93; ? 'comment' : 'story')
        );
    }</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F8F8F2">    public static </span><span style="color: #FF79C6">function</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">create</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">Request</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$request</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">bool</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$isComment</span><span style="color: #F8F8F2">)</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2"> \</span><span style="color: #8BE9FD; font-style: italic">Api</span><span style="color: #F8F8F2">\</span><span style="color: #8BE9FD; font-style: italic">Response</span></span>
<span class="line"><span style="color: #F8F8F2">    {</span></span>
<span class="line"><span style="color: #F8F8F2">        $payload </span><span style="color: #FF79C6">=</span><span style="color: #F8F8F2"> \LAACTIVE\Pipeline::</span><span style="color: #50FA7B">of</span><span style="color: #F8F8F2">(</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">restoreRawPost</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">normalizeFileCount</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">resolveParent</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">validateCsrf</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            Stage::</span><span style="color: #50FA7B">on</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">post</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, PublishFlowStages::</span><span style="color: #50FA7B">defaultLanguage</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">), </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">response</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">checkForm</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">receiveUploads</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            Stage::</span><span style="color: #50FA7B">derive</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">fields</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, &#91;</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">post</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">files</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">received</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">&#93;, PublishFlowStages::</span><span style="color: #50FA7B">storyFieldsFrom</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">), </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">response</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">createStory</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">createComment</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">createAttachments</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">            PublishFlowStages::</span><span style="color: #50FA7B">regenerateListings</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">),</span></span>
<span class="line"><span style="color: #F8F8F2">        )</span><span style="color: #FF79C6">-&gt;</span><span style="color: #50FA7B">process</span><span style="color: #F8F8F2">([</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">request</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> $request,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">files</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> $request</span><span style="color: #FF79C6">-&gt;</span><span style="color: #50FA7B">files</span><span style="color: #F8F8F2">(),</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">isComment</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> $isComment,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">post</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> [],</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">topId</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">0</span><span style="color: #F8F8F2">,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">received</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">null</span><span style="color: #F8F8F2">,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">fields</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">null</span><span style="color: #F8F8F2">,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">id</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">0</span><span style="color: #F8F8F2">,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">parentConstant</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> </span><span style="color: #E9F284">&#39;&#39;</span><span style="color: #F8F8F2">,</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">response</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">null</span><span style="color: #F8F8F2">,</span></span>
<span class="line"><span style="color: #F8F8F2">        ]);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F8F8F2">        </span><span style="color: #FF79C6">return</span><span style="color: #F8F8F2"> $payload&#91;</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">response</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">&#93; </span><span style="color: #FF79C6">??</span><span style="color: #F8F8F2"> \Api\Response::</span><span style="color: #50FA7B">redirect</span><span style="color: #F8F8F2">(</span></span>
<span class="line"><span style="color: #F8F8F2">            </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">/publish2/success?id=</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> . </span><span style="color: #50FA7B">rawurlencode</span><span style="color: #F8F8F2">((string) $payload&#91;</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">parentConstant</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">&#93;)</span></span>
<span class="line"><span style="color: #F8F8F2">            . </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">&amp;type=</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> . ($payload&#91;</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">isComment</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">&#93; </span><span style="color: #FF79C6">?</span><span style="color: #F8F8F2"> </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">comment</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2"> </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">story</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">)</span></span>
<span class="line"><span style="color: #F8F8F2">        );</span></span>
<span class="line"><span style="color: #F8F8F2">    }</span></span></code></pre></div>



<p class="wp-block-paragraph">The &#8230; is new in PHP8.1, and it turns the static method into a closure (an anonymous function). So Pipeline::of() takes a list of closures, and then passes the array into the first one, takes the output of it, and passes it to the second one, and so on. The output is a transformation of the input, usually.</p>



<p class="wp-block-paragraph">(It reminds me a little of PowerShell as much as Unix pipes.)</p>



<h3 class="wp-block-heading">Functional Programming Style</h3>



<p class="wp-block-paragraph">Stage::derive() is a helper to make the functions more general-purpose. Notice that the array has specific key names. Each function needs to use these key names. That violates the principle of encapsulation &#8212; but for this app, we generally tolerate it. </p>



<p class="wp-block-paragraph">I suspected there might be some functions that could be reused. So I asked for a feature to make the function more generic, and to specify which keys to use. Thaura created bind(), and then derive().  Here are their signatures and comments:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Deja-Vu-Mono.ttf" style="font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>    /**
     * The one stage body: halt when the payload already carries the
     * short-circuit state; otherwise gather the read keys' values in
     * order, call the filter with them, and write the returned values
     * back to the write keys in order. Every binding above is this
     * with different key lists.
     *
     * @param list&lt;string> $read
     * @param list&lt;string> $write
     */
    private static function bind(array $read, array $write, callable $filter, string $haltKey): callable
    {
    
    
    ...
    
        /**
     * Bind a pure derivation: the filter receives the values of the
     * source keys, in the order given, and returns the value written
     * to the destination key. The source keys are read-only. A single
     * source key is the one-key-into-another-key map.
     */
    public static function derive(string $to, array $from, callable $filter, string $haltKey = 'errors'): callable
    {
        return self::bind($from, &#91;$to&#93;, static fn (...$args): array => &#91;$filter(...$args)&#93;, $haltKey);
    }</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F8F8F2">    </span><span style="color: #6272A4">/**</span></span>
<span class="line"><span style="color: #6272A4">     * The one stage body: halt when the payload already carries the</span></span>
<span class="line"><span style="color: #6272A4">     * short-circuit state; otherwise gather the read keys&#39; values in</span></span>
<span class="line"><span style="color: #6272A4">     * order, call the filter with them, and write the returned values</span></span>
<span class="line"><span style="color: #6272A4">     * back to the write keys in order. Every binding above is this</span></span>
<span class="line"><span style="color: #6272A4">     * with different key lists.</span></span>
<span class="line"><span style="color: #6272A4">     *</span></span>
<span class="line"><span style="color: #6272A4">     * </span><span style="color: #FF79C6">@param</span><span style="color: #6272A4"> </span><span style="color: #FFB86C; font-style: italic">list</span><span style="color: #6272A4">&lt;string&gt; $read</span></span>
<span class="line"><span style="color: #6272A4">     * </span><span style="color: #FF79C6">@param</span><span style="color: #6272A4"> </span><span style="color: #FFB86C; font-style: italic">list</span><span style="color: #6272A4">&lt;string&gt; $write</span></span>
<span class="line"><span style="color: #6272A4">     */</span></span>
<span class="line"><span style="color: #F8F8F2">    private static </span><span style="color: #FF79C6">function</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">bind</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">array</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$read</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">array</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$write</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">callable</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$filter</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">string</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$haltKey</span><span style="color: #F8F8F2">)</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2"> </span><span style="color: #8BE9FD; font-style: italic">callable</span></span>
<span class="line"><span style="color: #F8F8F2">    {</span></span>
<span class="line"><span style="color: #F8F8F2">    </span></span>
<span class="line"><span style="color: #F8F8F2">    </span></span>
<span class="line"><span style="color: #F8F8F2">    </span><span style="color: #FF79C6">...</span></span>
<span class="line"><span style="color: #F8F8F2">    </span></span>
<span class="line"><span style="color: #F8F8F2">        </span><span style="color: #6272A4">/**</span></span>
<span class="line"><span style="color: #6272A4">     * Bind a pure derivation: the filter receives the values of the</span></span>
<span class="line"><span style="color: #6272A4">     * source keys, in the order given, and returns the value written</span></span>
<span class="line"><span style="color: #6272A4">     * to the destination key. The source keys are read-only. A single</span></span>
<span class="line"><span style="color: #6272A4">     * source key is the one-key-into-another-key map.</span></span>
<span class="line"><span style="color: #6272A4">     */</span></span>
<span class="line"><span style="color: #F8F8F2">    public static </span><span style="color: #FF79C6">function</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">derive</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">string</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$to</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">array</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$from</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">callable</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$filter</span><span style="color: #F8F8F2">, </span><span style="color: #FFB86C; font-style: italic">string</span><span style="color: #F8F8F2"> </span><span style="color: #FFB86C; font-style: italic">$haltKey</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=</span><span style="color: #F8F8F2"> </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">errors</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">)</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2"> </span><span style="color: #8BE9FD; font-style: italic">callable</span></span>
<span class="line"><span style="color: #F8F8F2">    {</span></span>
<span class="line"><span style="color: #F8F8F2">        </span><span style="color: #FF79C6">return</span><span style="color: #F8F8F2"> self::</span><span style="color: #50FA7B">bind</span><span style="color: #F8F8F2">($from, &#91;$to&#93;, static </span><span style="color: #50FA7B">fn</span><span style="color: #F8F8F2"> (</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">$args)</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2"> </span><span style="color: #8BE9FD; font-style: italic">array</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2"> &#91;</span><span style="color: #50FA7B">$filter</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">$args)&#93;, $haltKey);</span></span>
<span class="line"><span style="color: #F8F8F2">    }</span></span></code></pre></div>



<p class="wp-block-paragraph">derive() is a little like array_reduce(), where you take multiple array elements, run a function on them, and then produce a single output. The difference here is you specify the input keys and output key.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Deja-Vu-Mono.ttf" style="font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>Stage::derive('fields', &#91;'post', 'files', 'received'&#93;, PublishFlowStages::storyFieldsFrom(...), 'response'),</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F8F8F2">Stage::</span><span style="color: #50FA7B">derive</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">fields</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, &#91;</span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">post</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">files</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">, </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">received</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">&#93;, PublishFlowStages::</span><span style="color: #50FA7B">storyFieldsFrom</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">), </span><span style="color: #E9F284">&#39;</span><span style="color: #F1FA8C">response</span><span style="color: #E9F284">&#39;</span><span style="color: #F8F8F2">),</span></span></code></pre></div>



<p class="wp-block-paragraph">The output key is &#8216;fields&#8217;, and the input keys are [&#8216;post&#8217;, &#8216;files&#8217;, &#8216;received&#8217;].</p>



<p class="wp-block-paragraph">In English, the code means &#8220;derive &#8216;fields&#8217; from the inputs &#8216;post&#8217;, &#8216;files,&#8217; and &#8216;received&#8217;, using the function storyFieldsFrom(), and the pass-through output is &#8216;response'&#8221;.</p>



<p class="wp-block-paragraph">This is a nice technique to manipulate arrays. You can see there&#8217;s some potential code smell.</p>



<p class="wp-block-paragraph">The &#8216;response&#8217; is the $haltKey.</p>



<p class="wp-block-paragraph">Normally, it&#8217;s called &#8216;error&#8217;, and holds a return value. If it indicates an error, the normal thing is to pass the array through, unchanged. This causes the error to reach the end of the pipeline, and be treated as an error.</p>



<p class="wp-block-paragraph">In this case, the haltKey is &#8216;response&#8217;, and can hold the PSR-7-like Response object. If you have a Response, it gets passed down to the end of the pipeline, and can become the output, a redirect, or an error.</p>



<h3 class="wp-block-heading">Conclusions</h3>



<p class="wp-block-paragraph">This helped to clean up the code a bit, however, I saw some problems immediately.</p>



<p class="wp-block-paragraph">I didn&#8217;t like restoreRawPost() being called at the top, when a regular function could have done the same thing by initializing the &#8216;post&#8217; key, in fewer lines, with less ceremony.</p>



<p class="wp-block-paragraph">It also obscures some of the logic differentiating between stories, comments, and attachments. So it wasn&#8217;t a complete win.</p>



<p class="wp-block-paragraph">That said, breaking pipeline into parts, and applying logic outside of the pipeline, seems straightforward.</p>



<p class="wp-block-paragraph">I was hoping for more code reuse, but even a small win is a victory. The Pipeline and Stage classes are nice.</p>



<p class="wp-block-paragraph">The lines of code didn&#8217;t really decrease, because lots of comments were added, but it was easy to reduce the code size, per file, by moving functions into a helper class.</p><p>The post <a href="https://riceball.com/2026/11/21/thaura-refactoring-legacy-php-pipelines/">Thaura: Refactoring Legacy PHP, Pipelines</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/11/21/thaura-refactoring-legacy-php-pipelines/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Testing Arguments</title>
		<link>https://riceball.com/2026/11/13/thaura-testing-arguments/</link>
					<comments>https://riceball.com/2026/11/13/thaura-testing-arguments/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 13 Nov 2026 18:24:26 +0000</pubDate>
				<category><![CDATA[Human Learning]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31443</guid>

					<description><![CDATA[<p>I was asked to read an argument, and I found a couple parts were speculative. I thought I&#8217;d give it to the Thaura LLM and ask for a detailed breakdown of the strengths and weaknesses of the argument. It produced a lot of things to read. It found a few weak points, and some strong [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/11/13/thaura-testing-arguments/">Thaura: Testing Arguments</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">I was asked to read an argument, and I found a couple parts were speculative. </p>



<p class="wp-block-paragraph">I thought I&#8217;d give it to the Thaura LLM and ask for a detailed breakdown of the strengths and weaknesses of the argument.</p>



<p class="wp-block-paragraph">It produced a lot of things to read. It found a few weak points, and some strong ones, and some in between.</p>



<p class="wp-block-paragraph">You put your arguments into claims.md, put this code below into AGENTS.md, and tell Thaura to read it.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Deja-Vu-Mono.ttf" style="font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly># Stress Testing Political Arguments

You can do your work on radio, in ~/Projects/testing-written-claims/.

You are an expert in political science, demographics, health insurance, public health policy.

To stress test, read the document, claims.md, and then write a new document in YAML format, claims.yaml, that turns each claim into a node. If the claims have sub-claims, make sub-nodes for them as well.

For each node, produce an "argument document" with the id in the filename. List facts you can find about the claim. Indicate which way each source leans, whether for or against the claim. Sources can be neutral, or have contradictory positions (indicating a diversity of ideas or people involved).

For each argument, stress test it. Rank the strength of each argument, ranging from "weak" to "axiomatic". Look for tautologies and flag them, because these function as rhetorical flourishes but aren't going to resolve a contradiction in themselves.
</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F8F8F2"># Stress Testing Political Arguments</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F8F8F2">You can </span><span style="color: #FF79C6">do</span><span style="color: #F8F8F2"> your work on radio, </span><span style="color: #FF79C6">in</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">~/</span><span style="color: #F8F8F2">Projects</span><span style="color: #FF79C6">/</span><span style="color: #F8F8F2">testing</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">written</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">claims</span><span style="color: #FF79C6">/</span><span style="color: #F8F8F2">.</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F8F8F2">You are an expert </span><span style="color: #FF79C6">in</span><span style="color: #F8F8F2"> political science, demographics, health insurance, public health policy.</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F8F8F2">To stress test, read the document, claims.md, and then write a </span><span style="color: #FF79C6; font-weight: bold">new</span><span style="color: #F8F8F2"> document </span><span style="color: #FF79C6">in</span><span style="color: #F8F8F2"> YAML format, claims.yaml, that turns each claim into a node. If the claims have sub</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">claims, make sub</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">nodes for them </span><span style="color: #FF79C6">as</span><span style="color: #F8F8F2"> </span><span style="color: #8BE9FD; font-style: italic">well</span><span style="color: #F8F8F2">.</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F8F8F2">For each node, produce an </span><span style="color: #E9F284">&quot;</span><span style="color: #F1FA8C">argument document</span><span style="color: #E9F284">&quot;</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">with</span><span style="color: #F8F8F2"> the id </span><span style="color: #FF79C6">in</span><span style="color: #F8F8F2"> the filename. List facts you can find about the claim. Indicate which way each source leans, whether for or against the claim. Sources can be neutral, or have contradictory </span><span style="color: #50FA7B">positions</span><span style="color: #F8F8F2"> (indicating a diversity </span><span style="color: #FF79C6">of</span><span style="color: #F8F8F2"> ideas or people involved).</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F8F8F2">For each argument, stress test it. Rank the strength </span><span style="color: #FF79C6">of</span><span style="color: #F8F8F2"> each argument, ranging from </span><span style="color: #E9F284">&quot;</span><span style="color: #F1FA8C">weak</span><span style="color: #E9F284">&quot;</span><span style="color: #F8F8F2"> to </span><span style="color: #E9F284">&quot;</span><span style="color: #F1FA8C">axiomatic</span><span style="color: #E9F284">&quot;</span><span style="color: #F8F8F2">. Look for tautologies and flag them, because these </span><span style="color: #FF79C6">function</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">as</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">rhetorical</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">flourishes</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">but</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">aren</span><span style="color: #F8F8F2">&#39;</span><span style="color: #50FA7B">t</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">going</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">to</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">resolve</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">a</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">contradiction</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">in</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">themselves</span><span style="color: #F8F8F2">.</span></span>
<span class="line"></span></code></pre></div><p>The post <a href="https://riceball.com/2026/11/13/thaura-testing-arguments/">Thaura: Testing Arguments</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/11/13/thaura-testing-arguments/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 5</title>
		<link>https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-5/</link>
					<comments>https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-5/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 31 Oct 2026 02:24:19 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31271</guid>

					<description><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" fetchpriority="high" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="(max-width: 1280px) 100vw, 1280px" /></p><p>Code profiling tools are everything now. When I was staring at Thaura writing code, it was doing some wild tricks with python and grep and other unix tools that I&#8217;d never seen before. So I told it to write tools to do simple kinds of code analysis, to help map out and index the code. [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-5/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 5</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="(max-width: 1280px) 100vw, 1280px" /></p><p class="wp-block-paragraph">Code profiling tools are everything now.</p>



<p class="wp-block-paragraph">When I was staring at Thaura writing code, it was doing some wild tricks with python and grep and other unix tools that I&#8217;d never seen before.</p>



<p class="wp-block-paragraph">So I told it to write tools to do simple kinds of code analysis, to help map out and index the code. I also wrote scoreboard database tools, to keep track of work to do, and work completed. I had it put the code analysis info into the database, too.</p>



<p class="wp-block-paragraph">I also asked it to tell me about all the PHP static analysis tools, and enlisted them all into the programming process: linters, code stylers, static type analysis.</p>



<p class="wp-block-paragraph">The LLM can use these tools the way we use them, to understand the code, and to demonstrate that code conforms to some idea of &#8220;order&#8221;.</p>



<p class="wp-block-paragraph">The LLM also uses them as a kind of debugging aid, or a pre-run tester.</p>



<p class="wp-block-paragraph">I also leaned on Playwright and the old reliable PHPUnit.</p>



<h2 class="wp-block-heading">Illusions of Complete Coverage, and &#8220;AI Psychosis&#8221;</h2>



<p class="wp-block-paragraph">The problem with these code analysis tools is: they don&#8217;t enforce writing good code as much as assist with it. They mainly help when the code is big enough to forget parts of it.</p>



<p class="wp-block-paragraph">They give you the illusion of total control, when you&#8217;re just keeping things together.</p>



<p class="wp-block-paragraph">Likewise, the LLM will appear to be making great, sweeping changes over the code, <em>but touching only a fraction of it</em>, leaving lots of code untouched, and <em>report back with a chat message that it did a lot of work</em>.</p>



<p class="wp-block-paragraph"><strong>The LLM straight up bullshitted the boss!</strong></p>



<p class="wp-block-paragraph">I totally fell for it.</p>



<p class="wp-block-paragraph">The problems would trigger errors and warnings, and then the LLM would look at the errant code, and go fix it, with some chatter about how <strong>it was still doing the old thing</strong>, when it should be doing the <strong>new thing</strong>.</p>



<p class="wp-block-paragraph">Then it was fixed, passed the test, looks good in the analysis tools, and the LLM moved on, and I moved on.</p><p>The post <a href="https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-5/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 5</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 4</title>
		<link>https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-4/</link>
					<comments>https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-4/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 31 Oct 2026 00:31:01 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31246</guid>

					<description><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="(max-width: 1280px) 100vw, 1280px" /></p><p>Continuing the series, more info about altering project internals. I think of this like a caterpillar going into a cocoon, having enzymes totally disintegrate its guts, and then produce a butterfly, which will go out and mate with other butterfiles. It&#8217;s a metamorphosis. Except, with this software, you don&#8217;t see any visible changes once it&#8217;s [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-4/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 4</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p class="wp-block-paragraph">Continuing <a href="https://riceball.com/2026/10/27/thaura-porting-legacy-php5-and-php7-project-to-php8-3/">the series</a>, more info about altering project internals.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph">I think of this like a caterpillar going into a cocoon, having enzymes totally disintegrate its guts, and then produce a butterfly, which will go out and mate with other butterfiles. It&#8217;s a metamorphosis. Except, with this software, you don&#8217;t see any visible changes once it&#8217;s changed.</p>



<p class="wp-block-paragraph">So that&#8217;s not a good analogy.</p>



<p class="wp-block-paragraph">Maybe it&#8217;s more like an electric car, which looks as ugly as the gasoline cars, or even worse, but has completely different insides. It&#8217;s better on the inside.</p>



<p class="wp-block-paragraph">Another bad analogy.</p>



<p class="wp-block-paragraph">It&#8217;s like you shoved a seed into a pile of manure, and it&#8217;s started to grow, but you still can&#8217;t see the plant. It just looks like a pile of shit. But there&#8217;s good stuff in there.</p>



<p class="wp-block-paragraph">Yes, that&#8217;s it.</p>
</blockquote>



<p class="wp-block-paragraph">I&#8217;m going to do another release of software.</p>



<p class="wp-block-paragraph">I&#8217;ll just call it r2 or release 2&#8230;.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Here&#8217;s what happened. It took all day. The reasons were noted in the email I sent out, but the actual delays were as follows:</p>



<p class="wp-block-paragraph">The instructions that the LLM wrote were not easy to understand. In retrospect, I should have just hand-written them.</p>



<p class="wp-block-paragraph">(Then, those notes could have become part of the LLMs knowledge, and could have influenced it to write better documents.)</p>



<p class="wp-block-paragraph">Cloning the database was smooth, but getting the live database container updated to a newer version of MariaDB took extra time.</p>



<p class="wp-block-paragraph">Cloning the release from Git was quick. Moving it into place was quick. (Name the new clone directory blahblah.new, then mv blahblah to blahbla.old, then mv blahblah.new blahblah. Restart Nginx, restart the php container.)</p>



<p class="wp-block-paragraph"><strong>Configuring the Nginx proxy took a LOT of effort, because I did it too soon. The examples the LLM created were wrong, as well, but had enough info that I could make it work</strong>.</p>



<p class="wp-block-paragraph">Reconfiguring the containers to run the app was pretty simple, but I had forgotten that I changed the paths where I wanted the files mounted. This sent me down some rabbitholes related to Nginx config. (I should have held back on changing Nginx.)</p>



<p class="wp-block-paragraph">Overall, it wasn&#8217;t that bad, except for the Nginx configuration.</p>



<h3 class="wp-block-heading">A New, Nonfunctional API</h3>



<p class="wp-block-paragraph">I made an API to feed the mobile app, and it didn&#8217;t work. Digging into the code, was a minor horror. The LLM wrote code well, but the overall &#8220;separation of concerns&#8221; and keeping the code in the right places, wasn&#8217;t so great.</p>



<p class="wp-block-paragraph">I forget what the fix was, but it eventually worked. It was a combination of fixing some obsolete SQL code, and making an Nginx config.</p>



<h2 class="wp-block-heading">PHP Attack Scripts</h2>



<p class="wp-block-paragraph">The PHP security hole drama has led to a bit more attack against the sites, particularly <a href="https://riceball.com/2026/10/29/hackscripts-patterns/">scans for remote shells written in PHP</a>.</p>



<p class="wp-block-paragraph">That just overloads the server, even when the scripts aren&#8217;t there.</p>



<p class="wp-block-paragraph">So I had to do some tricks to detect these requests, and block them. This took a few hours.</p>



<h3 class="wp-block-heading">Get Rid of phpinfo()</h3>



<p class="wp-block-paragraph">If  you&#8217;re running PHP in a container, and use .env to pass passwords into your container, it&#8217;s critical to find and remove all instances of scripts that use the phpinfo() function.</p>



<p class="wp-block-paragraph">That function dumps the environment variables to the page, leaking credentials. This command will recursively find the string &#8220;phpinfo&#8221; in all your files.</p>


<pre class="wp-block-code"><span><code class="hljs">grep -r phpinfo *</code></span></pre>


<h2 class="wp-block-heading">Archives</h2>



<p class="wp-block-paragraph">One of my big goals was to get the site into shape for archving. This entails being able to easily download the entire site, using tools like wget.</p>



<p class="wp-block-paragraph">Generating HTML files as final output is one step toward this goal. While archivers handle .php file endings, they like .html more, and with .html, you can view archives with a plain web browser.</p>



<p class="wp-block-paragraph">With .html files, you can &#8220;archive&#8221; by copying over all the files. You won&#8217;t need all this software to operate the archived site.</p>



<h3 class="wp-block-heading">Indexes</h3>



<p class="wp-block-paragraph">Generating complete indexes to the news articles and events allows webcrawlers to get at everything.</p>



<p class="wp-block-paragraph">This is also a risk, because lots of bots are out there scraping the site, and a complete index will potentially increase their downloading, and risk overloading the site.</p>



<p class="wp-block-paragraph">Page generation helps with this, because serving up a generated HTML page takes a tiny fraction of the resources of running a PHP file. (Example: on an older computer, a very heavy site like WordPress can top out at 30 requests per second, while a similar HTML site can reach into the 10k requests per second.)</p>



<p class="wp-block-paragraph">Bots I&#8217;ve seen scraping the site: Google, Bing, Claude, Baidu, OpenAI, Ahrefs, Yandex.</p>



<h3 class="wp-block-heading">Twig Templates</h3>



<p class="wp-block-paragraph">To this end, instead of trying to change the page generation within the existing code, I had the LLM add Twig. It seemed to know more about Twig than Blade, so I went with Twig.</p>



<p class="wp-block-paragraph">The LLM set up a parallel template structure that copied parts of the existing templates, and then ported the entire site to use it, but didn&#8217;t actually remove all of it, because some of the templates we had were full of PHP code.</p>



<p class="wp-block-paragraph">The Twig templates mixed with the old template system are a mess; they&#8217;re completely enmeshed, to replicate the old site. </p>



<p class="wp-block-paragraph">Eventually, almost the entire site will be generated with Twig.</p>



<p class="wp-block-paragraph">Eventually, this will be replaced with new layouts that aren&#8217;t mixed with the old code.</p>



<p class="wp-block-paragraph">I suspect I&#8217;m going to need to start the process by hand, writing my own templates.</p>



<h3 class="wp-block-heading">Order and Memory Capacity</h3>



<p class="wp-block-paragraph">This did get me thinking about the issue of why we think some code is well organized, and some code is not.</p>



<p class="wp-block-paragraph">Part of it is our limited capacity to comprehend large, complicated systems.</p>



<p class="wp-block-paragraph">To handle big systems, we use structures, like lists, hierarchies, &#8220;black boxing&#8221;, making things modular, and using repetitive patterns.</p>



<p class="wp-block-paragraph">The LLM, unlike people, has a different kind of &#8220;memory&#8221; or &#8220;attention&#8221; or capacity to deal with large amounts of information. So, while the code looks like a mess to me, it still makes sense to the LLM.</p>



<p class="wp-block-paragraph">Here&#8217;s some computer code that vibe coding produced:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Deja-Vu-Mono.ttf" style="font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>function rotated(p){ // rotate cells 90deg clockwise, re-normalize to 0
  const maxX = Math.max(...p.cells.map(c=>c.x));
  const cells = p.cells.map(c=>({x:c.y, y:maxX-c.x, ch:c.ch}));
  const minX = Math.min(...cells.map(c=>c.x)), minY = Math.min(...cells.map(c=>c.y));
  return cells.map(c=>({x:c.x-minX, y:c.y-minY, ch:c.ch}));
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #FF79C6">function</span><span style="color: #F8F8F2"> </span><span style="color: #50FA7B">rotated</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">p</span><span style="color: #F8F8F2">){ </span><span style="color: #6272A4">// rotate cells 90deg clockwise, re-normalize to 0</span></span>
<span class="line"><span style="color: #F8F8F2">  </span><span style="color: #FF79C6">const</span><span style="color: #F8F8F2"> maxX </span><span style="color: #FF79C6">=</span><span style="color: #F8F8F2"> Math.</span><span style="color: #50FA7B">max</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">p.cells.</span><span style="color: #50FA7B">map</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">c</span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2">c.x));</span></span>
<span class="line"><span style="color: #F8F8F2">  </span><span style="color: #FF79C6">const</span><span style="color: #F8F8F2"> cells </span><span style="color: #FF79C6">=</span><span style="color: #F8F8F2"> p.cells.</span><span style="color: #50FA7B">map</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">c</span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2">({x</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2">c.y, y</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2">maxX</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">c.x, ch</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2">c.ch}));</span></span>
<span class="line"><span style="color: #F8F8F2">  </span><span style="color: #FF79C6">const</span><span style="color: #F8F8F2"> minX </span><span style="color: #FF79C6">=</span><span style="color: #F8F8F2"> Math.</span><span style="color: #50FA7B">min</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">cells.</span><span style="color: #50FA7B">map</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">c</span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2">c.x)), minY </span><span style="color: #FF79C6">=</span><span style="color: #F8F8F2"> Math.</span><span style="color: #50FA7B">min</span><span style="color: #F8F8F2">(</span><span style="color: #FF79C6">...</span><span style="color: #F8F8F2">cells.</span><span style="color: #50FA7B">map</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">c</span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2">c.y));</span></span>
<span class="line"><span style="color: #F8F8F2">  </span><span style="color: #FF79C6">return</span><span style="color: #F8F8F2"> cells.</span><span style="color: #50FA7B">map</span><span style="color: #F8F8F2">(</span><span style="color: #FFB86C; font-style: italic">c</span><span style="color: #FF79C6">=&gt;</span><span style="color: #F8F8F2">({x</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2">c.x</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">minX, y</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2">c.y</span><span style="color: #FF79C6">-</span><span style="color: #F8F8F2">minY, ch</span><span style="color: #FF79C6">:</span><span style="color: #F8F8F2">c.ch}));</span></span>
<span class="line"><span style="color: #F8F8F2">}</span></span></code></pre></div>



<p class="wp-block-paragraph">Almost any programmer has written code like that, but how many enjoy <em>reading</em> code like that.</p>



<p class="wp-block-paragraph">Conversely, computer code is extremely brittle. A single character out of place, and parts may break. The LLM can write code, but more importantly, it can transform vague instructions and turn them into concrete goals, like people can. So it&#8217;s like a programming language that&#8217;s a human language.</p>



<p class="wp-block-paragraph">The challenge is to get the LLM to conform to (the declining) human need to keep code organized, for human comprehension.</p><p>The post <a href="https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-4/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 4</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/10/30/thaura-porting-legacy-php5-and-php7-project-to-php8-part-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 3</title>
		<link>https://riceball.com/2026/10/27/thaura-porting-legacy-php5-and-php7-project-to-php8-3/</link>
					<comments>https://riceball.com/2026/10/27/thaura-porting-legacy-php5-and-php7-project-to-php8-3/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 28 Oct 2026 04:12:07 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31239</guid>

					<description><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p>Continuing the series, more info about altering project internals. I got so tired that I stopped blogging. A note to myself read: The main big issues I&#8217;ve hit this time are refactoring introducing bugs bug repairs introducing bugs incomplete testing of outputs database export and import problems. Refactoring Introducing Bugs Initially, I wasn&#8217;t that aggressive [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/10/27/thaura-porting-legacy-php5-and-php7-project-to-php8-3/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 3</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p class="wp-block-paragraph">Continuing <a href="https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/">the series</a>, more info about altering project internals.</p>



<p class="wp-block-paragraph">I got so tired that I stopped blogging. A note to myself read:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph">The main big issues I&#8217;ve hit this time are refactoring introducing bugs bug repairs introducing bugs incomplete testing of outputs database export and import problems.</p>
</blockquote>



<h2 class="wp-block-heading">Refactoring Introducing Bugs</h2>



<p class="wp-block-paragraph">Initially, I wasn&#8217;t that aggressive about testing. I just used URLs and GET to test a list of pages, and told the bot to read the logs. It would find errors and warnings, and fix them.</p>



<p class="wp-block-paragraph">Then, I got hit with a bunch of uncaught bugs.</p>



<p class="wp-block-paragraph">One of them was a bug that I knew we corrected before.</p>



<p class="wp-block-paragraph">So I decided that whenever I found a bug, I wanted a test generated that would prevent that bug from reappearing.</p>



<p class="wp-block-paragraph">I&#8217;m guessing that a bug reappeared because the code was being <a href="https://en.wikipedia.org/wiki/Code_refactoring" target="_blank" rel="noopener">refactored</a>.</p>



<p class="wp-block-paragraph">Refactoring is basically building a new code structure, and then copying your old code into it. When it copied the code, it wrote the bug back into existence.</p>



<h2 class="wp-block-heading">Bug Fixing Revealing Bugs or Introducing Bugs</h2>



<p class="wp-block-paragraph">This isn&#8217;t an LLM issue per-se, but in dynamic languages, fixing a bug might reveal other bugs that, until then, were not found, because the first bug killed the program.</p>



<p class="wp-block-paragraph">An automated test case helps with these.</p>



<h2 class="wp-block-heading">Incomplete Testing of Outputs</h2>



<p class="wp-block-paragraph">I wish I could remember the situation, but Thaura did a big batch of changes, but it wasn&#8217;t testing the output. It just did the modifications.</p>



<p class="wp-block-paragraph">Some early modifications had automated tests, and it used those to fine tune it&#8217;s behavior, but then, it just abandoned testing.</p>



<p class="wp-block-paragraph">It seemed to be working so fast, so I asked if it was checking outputs. It wasn&#8217;t.</p>



<p class="wp-block-paragraph">So, it&#8217;s good to ask the bot what it did. You can read it, and determine if the bot failed to do something. You can find tune its behavior.</p>



<h2 class="wp-block-heading">Database Import and Export Problems</h2>



<p class="wp-block-paragraph">Initially, I tried to do <strong>a mysqldump from MySQL 5.7 and load it into MariaDB 11</strong>. It didn&#8217;t work, but I expected that. Not only that, but the data needed a lot of manual cleanup.</p>



<p class="wp-block-paragraph">So I used an intermediate format, JSON, to dump the data, and load it in. That worked extremely well.</p>



<p class="wp-block-paragraph">Then, I thought I could dump from the dev database and load it into the production database, like this:</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="342" height="509" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-27-21-01-14.png?wsr" alt="" class="wp-image-31242" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-27-21-01-14.png 342w, https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-27-21-01-14-202x300.png 202w" sizes="auto, (max-width: 342px) 100vw, 342px" /></figure>



<p class="wp-block-paragraph">No such luck. </p>



<p class="wp-block-paragraph">They were both MariaDB 11, and the same point version, but different releases, and in slightly different operating systems (Alpine Linux vs. whatever MariaDB&#8217;s Docker package uses).</p>



<p class="wp-block-paragraph">So I had Thaura write a filter to allow the dump to work, mainly by stripping some comments, like this:</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="386" height="647" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-27-21-04-59.png?wsr" alt="" class="wp-image-31243" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-27-21-04-59.png 386w, https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-27-21-04-59-179x300.png 179w" sizes="auto, (max-width: 386px) 100vw, 386px" /></figure>



<p class="wp-block-paragraph">(Claude screwed up the diagram. The first dump is a MySQL dump.)</p>



<p class="wp-block-paragraph">Obviously, I should have focused on defining an intermediate data dump format that would work for us.</p>



<p class="wp-block-paragraph">This isn&#8217;t a PHP porting issue, but it could come up.</p><p>The post <a href="https://riceball.com/2026/10/27/thaura-porting-legacy-php5-and-php7-project-to-php8-3/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 3</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/10/27/thaura-porting-legacy-php5-and-php7-project-to-php8-3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 2</title>
		<link>https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/</link>
					<comments>https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 24 Oct 2026 03:39:22 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31223</guid>

					<description><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p>Last time it was about updating code. Now it&#8217;s about altering project internals. Mid-Project Legacy A long time ago, I decided that the old style include(&#8216;foo_class.inc&#8217;) was annoying, and the new style autoloader classes with use \Foo; were nicer. So I did a simple thing: copy them all into a namespace, and then convert them [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 2</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p class="wp-block-paragraph">Last time it was about <a href="https://riceball.com/2026/10/22/thaura-porting-legacy-php5-and-php7-project-to-php8/">updating code</a>. Now it&#8217;s about altering project internals.</p>



<h2 class="wp-block-heading">Mid-Project Legacy</h2>



<p class="wp-block-paragraph">A long time ago, I decided that the old style include(&#8216;foo_class.inc&#8217;) was annoying, and the new style autoloader classes with use \Foo; were nicer.</p>



<p class="wp-block-paragraph">So I did a simple thing: copy them all into a namespace, and then convert them to PSR-4 compatible classes (aka, autoloading classes).</p>



<p class="wp-block-paragraph">I left the old files around, just in case they were still being used. The project never completed, and maybe around 10 classes were converted, and many were not.</p>



<p class="wp-block-paragraph">I told the LLM to fix this, and make everything into a PSR-4 compatible class. It decided which version was good, and which was not and possible merges.</p>



<p class="wp-block-paragraph">This is mind-blowing to me, that the program can do this.</p>



<p class="wp-block-paragraph">The process took a day, due to pauses and usage limits, and I&#8217;m still not sure it&#8217;s OK.</p>



<p class="wp-block-paragraph">The goal here was to allow static code checking tools like Psalm to do better code analysis.</p>



<h3 class="wp-block-heading">So far, no real new code</h3>



<p class="wp-block-paragraph">I&#8217;m just writing this to make a weird point: I haven&#8217;t asked the LLM to write new code. It&#8217;s refactoring.</p>



<p class="wp-block-paragraph">It&#8217;s making old code conform to newer programming standards.</p>



<p class="wp-block-paragraph">It&#8217;s removing code, too.</p>



<h3 class="wp-block-heading">Some Removals</h3>



<p class="wp-block-paragraph"><strong>Reporting bad posts</strong> &#8211; a system similar to Digg, where the community can moderate. It stopped being useful when people gamed it or it didn&#8217;t instantly mod someone down.</p>



<p class="wp-block-paragraph"><strong>Spam trapping</strong> &#8211; I had a bunch of filters, some quite nice, but it was out of date.</p>



<p class="wp-block-paragraph"><strong>IP logging and redirecting</strong> &#8211; this is still important, but the site&#8217;s implementation was pretty annoying, so it goes.</p>



<p class="wp-block-paragraph"><strong>DIY captcha</strong> &#8211; I wrote it because there weren&#8217;t many options I liked. Now, it&#8217;s not that relevant because there are packages for captchas.</p>



<p class="wp-block-paragraph"><strong>Themes</strong> &#8211; again, not super popular, and it was done in a annoying way, with GET parameters.</p>



<p class="wp-block-paragraph">These removals aren&#8217;t all because the feature was bad, but it was just out of date, or should be replaced. Removing them helped reduce the code size.</p>



<h2 class="wp-block-heading">Improving Debugging</h2>



<p class="wp-block-paragraph">After telling Thaura to do something a certain way, over and over, it starts to do it, automatically, and even expand on it.</p>



<p class="wp-block-paragraph">I told it to use the static analysis and dependency databases a couple times, and it figured out how to use them.</p>



<p class="wp-block-paragraph">I told it to always do static analysis and check dependencies, and it would do both, with the tools, and on its own.</p>



<p class="wp-block-paragraph">So every change is checked with these tools, and also with the Playwright integration tests against some URLs. These can trigger warnings in the logs, so I have it read the logs and debug error and warning messages.</p><p>The post <a href="https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 2</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 1</title>
		<link>https://riceball.com/2026/10/22/thaura-porting-legacy-php5-and-php7-project-to-php8/</link>
					<comments>https://riceball.com/2026/10/22/thaura-porting-legacy-php5-and-php7-project-to-php8/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 22:21:35 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=31203</guid>

					<description><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p>This document describes how I&#8217;m porting a legacy PHP codebase to PHP8.5. The security crisis of October 2026 required porting everything on a legacy website to PHP8, the only version that&#8217;s getting updated now. This document is in flux and will change as the port progresses. The legacy code was running on two containers, behind [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/10/22/thaura-porting-legacy-php5-and-php7-project-to-php8/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 1</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img width="1280" height="1280" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1.jpg 1280w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-300x300.jpg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-1024x1024.jpg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-150x150.jpg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/10/malignant-internet-commenters-abusing-each-other-i1-768x768.jpg 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></p><p class="wp-block-paragraph">This document describes how I&#8217;m porting a legacy PHP codebase to PHP8.5. The security crisis of October 2026 required porting everything on a legacy website to PHP8, the only version that&#8217;s getting updated now. This document is in flux and will change as the port progresses.</p>



<p class="wp-block-paragraph">The legacy code was running on two containers, behind a nginx reverse proxy, that directed most of the traffic to he PHP7 version of the code, but ran some very old code in PHP5.</p>



<p class="wp-block-paragraph">The goal was to port code to PHP8, and implement a new app stack that&#8217;s nginx + php-fpm + php8.5.</p>



<p class="wp-block-paragraph">The TL;DR:</p>



<ul class="wp-block-list">
<li>Lean on code linters first.</li>



<li>Create infrastructure to organize the process of fixing individual files, to get them to compile. Don&#8217;t bother to fix the logic at this time.</li>



<li>Tell the LLM to log changes.</li>



<li>Build up the new codebase from the old (the LLM made this decision), linting the old PHP7 code mostly.</li>



<li>Build up the new deployment environment by using the old config files.</li>
</ul>



<p class="wp-block-paragraph">The general progression of the work:</p>



<ol class="wp-block-list">
<li>Download all the old code into a project.
<ol class="wp-block-list">
<li>Make a git repo, and add lines to README to use it. (Helps the LLM undo things and see history.)</li>



<li>Include relevant config files. (Teaches context. LLM should know all the parts, rather than assume anything.)</li>



<li>Create careful database dumps, by table rather than the entire db. I had an old archiving tool for this, and used it. Download into repo.</li>



<li>Write notes about the current architecture, project folder layout, db version.</li>



<li>Tell the LLM to log changes to a changelog.</li>
</ol>
</li>



<li>Update the code so it compiles.
<ol class="wp-block-list">
<li>Use static code linters, stylers, deprecated code scanners, etc. to test the code. (Do not rely on the LLM&#8217;s reasoning. Ask it to recommend tools, and install them. Then, you need to configure them to work with your file layout, include paths, etc.)</li>



<li>Let the LLM plan and make the code changes.</li>



<li>Let the LLM guess about which files, and which versions, would need to be ported.</li>



<li>The LLM had trouble running a batch script to do the tool calls, so I told it to make another batcher script to run the script over around 20 files. The LLM tells me to run it when it&#8217;s changed.</li>



<li>Made mid-project decision to use a SQLite scoreboard to track the state of each file. Updated scripts to update the scoreboard. This makes the batching partially obsolete.</li>
</ol>
</li>



<li>Make a Docker dev environment similar to the deployment goal. Use this to do the runtime integration tests.
<ol class="wp-block-list">
<li>Playwright for integration testing.</li>



<li>PHPUnit or similar for unit or function testing.</li>
</ol>
</li>
</ol>



<h2 class="wp-block-heading">The llm</h2>



<p class="wp-block-paragraph">I&#8217;m using Thaura Pro. The pro is that it&#8217;s pretty cheap at $15 a month. The problem is that you can use it only 5 hours at a time, and then you have to take a break. I really don&#8217;t mind this.</p>



<p class="wp-block-paragraph">The tool execution limit will trigger every 15 minutes or so, and require a button click.</p>



<h2 class="wp-block-heading">Static Checkers</h2>



<p class="wp-block-paragraph">Linters and static code checkers run on the desktop computer to produce reports about code problems. <strong>These help you analyze lots of code without burning tokens (or dealing with the indeterminacy of LLMs</strong>).</p>



<p class="wp-block-paragraph">The LLM should write the config files for these tools, so it can adjust them as it runs.</p>



<p class="wp-block-paragraph">I started with report text files, and a batch file to produce them, but eventually added a sqlite based scoreboard to track work progress. The linting can happen in parallel with the LLM coding.</p>



<p class="wp-block-paragraph">Coding is &#8220;slow&#8221;, at maybe 1 minute per file. That&#8217;s many multiples of how fast I code, but there is still some waiting. The LLM works in batches of 5-10 files.</p>



<p class="wp-block-paragraph">A batch checker script, over time, became a kind of scratchpad for the next 10 to 20 files to test. Due to a security issue, I had to run this manually.</p>



<p class="wp-block-paragraph">What&#8217;s nice about the scoreboard and the report.txt sidecars is that I can work in parallel with the LLM. I just write tools (by hand, or by LLM), use other LLMs to set up Docker, edit the README and other notes.</p>



<p class="wp-block-paragraph">Even this static analysis phase is full of constant changes and improvements.</p>



<h2 class="wp-block-heading">The Port Environment</h2>



<p class="wp-block-paragraph">The initial environment is a directory that looks like this:</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">src/
     db/ -- legacy data
     apache/ -- legacy config
     nginx/ -- legacy config
     php5/ -- legacy code
     php7/ -- legacy code
     php8/ -- ported code, goes into git repo
         sitename/ -- not the actual sitename
             local/ -- caches and local code
             public/ -- website root
             shared/ -- project-wide code libraries
bin/ -- scripts and tools to help <span class="hljs-keyword">with</span> coding, goes <span class="hljs-keyword">in</span> repo
docker/ -- configs and tools <span class="hljs-keyword">for</span> docker containers, goes <span class="hljs-keyword">in</span> repo
legacy-data/ -- not the actual name, but things like generated files, temp files, uploads, were downloaded into here, <span class="hljs-keyword">as</span> samples. The entire site was not copied.
</code></span></pre>


<p class="wp-block-paragraph">The main tools (at thist time) are syntax checkers, linters, like &#8216;php -l&#8217;, phpstan, psalm, phpcs. Helper scripts run the tools, load configs, query the scoreboard, etc.</p>



<p class="wp-block-paragraph">Thaura can also run these tools individually.</p>



<p class="wp-block-paragraph">Changes are logged in these places: CHANGELOG.txt, somescript.php.report.txt sidecars that record the output of the syntax checkers (so the LLM doesn&#8217;t need to run them individually), the git commits, and I write some changes into README.txt and then tell Thaura to read it. I think Thara also keeps a todo file on its server.</p>



<p class="wp-block-paragraph">Legacy configs help a lot, explaining how the actual live app works. Porting proceeds breadth-first, and based on what&#8217;s exposed through these configs, particularly the nginx reverse proxy, which forwards traffic to two different PHP containers, depending on the URI.</p>



<p class="wp-block-paragraph">The new config is much simpler, because it&#8217;s a single codebase. The old configs help the port avoid porting stray PHP files here and there, by identifying what is exposed to the world.</p>



<p class="wp-block-paragraph">Early on, the LLM is just guessing which files are dependencies. This will come out in the wash and rinse as the code is executed.</p>



<h2 class="wp-block-heading">Code Fixing</h2>



<p class="wp-block-paragraph">The first goal was to get all the code compiling. I didn&#8217;t care if it had some warnings, and <strong>I didn&#8217;t care if it even ran correctly</strong>.</p>



<p class="wp-block-paragraph">This took over a day, but eventually finished.</p>



<p class="wp-block-paragraph">Initially, I thought the next step would be to write tests, like TDD, but, instead, the LLM was going into actual debugging, so I went along.</p>



<p class="wp-block-paragraph">This is almost like the opposite of TDD, and more like interactive programming with an interpreter.</p>



<p class="wp-block-paragraph">I&#8217;d give it a URL, and tell it to fix it, by figuring out which files get loaded, and checking the work from the URL down to the libraries. It required checking dependencies.</p>



<h3 class="wp-block-heading">Tests</h3>



<p class="wp-block-paragraph">So I did around 10 or 15 of these debugging excursions, and it got better at it over time.</p>



<p class="wp-block-paragraph">Next, I told it to create Playwright tests for a bunch of the URLs, and some new ones.</p>



<p class="wp-block-paragraph">More on this later.</p>



<h2 class="wp-block-heading">Database Tables</h2>



<p class="wp-block-paragraph">During debugging, it would sometimes hit missing database tables. This could cause the LLM to go on a pointless debugging excursion, or try to recreate the table.</p>



<p class="wp-block-paragraph">I&#8217;d have to stop it, ssh into the server, alter the table dumping script, exit ssh, and then do an rsync to copy the new table dumps.</p>



<p class="wp-block-paragraph">The LLM created a couple utilities to upload the tables into the local DB.</p>



<h3 class="wp-block-heading">MySQL 5.7 to MariaDB Migration</h3>



<p class="wp-block-paragraph">Initially, I thought it would work to use the db dumps to load MariaDB. It seemed like some python scripts could fix them up, since they use roughly the same SQL.</p>



<p class="wp-block-paragraph">I hadn&#8217;t thought about the long term nightmare of migrating from latin1 to utf8, which the site underwent over many years. By and large, the data was ASCII or UTF-8, but many columns were typed as latin1.</p>



<p class="wp-block-paragraph">So, instead, the LLM offered to fix some of the bad data, and I asked for tools to dump the data to JSON, and load the data from JSON.</p>



<p class="wp-block-paragraph">The new tables and columns will, eventually, be utf8mb4, or whatever is best for the near future.</p>



<p class="wp-block-paragraph">The data repair was pretty amazing. It didn&#8217;t just fix our internal migration mistakes &#8211; it also fixed dirty user input.</p>



<p class="wp-block-paragraph">I could tell it had the accumulated experience of decades of annoyances people had when migrating to Unicode and UTF8.</p>



<h2 class="wp-block-heading">Testing URLs</h2>



<p class="wp-block-paragraph">The LLM seemed to be really good at figuring out how a URL maps to a PHP file, and all the PHP files that get involved in producing that URL.</p>



<p class="wp-block-paragraph">I also taught it how to go into the /admin/ area, with a username and password, and run the page generation code.</p>



<p class="wp-block-paragraph">The code wasn&#8217;t really working, so during this &#8220;training&#8221;, it was also looking at the code and fixing it until it worked. Mostly, it was configuration issues.</p>



<p class="wp-block-paragraph">So, now, I could tell it to fix something that involved page generation, and it could &#8220;drive&#8221; the site to regenerate the page during its debugging.</p>



<p class="wp-block-paragraph">I settled into using this prompt pattern:</p>


<pre class="wp-block-code"><span><code class="hljs">/path/to/url.php -- this page does this, but it's not doing it correctly. Debug it.
</code></span></pre>


<p class="wp-block-paragraph">I repeated this for all the parts of the admin, including the parts I was hoping to remove.</p>



<p class="wp-block-paragraph">Then I repeated it for world-facing pages.</p>



<p class="wp-block-paragraph">I didn&#8217;t test if the site could upload files, etc. When I was creating the Playwright tests, it went ahead and wrote tests to do some of that.</p>



<p class="wp-block-paragraph">So, with this interactive debugging, I suspect I primed the LLM to know how to make the Playwright tests.</p>



<h2 class="wp-block-heading">Simplification by Replacing Variables with Constants</h2>



<p class="wp-block-paragraph">The site had two config files, and many of the configs were global variables.</p>



<p class="wp-block-paragraph">Most of these were used like constants. They never changed.</p>



<p class="wp-block-paragraph">So I told two LLMS to go, one by one, and replace the variable with a constant, if the variable wasn&#8217;t ever assigned a value elsewhere in the code.</p>



<p class="wp-block-paragraph">Every variable is a potential decision point: an if statement, or switch statement, or concatenation in a string that&#8217;s a file path, etc.</p>



<p class="wp-block-paragraph">Replacing variables with constants, when possible, should make debugging easier.</p>



<p class="wp-block-paragraph">To test it, I used the big test suite in playwright, and told the LLM to run each test individually, and read the logs, fixing any errors or warnings.</p>



<h2 class="wp-block-heading">Enabling Xdebug</h2>



<p class="wp-block-paragraph">I should have done this from the start, but better late than never. I had it produce dumps about what functions got called, and it also allows the LLM to do debugging.</p>



<h2 class="wp-block-heading">Scoreboards and Dependencies</h2>



<p class="wp-block-paragraph">I had it create a scoreboard system to see how the code porting and conversion were progressing &#8212; the pass/fail status was determined by running static checkers on the code.</p>



<p class="wp-block-paragraph">Then I created commands to query the scoreboard.</p>



<p class="wp-block-paragraph">It eventually seemed to use it a little bit. I think doing the scoreboard from the start, could have helped, but, if anything, I got more use out of it than the LLM.</p>



<p class="wp-block-paragraph">I also had it create a database of dependencies, of what files get included (and what files include a given file).</p>



<p class="wp-block-paragraph">Tools for OOP in PHP will produce this info, but this codebase is mostly PHP4 style require() and include() based.</p>



<p class="wp-block-paragraph">Again, I don&#8217;t know if the LLM used it, but it would have helped debugging go faster.</p>



<p class="wp-block-paragraph">This is all debugging infrastructure, ultimately, and it&#8217;s good not only for the LLM but for the programmer as well.</p>



<h2 class="wp-block-heading">Removing Features</h2>



<p class="wp-block-paragraph">The old software had a bunch of features that nobody seems to use anymore.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-Deja-Vu-Mono.ttf" style="font-size:.875rem;font-family:Code-Pro-Deja-Vu-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>going forward, i want to do a commit before, and a dev release after, a site feature is removed, so it's easy to go back and undo a bad batch of work. for example, for this round, I'd like to remove code related to themes, theme.php and anything related to it, like CSS files, any gui related to the theme, and logic to switch the theme. Only the default theme should be left. analyze the code, plan the removal, and then remove, and test. then, remove any playwright tests for themes. when it's all good, do a dev release.</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F8F8F2">going forward, i want to do a commit before, and a dev release after, a site feature is removed, so it&#39;s easy to go back and undo a bad batch of work. for example, for this round, I&#39;d like to remove code related to themes, theme.php and anything related to it, like CSS files, any gui related to the theme, and logic to switch the theme. Only the default theme should be left. analyze the code, plan the removal, and then remove, and test. then, remove any playwright tests for themes. when it&#39;s all good, do a dev release.</span></span></code></pre></div>



<p class="wp-block-paragraph">I know the codebase pretty well, so I knew this was a pretty simple change.</p>



<p class="wp-block-paragraph">Removing features removes files, and removing files reduces the amount of context required to edit the code.</p>



<p class="wp-block-paragraph">Code that would use the theme variable was also rewritten to simply use the default theme.</p>



<p class="wp-block-paragraph">(My plan is to re-add features by using external libraries when appropriate.)</p>



<p class="wp-block-paragraph"><a href="https://riceball.com/2026/10/23/thaura-porting-legacy-php5-and-php7-project-to-php8-2/">Continued in part 2</a>.</p><p>The post <a href="https://riceball.com/2026/10/22/thaura-porting-legacy-php5-and-php7-project-to-php8/">Thaura: Porting Legacy PHP5 and PHP7 Project to PHP8 Part 1</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/10/22/thaura-porting-legacy-php5-and-php7-project-to-php8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Thaura &#038; WordPress: layout advice chatbot</title>
		<link>https://riceball.com/2026/10/08/thaura-wordpress-layout-advice-chatbot/</link>
					<comments>https://riceball.com/2026/10/08/thaura-wordpress-layout-advice-chatbot/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 09 Oct 2026 03:55:48 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Prompts]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=30722</guid>

					<description><![CDATA[<p><img width="1024" height="1024" src="https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10.jpeg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10.jpeg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10-300x300.jpeg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10-150x150.jpeg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10-768x768.jpeg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></p><p>This bot gives advice about how to make layouts in WordPress using the stock tools and features. More on this later, on to the Thaura Projects settings. Thaura Projects is a feature to allow you to create chatbots (and other interactive tools). To create a new Project, click on Project in the navigation, and then [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/10/08/thaura-wordpress-layout-advice-chatbot/">Thaura & WordPress: layout advice chatbot</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><img width="1024" height="1024" src="https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10.jpeg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10.jpeg 1024w, https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10-300x300.jpeg 300w, https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10-150x150.jpeg 150w, https://riceball.com/wp-content/uploads/sites/2/2026/09/57745157-b626-4bd6-b87d-186358473f10-768x768.jpeg 768w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></p><p class="wp-block-paragraph">This bot gives advice about how to make layouts in WordPress using the stock tools and features. More on this later, on to the Thaura Projects settings.</p>



<p class="wp-block-paragraph">Thaura Projects is a feature to allow you to create chatbots (and other interactive tools).</p>



<p class="wp-block-paragraph">To create a new Project, click on Project in the navigation, and then &#8220;+&#8221; in the upper right corner.</p>



<p class="wp-block-paragraph">Fill in the form with:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td>Title</td><td>WordPress Gutenberg Advice Bot</td></tr><tr><td>Description</td><td>A chatbot that advises how to produce what you want, using the features of the stock wordpress blocks, and the Site Editor features. If it seems difficult to do, then say so.</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Then save it, and go to the Project. In the upper right, click the triple-dot menu and Edit.</p>



<p class="wp-block-paragraph">Add:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td>Project Instructions</td><td>If stuck, review the Core Blocks reference <a href="https://developer.wordpress.org/block-editor/reference-guides/core-blocks/" target="_blank" rel="noopener">https://developer.wordpress.org/block-editor/reference-guides/core-blocks/</a><br>If there&#8217;s no obvious solution read <a href="https://developer.wordpress.org/themes/" target="_blank" rel="noopener">https://developer.wordpress.org/themes/</a> for possible solutions.</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">This is a screenshot of the dialog box where you paste in the prompts.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="461" height="561" src="https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-08-21-08-40.png?wsr" alt="" class="wp-image-30726" srcset="https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-08-21-08-40.png 461w, https://riceball.com/wp-content/uploads/sites/2/2026/10/Screenshot-from-2026-10-08-21-08-40-247x300.png 247w" sizes="auto, (max-width: 461px) 100vw, 461px" /></figure><p>The post <a href="https://riceball.com/2026/10/08/thaura-wordpress-layout-advice-chatbot/">Thaura & WordPress: layout advice chatbot</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/10/08/thaura-wordpress-layout-advice-chatbot/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Adapting Traditional OOP Style to the LLM World</title>
		<link>https://riceball.com/2026/09/29/adapting-traditional-oop-style-to-the-llm-world/</link>
					<comments>https://riceball.com/2026/09/29/adapting-traditional-oop-style-to-the-llm-world/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 30 Sep 2026 02:45:29 +0000</pubDate>
				<category><![CDATA[Human Learning]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Thaura]]></category>
		<guid isPermaLink="false">https://riceball.com/?p=30654</guid>

					<description><![CDATA[<p>(Another Thaura Work product. Again, haven&#8217;t checked, but lots of good ideas in here.) New ways to use old structures to help LLMs write better code. Techniques to reduce token use, reduce context size, reduce errors. Adapting Traditional OOP Style Classic object-oriented design — inheritance hierarchies, polymorphic dispatch, encapsulated state — predates LLMs by decades. [&#8230;]</p>
<p>The post <a href="https://riceball.com/2026/09/29/adapting-traditional-oop-style-to-the-llm-world/">Adapting Traditional OOP Style to the LLM World</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">(Another Thaura Work product. Again, haven&#8217;t checked, but lots of good ideas in here.)</p>



<p class="wp-block-paragraph">New ways to use old structures to help LLMs write better code. Techniques to reduce token use, reduce context size, reduce errors.</p>



<h2 class="wp-block-heading">Adapting Traditional OOP Style</h2>



<p class="wp-block-paragraph">Classic object-oriented design — inheritance hierarchies, polymorphic dispatch, encapsulated state — predates LLMs by decades. Much of what made OOP ergonomic for humans (deep class trees, implicit constructor injection, framework-managed lifecycles) introduces exactly the kind of <em>implicit decisions</em> that hurt one-shot generation. The good news: you can keep the spirit of OOP while stripping out the parts that confuse a model.</p>



<h3 class="wp-block-heading">Inheritance → Composition + Interfaces</h3>



<p class="wp-block-paragraph">Deep <code>extends</code> chains force the model to track overridden methods across multiple files, guess which superclass field is shadowing which, and infer initialization order. Adaptation:</p>



<ul class="wp-block-list">
<li><strong>Prefer interfaces / traits / protocols over base classes.</strong> A flat <code>interface PaymentProcessor { process(order: Order): Result }</code> gives the model a complete contract in one place. No diamond problems, no super-call ordering to reason about.</li>



<li><strong>Use composition for shared behavior.</strong> Mixins, embedded structs, or trait implementations (<code>impl Display for MyType</code>) are self-contained blocks the model can generate without knowing the rest of the hierarchy.</li>



<li><strong>If you must inherit, keep depth ≤ 2.</strong> One concrete base + one leaf is manageable; three levels with abstract intermediates start to exceed what the model tracks reliably in a single pass.</li>
</ul>



<h3 class="wp-block-heading">Encapsulation → Explicit Data Structures</h3>



<p class="wp-block-paragraph">Private fields with getters/setters hide data flow behind method calls the model must predict. Adaptation:</p>



<ul class="wp-block-list">
<li><strong>Expose plain data structures</strong> (structs, records, frozen objects) at boundaries. The model sees the shape directly instead of inferring it from accessor pairs.</li>



<li><strong>Reserve methods for behavior</strong>, not for field access. If a &#8220;method&#8221; just returns a field, make the field public (or readonly) and delete the getter. Fewer indirection layers means fewer places the model can invent a nonexistent accessor.</li>



<li><strong>Make mutability intentional and visible.</strong> A struct with all-public fields communicates &#8220;data container.&#8221; A class with private state and mutating methods signals &#8220;behavior owner.&#8221; Mixing both in one type forces the model to guess the invariant.</li>
</ul>



<h3 class="wp-block-heading">Polymorphism → Tagged Unions + Pattern Matching</h3>



<p class="wp-block-paragraph">Runtime dynamic dispatch (<code>obj.handle()</code> where the actual type depends on construction site) requires the model to enumerate every possible subclass. Adaptation:</p>



<ul class="wp-block-list">
<li><strong>Replace runtime polymorphism with sum types + exhaustive match</strong> wherever the set of cases is closed. <code>enum Shape { Circle(f64), Rect(f64, f64) }</code> matched in one function is unambiguous; a <code>Shape</code> interface with ten subclasses scattered across modules is not.</li>



<li><strong>For open-ended extensibility</strong> (plugin systems, event handlers), use an explicit registry or visitor pattern rather than relying on the model to discover all overrides. The registry is a single lookup table the model can read.</li>



<li><strong>Sealed hierarchies beat open ones.</strong> If the compiler enforces exhaustiveness (Kotlin <code>sealed</code>, Scala sealed, TypeScript discriminated unions), the model knows the case list is complete. Open hierarchies invite phantom branches.</li>
</ul>



<h3 class="wp-block-heading">Dependency Injection → Explicit Constructor Parameters</h3>



<p class="wp-block-paragraph">Frameworks that inject dependencies via annotations, reflection, or container magic hide the dependency graph. The model can&#8217;t see what a class actually needs until it reads the DI configuration. Adaptation:</p>



<ul class="wp-block-list">
<li><strong>Pass dependencies through constructors explicitly.</strong> <code>fn new(db: &amp;Pool, cache: &amp;Cache)</code> is visible at the call site. <code>@Inject</code> annotations require reading a separate wiring file the model may not have in context.</li>



<li><strong>Keep constructor arity low (≤ 4).</strong> Beyond that, bundle related deps into a config/options struct. Long parameter lists are where models drop arguments or swap types.</li>



<li><strong>Avoid builder-pattern fluency for core types.</strong> Fluent builders (<code>new Widget().red().big().build()</code>) scatter construction logic across chained calls. A single constructor call with a struct literal is easier to generate correctly.</li>
</ul>



<h3 class="wp-block-heading">Framework Magic → Plain Entry Points</h3>



<p class="wp-block-paragraph">Spring beans, Rails controllers, Angular decorators, and similar frameworks interpose lifecycle hooks, serialization, and routing logic between your code and its observable behavior. Adaptation:</p>



<ul class="wp-block-list">
<li><strong>Isolate framework glue in thin adapters.</strong> Keep business logic in plain functions/classes with no framework annotations. The adapter translates HTTP request → function call → response. The model generates the interesting part (logic) without needing to satisfy framework constraints simultaneously.</li>



<li><strong>Prefer functional entry points for pure computation.</strong> A controller that calls <code>calculate_total(items, discount_code)</code> is testable and generatable independently of the web framework. Embedding that calculation inside a decorated class method couples two concerns the model must get right at once.</li>



<li><strong>Document the framework contract in the prompt if unavoidable.</strong> If the target code must be a Spring <code>@Service</code> or a React component, include one minimal working example in the prompt. One concrete exemplar reduces hallucination more than any amount of prose description.</li>
</ul>



<h3 class="wp-block-heading">State Machines → Enum-Driven Flows</h3>



<p class="wp-block-paragraph">Implicit state held in boolean flags (<code>isLoading</code>, <code>hasError</code>, <code>isSubmitted</code>) creates combinatorial explosion the model struggles to navigate. Adaptation:</p>



<ul class="wp-block-list">
<li><strong>Model explicit states as enums.</strong> <code>enum CheckoutState { Idle, FillingCart, ValidatingPayment, Processing, Complete(Error?) }</code> makes invalid transitions impossible and gives the model a finite, named space to work in.</li>



<li><strong>Transition functions take <code>(state, event) → new_state</code>.</strong> Pure transition functions are trivially verifiable and easy to generate. Mutating a stateful object&#8217;s internal booleans is not.</li>



<li><strong>Guard clauses over nested conditionals.</strong> <code>match state { Idle => ..., Processing => ... }</code> beats four levels of <code>if (flag1 &amp;&amp; !flag2 || flag3)</code> that the model must untangle.</li>
</ul>



<h3 class="wp-block-heading">Summary Checklist</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Classic OOP habit</th><th>LLM-friendly adaptation</th><th>Why it helps</th></tr></thead><tbody><tr><td>Deep inheritance tree</td><td>Interface + composition, depth ≤ 2</td><td>Flat contracts, no shadow tracking</td></tr><tr><td>Private fields + getters</td><td>Public/frozen data structs</td><td>Visible shape, no invented accessors</td></tr><tr><td>Runtime polymorphism</td><td>Sum types + exhaustive match</td><td>Closed case set, compiler-checked</td></tr><tr><td>Annotation-based DI</td><td>Explicit constructor params</td><td>Dependency graph visible at call site</td></tr><tr><td>Builder pattern</td><td>Single constructor + options struct</td><td>One expression, not a chain</td></tr><tr><td>Framework-decorated logic</td><td>Thin adapter + pure core function</td><td>Separates concerns the model handles independently</td></tr><tr><td>Boolean-flag state</td><td>Enum-driven state machine</td><td>Finite named states, pure transitions</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">The overarching principle is the same as the rest of this article: <strong>remove implicit decisions</strong>. Traditional OOP optimizes for human maintainability in large teams over years — hiding internals, deferring binding, distributing behavior across a hierarchy. LLM one-shot generation optimizes for a different constraint: everything relevant must be visible, local, and unambiguous within a single context window. You don&#8217;t abandon OOP thinking; you flatten it so the model doesn&#8217;t have to reconstruct the hidden architecture from fragments.</p><p>The post <a href="https://riceball.com/2026/09/29/adapting-traditional-oop-style-to-the-llm-world/">Adapting Traditional OOP Style to the LLM World</a> first appeared on <a href="https://riceball.com">🍙</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://riceball.com/2026/09/29/adapting-traditional-oop-style-to-the-llm-world/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
