Skip to content

ADR: Old folders are zipped, not kept

ADR: Old folders are zipped, not kept

Status: accepted, 2026-11-23, at 1.0.5.148. The archive job, JobHunt.Server archive, and its 03:40 timer on WickedAwsome ship at 1.0.5.148; its first passes run after the publish.

Reading list

  1. ADR: The modular monolith: the third process, server/, that the job is a verb of, and the ring and slice rules it follows.
  2. ADR: The tracker merger runs in Azure: the job hunt's share and what reads it on a timer.
  3. ADR: Automated tests never touch a real database or permanent storage: why every test of the job runs on a fake share or a temp folder.

In plain words

The job hunt keeps its working files on one Azure file share. Every night adds forty to a hundred run folders to it, and nothing ever took one away. A share is billed for looking: each folder costs a little every time something lists the share, and a lane that walks it pays for every folder it passes. So once a folder is old enough that nothing reads it any more, it is packed into one zip, the zip is opened again and checked file by file against the folder, a line is written saying where it went, and only then is the folder moved aside by one rename. Nothing is deleted: the zip is the second copy, and the moved folder waits until a person empties the place it went.

What that is worth: the share stops growing a folder at a time, any day's files can still be read from a single zip at the same paths, and a file is never lost to a copy that did not finish, because the move only happens after the check.

Context

Counted on 23 November, one level each, by name:

Folder What was there
nightly\<day>\ 35 day folders, about 44 run folders a day; 32 of 44 written by GitHub runners, the rest by the box
dispatch\done\<day>\ 15 day folders of closed dispatcher runs
dispatch\locks\ 180 released and 11 dead lock files, a README, no live lock
inbox\link-tokens\merged\ 557 rows already folded into link-tokens.csv
mentor\logs\ 1,099 files and 170 subfolders holding 3,110 more, about 104 MB, nothing written since 27 October

A listing or a write on this share is $0.015 for 10,000 (the share card's own price, ShareCard.cs). The whole share cost about $0.24 on 22 November. So this is hygiene with a ceiling on growth, worth under a dollar a month, and it is described that way. The bigger saving, emptying J:\_to_delete\2026-10-24, is a person's decision and is not taken here.

Every reader of a day folder looks back a short way: the topic import three days, the last card seven, the morning cards today only. One reader looks back forever: the lane's crash hold (LaneRunner.CrashedAsync) stops a lane while any day holds a run that died part way, and that hold "never runs out on its own".

Decision

The archive job: check that no cost1123 row is open, pick what is old enough, refuse a held day, then zip, reopen and check, log, and move by one rename; a zip that does not match is renamed .failed and the source stays; the daily line names what it could not do

A preview. Open the archive job in a new page to zoom in and follow it.

  1. One verb on the box, one timer. JobHunt.Server archive [--dry-run] [--unit <path>], a slice of its own in server/ (Features/Archive), a port for zip, verify and move (IArchiver), and its adapter over the mount (MountArchiver). jobhunt-archive.timer runs it at 03:40 Central every night, Persistent=true, installed by server/publish-to-wickedawsome.sh. No new script on the share.
  2. What a unit is, and when it is old enough. A nightly day folder or a dispatcher done day more than fourteen Central days before today; the released and dead lock files more than fourteen days past the stamp in their name, one zip a month, never a live .lock and never the README; the folded link-token files last written more than thirty days ago, one zip a month; and mentor\logs, once, by name, with a MOVED.md left where it was, because public decision records cite its files by path.
public static partial class ArchiveUnits
{
    /// <summary>A day folder older than this many Central days is old enough.</summary>
    public const int DayAge = 14;

    /// <summary>A folded link-token file last written longer ago than this many days is old enough.</summary>
    public const int FileAge = 30;

    /// <summary>The most units of one kind a run archives.</summary>
    public const int PerKind = 5;

    /// <summary>The calls to the share after which a run starts no more units.</summary>
    public const int MostCalls = 3000;

Live from server/JobHunt.Server.Application/Features/Archive/ArchiveUnits.cs, region archive-ages, read from this build at 99df7a8.

  1. What it refuses. A nightly day with any run that is not settled, by the same two tests the crash hold applies (now one rule, RunSettlement, that both call), and any day a live document names, read from nightly\*.md that are not backups and START-HERE.md. Archiving either would lift a hold or move a folder a lane still reads.
/// <summary>Why a nightly day may not be archived, or null: a document names it, or one of its runs is unsettled.</summary>
private async Task<string?> RefusalAsync(DateOnly day, IReadOnlyDictionary<DateOnly, string> named, CancellationToken ct)
{
    if (named.TryGetValue(day, out string? document))
    {
        return $"{document} names it";
    }
    foreach (string run in await FoldersAsync(RunSlot.DayFolder(day), "*", ct))
    {
        if (run.EndsWith("-dry", StringComparison.Ordinal))
        {
            continue;
        }
        string? note = null;
        if (await ExistsAsync($"{run}/DONE.md", ct))
        {
            Calls++;
            note = await share.ReadAsync($"{run}/DONE.md", ct);
        }
        if (note is not null && RunSettlement.Unsettled(note))
        {
            return $"{Name(run)}/DONE.md carries a defect line or an unwritten tracker row";
        }
        if (note is not null && RunSettlement.Held(note))
        {
            return $"{Name(run)}/DONE.md says HELD";
        }
        if (note is null && await ExistsAsync($"{run}/progress.tsv", ct))
        {
            return $"{Name(run)}/progress.tsv has no DONE note";
        }
    }
    return null;
}

Live from server/JobHunt.Server.Application/Features/Archive/ArchivePlan.cs, region archive-refusal, read from this build at 99df7a8.

  1. The order, for every unit. Zip it with every path from the share's root kept. Reopen the zip from disk and read each entry to its end: the entry count must equal the files, and each entry's length and CRC-32 must equal a second read of its source. Write one line to J:\_archive\datamove1123\ARCHIVE-LOG.tsv (UTC time, unit, files, bytes, the zip's SHA-256, where the original went). Only then move the original by one rename into J:\_to_delete\datamove1123\<kind>\, which the mount sends to Azure as one server-side move. A name already taken gets -2, -3. A zip that does not match is renamed .failed and its source stays where it was.
private async Task<(bool Ok, string Line)> ArchiveAsync(ArchiveUnit unit, DateTimeOffset now, CancellationToken ct)
{
    ArchiveZip zip = await archiver.ZipAsync(unit, ArchiveUnits.ZipPath(unit), ct);
    IReadOnlyList<ArchiveEntry> inZip = await archiver.OpenAsync(zip.Zip, ct);
    IReadOnlyList<ArchiveEntry> source = await archiver.ReadAsync(unit, ct);
    if (Mismatch(inZip, source) is { } why)
    {
        string aside = await archiver.FailAsync(zip.Zip, ct);
        return (false, $"failed {unit.Label}: {why}; the zip is now {aside} and the source is where it was");
    }
    if (!await share.ExistsAsync(ArchiveUnits.LogPath, ct))
    {
        await share.AppendAsync(ArchiveUnits.LogPath, ArchiveUnits.LogHeader, ct);
    }
    string target = ArchiveUnits.Target(unit);
    await share.AppendAsync(ArchiveUnits.LogPath, ArchiveUnits.LogLine(now, unit, source.Count, zip, unit.IsFiles ? $"{target}/" : $"{target}/{unit.Name}"), ct);
    string moved = await archiver.MoveAsync(unit, target, ct);
    if (unit.Source == ArchiveUnits.Logs)
    {
        await share.WriteAsync(WritePolicy.LogsMoved, ArchiveUnits.MovedNote(now, zip, moved, source.Count), ct);
    }
    return (true, $"archived {unit.Label}: {source.Count} files, {zip.Bytes} bytes in {zip.Zip} (sha256 {zip.Sha256[..12]}), originals now {moved}");
}

Live from server/JobHunt.Server.Application/Features/Archive/ArchiveRun.cs, region archive-one-unit, read from this build at 99df7a8.

  1. Small and polite. At most five units of a kind a run, so the backlog clears over a week rather than in one busy hour, and a run starts no unit that would take it past 3,000 calls to the share. It lists only its five folders, one level, and inside a chosen unit only that unit. While a cost1123 row is open on state.md it does nothing and says so, because that lane's diagnostic log is reading the share; a row older than 48 hours with no close does not hold it.
  2. Where it may write. The program's write policy gains two folders, _archive/datamove1123/ and _to_delete/datamove1123/, and the one note mentor/logs/MOVED.md. Everything else stays refused before the disk is touched, and the adapter also refuses a source outside the job's five folders.
  3. It says what it could not do. The run's last line counts what it archived, failed, refused and left, and names each refused day with its reason and any moved folder that has come back. When it names anything, the same line goes to the morning's state rows as a NOTE.

What holds it

  • ArchiveTests: the job against the share in memory and an archiver that records each unit. Five of a kind oldest first and the rest waiting; a day with a defect line, a HELD note, a progress file with no DONE note, or a name in a live document refused and named; a dry run that reads names only; nothing touched while a cost1123 row is open, and a two-day-old row holding nothing; a zip that does not match set aside with its source left; mentor\logs once with its note, and named when it comes back; the 3,000-call stop.
  • ArchiveAdapterTests: the adapter on a temp folder. A day folder zipped and reopened to the same lengths and CRC-32s, CRC-32 held to its check value, the whole job end to end with the log and the rename, -2 for a taken name, .failed, and a source or target outside the job's folders refused.
  • SlotTests: the two new folders and the one note, and nothing beside them.

Consequences

  • The share's folder count stops growing with every night. It only falls once J:\_to_delete\datamove1123\ is emptied, which is Steve's call; until then the originals and the zips are two copies.
  • A day's files are found at the same path inside its zip, so a record or a note that names nightly\<day>\... can still be followed.
  • A day with an unsettled run stays on the share, and the job names it every night until a person settles it.

What is not done here

The dispatcher's queue in SQL, the link codes in SQL and the pictures in blob storage were looked at and held, each for a reason: the dispatcher and the code minter run as Python on the share with no path to SQL, and coding lanes name their mockup pictures by their J: paths. Each needs a planning session of its own first.

Where it sits

In the third process, server/, as a slice of its own: the rules and the order live in the Application ring (ArchiveRun, ArchivePlan, ArchiveUnits) behind a port (IArchiver), and the only code that touches the disk is the adapter in Infrastructure (MountArchiver), so the job is tested on a fake share and a temp folder. It serves single responsibility (the job decides, the adapter moves bytes) and dependency inversion (the use case owns the port). It costs a few minutes of the box at 03:40 and a few thousand calls to the share a night until the backlog is gone; a cheaper store for the old files, or a person emptying _to_delete, would change the choice of where the originals go.

Files

Enforced by

Not machine-checked. Held by review.

Store

The Yard, home

Steven StoutStaff .NET engineerRemote

Production .NET that stays up. Built with AI, measured on every version.

Steven Stout

Hi, I'm Steve. I build the systems that make delivery boring in the best way, then coach people inside them.

  • 200+

    production releases, none took the platform down

    Conway Investment Research, 2019 to 2024. Sole engineer for the first three years on a live financial advisory platform.

    See how
  • 50%

    shorter release cycle

    Storee Construction, 2024 to 2026. Four ASP.NET applications onto one .NET 10 platform on Azure, with a four-person team I hired and mentored.

    See how

01Verified

Steven Stout

A real person, and the work is mine.

  • Identity

    Checked by LinkedIn, not by me.

    LinkedIn verified my government ID.

  • Running system

    You are looking at it.

    Version 1.0.5.273 is live. Nothing ships unless it passes the automated gates first.

That's who I am. Here's how I work.

02Strengths

Ten strengths, each with the proof beside it. The numbers match my resume and LinkedIn, and the live ones are read from this site as you look.

  • 01

    Keeps production alive

    200+ releases on a live financial platform, and none took it down. Sole engineer for the first three years.

    See the Conway work

  • 02

    Simplifies messy systems

    Four ASP.NET applications onto one .NET 10 platform on Azure, and a release cycle 50% shorter.

    See the Storee work

  • 03

    Marries dev and infrastructure

    Blue-green releases at Storee that flipped in about 5 seconds with nobody signed out, and Azure Front Door at two employers.

    See this site's cloud

  • 04

    Designs data that holds up

    White-label clients on one shared database, the isolation built into the data, and no cross-client issues.

    See the Conway work

  • 05

    Keeps AI-written code honest

    15 quality numbers that may only improve: 273 releases in a row with none worse.

    See the quality numbers

  • 06

    Resourceful

    $30,000+ cut from Azure and vendor spend at Conway. This site's Azure bill is public, resource by resource.

    See the bill

  • 07

    Builds people up

    Hired and mentored a four-person team. 13 colleagues recommend me by name.

    Read the recommendations

  • 08

    Takes ideas to production

    This site: designed, built and run solo, with 352 versions measured through one gate.

    How it was built

  • 09

    Writes clearly

    Posts on real engineering problems, in plain words.

    Read the blog

  • 10

    Owns decisions

    153 decision records, each with its tradeoff and the call I made.

    See the decision records

Built with AI. Gated so quality never slides.

Steven Stout’s showcase: a used-vehicle auction on .NET and React, built and run by one engineer, live on Azure, with its decisions written down.

No quality number has gotten worse at any release since 1.0.5.1 on 10 November: 273 releases in a row.

One engineer, an AI agent and a gate that checks 15 quality numbers on every release. 352 versions measured, with every result public, the worst days included.

82 releases in the last 7 days, each through the same gate.

Async methods with no CancellationToken, may only fall

11091.0.3.1391.0.5.2731.0.4.115, the ratchet
Every number, on the Quality page

TheYard, right nowLive

Answering in

unread

02505007501,000

server time at p95, the usual five minutes of the last day.

Azure this month

unread

the bill, by resource, read from Azure. The Admin tab shows every line.

Since the last roll

unread

 

rolled in place by the pipeline, behind one gate.

People who have visited

unread

30 days agotoday

Scanners, my own tools' and my own reads left out.

03Start here

04Where teams are heading

How I see engineering with AI, and the setup on this site that backs it.

AI-augmented teams · Architecture and ownership

AI writes more of the code. Someone still has to own what ships.

Teams are going to be heavily AI-augmented. That moves the senior job toward architecture and technical ownership: deciding what to build in pieces small enough to verify, and owning what ships.

  • Task tracking will get automated too. Judgment stays human: seeing a design fail at scale before it does.
  • On this site the AI's first design held the whole catalogue in memory. I caught it when the App Service plan hit 82 per cent and moved the work to the store.

What the AI wrote, what I decided

07Tech stack

  •    
  •    
  •    

Read from the build, never typed by hand

What TheYard runs on

What we use, where it runs, its AWS twin, the version as built, and the file that proves it.

Cloud patterns, not one vendor: every Azure piece in this stack has a named AWS twin. Mapped, not yet run on AWS.

  • .NET 1114 projects
  • React 19.3TypeScript 7.0
  • Azure9 Bicep files
  • 11GitHub Actions workflows
The whole stack, with the file that proves each line

The last release the gate stopped was 1.0.5.258 on 2 December, at its browser 1 of 2 job.

08How it is built

09How it is run

10Who and why

Next step

11What has to work, where is it today, and what does success look like?

Book 20 minutes opens an email to me with those three questions in it, and I answer with a time.

Book 20 minutes

Your email app should have opened with this message. If it did not, copy it and send it from any mailbox.

Or message me on LinkedIn