<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3ADocumentation%3AFile_Normalization_Extension_Asset_v2</id>
	<title>ICT:Documentation:File Normalization Extension Asset v2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3ADocumentation%3AFile_Normalization_Extension_Asset_v2"/>
	<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:Documentation:File_Normalization_Extension_Asset_v2&amp;action=history"/>
	<updated>2026-07-23T00:11:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://mwiki.costasano.club/index.php?title=ICT:Documentation:File_Normalization_Extension_Asset_v2&amp;diff=1220&amp;oldid=prev</id>
		<title>Mngr: Created page with &quot;= Explanation of the File Normalization Extension in Asset v2 =  This page documents the purpose, scope, and design principles of the &#039;&#039;&#039;server-side file normalization extension&#039;&#039;&#039; used in Asset v2.  It is intentionally conceptual and explanatory. Actual PHP code is documented elsewhere.  ----  == Purpose of This Document ==  File handling in MediaWiki is complex because:  * uploads occur before page save completion * file pages and content pages are separate entities *...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:Documentation:File_Normalization_Extension_Asset_v2&amp;diff=1220&amp;oldid=prev"/>
		<updated>2026-02-20T13:23:27Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Explanation of the File Normalization Extension in Asset v2 =  This page documents the purpose, scope, and design principles of the &amp;#039;&amp;#039;&amp;#039;server-side file normalization extension&amp;#039;&amp;#039;&amp;#039; used in Asset v2.  It is intentionally conceptual and explanatory. Actual PHP code is documented elsewhere.  ----  == Purpose of This Document ==  File handling in MediaWiki is complex because:  * uploads occur before page save completion * file pages and content pages are separate entities *...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Explanation of the File Normalization Extension in Asset v2 =&lt;br /&gt;
&lt;br /&gt;
This page documents the purpose, scope, and design principles of the&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;server-side file normalization extension&amp;#039;&amp;#039;&amp;#039; used in Asset v2.&lt;br /&gt;
&lt;br /&gt;
It is intentionally conceptual and explanatory.&lt;br /&gt;
Actual PHP code is documented elsewhere.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Purpose of This Document ==&lt;br /&gt;
&lt;br /&gt;
File handling in MediaWiki is complex because:&lt;br /&gt;
&lt;br /&gt;
* uploads occur before page save completion&lt;br /&gt;
* file pages and content pages are separate entities&lt;br /&gt;
* user actions may partially succeed&lt;br /&gt;
* failures must not corrupt archival data&lt;br /&gt;
&lt;br /&gt;
This document explains why a private extension is required,&lt;br /&gt;
what it enforces,&lt;br /&gt;
and what it explicitly does NOT do.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Big Picture ==&lt;br /&gt;
&lt;br /&gt;
The file normalization extension is the &amp;#039;&amp;#039;&amp;#039;only authoritative enforcement layer&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
in Asset v2.&lt;br /&gt;
&lt;br /&gt;
It exists to ensure that:&lt;br /&gt;
&lt;br /&gt;
* the uploaded file name matches the Asset identifier&lt;br /&gt;
* file history is preserved&lt;br /&gt;
* the system remains consistent even if JavaScript fails&lt;br /&gt;
&lt;br /&gt;
All other layers are advisory or assistive.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why an Extension Is Required ==&lt;br /&gt;
&lt;br /&gt;
The following cannot be reliably enforced by:&lt;br /&gt;
&lt;br /&gt;
* Page Forms&lt;br /&gt;
* JavaScript&lt;br /&gt;
* Lua&lt;br /&gt;
* Cargo&lt;br /&gt;
&lt;br /&gt;
Specifically:&lt;br /&gt;
&lt;br /&gt;
* renaming uploaded files after save&lt;br /&gt;
* suppressing redirect creation&lt;br /&gt;
* preserving file history&lt;br /&gt;
* handling failure safely&lt;br /&gt;
&lt;br /&gt;
Only server-side PHP code can do this correctly.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What the Extension Does ==&lt;br /&gt;
&lt;br /&gt;
After a successful Asset save, the extension:&lt;br /&gt;
&lt;br /&gt;
# identifies the Asset page being saved&lt;br /&gt;
# determines the final Asset identifier (page name)&lt;br /&gt;
# finds the uploaded File associated with that Asset&lt;br /&gt;
# renames (moves) the file to:&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  File:&amp;amp;lt;AssetIdentifier&amp;amp;gt;.&amp;amp;lt;extension&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
# preserves the file history&lt;br /&gt;
# suppresses redirect creation&lt;br /&gt;
&lt;br /&gt;
This operation is automatic and requires no user action.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== When the Extension Runs ==&lt;br /&gt;
&lt;br /&gt;
The extension runs:&lt;br /&gt;
&lt;br /&gt;
* after the Asset page is successfully saved&lt;br /&gt;
* after the file upload has completed&lt;br /&gt;
* after Cargo storage has occurred&lt;br /&gt;
&lt;br /&gt;
It does NOT run:&lt;br /&gt;
&lt;br /&gt;
* during form editing&lt;br /&gt;
* during preview&lt;br /&gt;
* during failed saves&lt;br /&gt;
* on existing Assets during edit&lt;br /&gt;
&lt;br /&gt;
This ensures transactional safety.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Rename Semantics ==&lt;br /&gt;
&lt;br /&gt;
The rename operation:&lt;br /&gt;
&lt;br /&gt;
* uses MediaWiki&amp;#039;s internal file move mechanism&lt;br /&gt;
* keeps the full file revision history&lt;br /&gt;
* removes the original uploaded filename&lt;br /&gt;
* does NOT leave redirects behind&lt;br /&gt;
&lt;br /&gt;
From the user&amp;#039;s point of view:&lt;br /&gt;
* the file simply “has the correct name”&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Failure Policy ==&lt;br /&gt;
&lt;br /&gt;
If file renaming fails:&lt;br /&gt;
&lt;br /&gt;
* the Asset page remains valid&lt;br /&gt;
* the File page remains valid&lt;br /&gt;
* Cargo data remains correct&lt;br /&gt;
* no rollback is attempted&lt;br /&gt;
&lt;br /&gt;
The system may:&lt;br /&gt;
* log the failure&lt;br /&gt;
* allow manual or automated retry later&lt;br /&gt;
&lt;br /&gt;
Rename is mandatory but NOT blocking.&lt;br /&gt;
&lt;br /&gt;
This is intentional.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why Rename Is Not Blocking ==&lt;br /&gt;
&lt;br /&gt;
Blocking the save would mean:&lt;br /&gt;
&lt;br /&gt;
* losing user input&lt;br /&gt;
* creating frustration&lt;br /&gt;
* increasing retry complexity&lt;br /&gt;
&lt;br /&gt;
In archival systems:&lt;br /&gt;
&lt;br /&gt;
* metadata correctness is primary&lt;br /&gt;
* file naming can be corrected later&lt;br /&gt;
&lt;br /&gt;
Therefore:&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Asset creation must succeed even if renaming fails.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What the Extension Does NOT Do ==&lt;br /&gt;
&lt;br /&gt;
The extension explicitly does NOT:&lt;br /&gt;
&lt;br /&gt;
* generate identifiers&lt;br /&gt;
* validate Chapter or Context&lt;br /&gt;
* enforce immutability rules&lt;br /&gt;
* modify Cargo data&lt;br /&gt;
* modify page content&lt;br /&gt;
* interact with JavaScript&lt;br /&gt;
&lt;br /&gt;
Its responsibility is narrow and enforced.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Interaction with Other Layers ==&lt;br /&gt;
&lt;br /&gt;
The extension assumes:&lt;br /&gt;
&lt;br /&gt;
* Page Forms collected valid input&lt;br /&gt;
* Lua generated a correct identifier&lt;br /&gt;
* JavaScript assisted the user&lt;br /&gt;
* Cargo stored the data&lt;br /&gt;
&lt;br /&gt;
But it does NOT trust any of them.&lt;br /&gt;
&lt;br /&gt;
It only trusts:&lt;br /&gt;
* the saved Asset page name&lt;br /&gt;
* the actual uploaded File object&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Security and Permissions ==&lt;br /&gt;
&lt;br /&gt;
The extension runs with:&lt;br /&gt;
&lt;br /&gt;
* elevated internal permissions&lt;br /&gt;
* no user interaction&lt;br /&gt;
* no UI exposure&lt;br /&gt;
&lt;br /&gt;
Users cannot bypass it deliberately.&lt;br /&gt;
&lt;br /&gt;
This is required for consistency.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Idempotency ==&lt;br /&gt;
&lt;br /&gt;
The extension must be safe to run multiple times.&lt;br /&gt;
&lt;br /&gt;
If:&lt;br /&gt;
&lt;br /&gt;
* the file already has the correct name&lt;br /&gt;
&lt;br /&gt;
Then:&lt;br /&gt;
&lt;br /&gt;
* no action is taken&lt;br /&gt;
* no error is produced&lt;br /&gt;
&lt;br /&gt;
This allows:&lt;br /&gt;
* retries&lt;br /&gt;
* future batch repairs&lt;br /&gt;
* safe reprocessing&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Mental Model to Keep ==&lt;br /&gt;
&lt;br /&gt;
You can safely remember:&lt;br /&gt;
&lt;br /&gt;
* Page Forms = input&lt;br /&gt;
* JavaScript = assistance&lt;br /&gt;
* Lua = calculation&lt;br /&gt;
* Cargo = storage&lt;br /&gt;
* Extension = enforcement&lt;br /&gt;
&lt;br /&gt;
Only the extension guarantees reality.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
&lt;br /&gt;
This document is stable reference documentation.&lt;br /&gt;
&lt;br /&gt;
It exists to support long-term understanding and memory retention.&lt;/div&gt;</summary>
		<author><name>Mngr</name></author>
	</entry>
</feed>