ADR: The network log drafts, Steve sends
Status: accepted, 2026-11-04, at 1.0.4.136, over the four versions before it (1.0.4.132 to 1.0.4.135) that built what it records. The job hunt's Function logs every two-way conversation, by email and through the 6 AM program on LinkedIn, in one table, and on a Monday writes one follow-up draft per silence into the original Gmail thread under the label Follow-up/Ready, 21 days after the last exchange. Nothing sends. Steve presses Send.
In plain words
The cold side of the job hunt already follows up on its own. The warm side had nothing: people Steve had actually talked to, an interviewer, a recruiter who engaged, a former colleague who answered, went quiet because nothing kept track of them, and referrals come from exactly those people. From these versions the Function keeps the list. Every morning it reads the mailbox for threads where a person wrote and Steve answered, and keeps one row a person. Three weeks after the last word either way, on a Monday, a short follow-up is waiting in Gmail, in the same thread, for Steve to send or delete.
Context
Steve's ask, 11/4: log every real conversation and have a follow-up draft ready three weeks later, email and LinkedIn both, on the Function that already reads his mail. The rulings it obeys: nothing sends, a draft waits for his yes; the model writes rows and code writes drafts; silence after a follow-up is the answer; Calendar is not read, an invite is read as the email it arrives as; the campaign owns its recipients until they reply; one database.
Decision
- Who is a conversation is a rule with named cases, in the Domain.
HumanSenderRule (not a machine, not Steve, not a former employer's work address), TwoWayRule (a person and Steve both wrote, or a person sent an invite), WarmContactRule (a company domain, or a personal address the tracker or the responders list already knows), PersonKey and MatchKey (one row a person, one person across channels by name and company), StopRule (the campaign's stop phrases, and a bounce), DueRule (Open, a TopicLine, 21 to 45 days since the last exchange, at most fifteen a Monday, older than 45 closes stale), QuietRule (a sent follow-up met by 21 days of silence is Quiet; a deleted draft is declined). Each held by NetworkLogRulesTests and NetworkLogFollowUpTests.
- One table in its own schema.
network.Conversations and network.Passes in the site's database, beside campaign, card and jobhunt, written by the Function alone through its managed identity; card.Network is the card's counts. The schema is published by a person with DDL rights, once; until it is, the pass answers blocked: no_table.
- One pass a day, in the 6 o'clock hour Central, behind
NETWORK_LOG. Off unless shadow or on. It reads 120 days on its first pass and two after, leaves the campaign's open threads alone, reads the 6 AM program's LinkedIn spool, imports the 4 AM lane's TopicLines and exports the rows that still need one, and writes one line to networklog/pass.log ending with the conversations started this ISO week. A day finished in shadow runs once more when the switch reads on.
- The model writes the TopicLine; code writes the draft. The 4 AM lane reads
topics-needed.tsv and writes one plain clause per person to its own run folder; TopicLineRule holds the clause, and no TopicLine means no draft. FOLLOWUP-v1 is a constant, changed only with Steve's yes, rendered and checked (no dash, no tell, no blank, one question, a one-line Re: subject) before anything is written.
- Shadow first, and
on drafts only. In shadow the Monday writes networklog/would-drafts/<day>.md and the draft port is the refusing one. In on each draft goes into the person's own thread, to the address they wrote from, under Follow-up/Ready, and is read back before the row is Drafted. The adapter has no send; NetworkSqlTests and NetworkGmailTests hold that.
- The card counts, and never names. The network card under Cloud infrastructure reads
card.Network: conversations started each week for five weeks, the rows by state, the switch, the next pass. No name, company, address, subject or code leaves the view. The alert alert-jobhunt-network-silent emails Steve when no pass ran in the 6 o'clock hour.
What holds it
NetworkLogRulesTests, NetworkLogFollowUpTests, NetworkLogMergeTests, NetworkTopicTests, NetworkLogPassTests, NetworkDraftTests, NetworkSqlTests, NetworkGmailTests and NetworkSharedTests in the Function's suite; NetworkCardTests and the template's alert test beside them. Each has its row in ADR-075's table.
Not done in these versions, and why
- The LinkedIn half of the reading and the sending. The 6 AM program owns the only signed-in LinkedIn on the box and lives on another lane's branch until it reaches main. The Function already ingests its spool and keeps LinkedIn rows; the program's network step and the Monday LinkedIn queue are their own version when the program is on main.
- The optional blog line. The only minter of tagged codes is the share's make_ref.py; a second minter in C# would be a second source of codes, so v1 drafts carry no blog line and the row keeps the two columns for it. The addendum of 1.0.4.137 adds it with the 4 AM lane as the minter.
Addendum, 2026-11-05 (1.0.4.137): the post line, minted by the lane
The brief's optional line, Since then I wrote up <post title>: <tagged link>, goes into FOLLOWUP-v1 after the TopicLine, still FOLLOWUP-v1, because with no post named it renders word for word as before. Steve's call D7, option (b), is the yes for this one line.
- The lane picks the post and mints the code; the Function mints nothing.
topics-needed.tsv gains Needs, DueOn and LastOutbound: a row is listed for its TopicLine as before, and also from three days before it is due until it goes stale when it is an Open email row with no post named (BlogLine.Needed). For such a row the 4 AM lane picks a post from GET /api/blog/posts published after LastOutbound, mints its code with make_ref.py --channel Email --lane netlog, and writes PersonKey, the clause (empty when it already has one), the slug and the code. No post newer than Steve's last message means no slug and no code.
- The import stores a post once.
TopicImport holds the slug to the feed's shape and the code to make_ref's six characters (BlogLine.Fails), stores the first that pass in BlogSlug and RefCode, and refuses the rest into topics-refused.log. A stored post is not replaced: its code is already in the link-token spool under that person.
- The line is checked at the draft, not trusted from the row. A Monday with a due row naming a post reads the feed once (
BlogFeed); the line goes in only when the post is on the feed and went out after Steve's last message (BlogLine.For). The link is the post's address with the row's code, an anchor in the HTML part. Its ? is not counted as the draft's question. A draft whose line fails a check goes out without the line, and a feed that does not answer names no post.
- The pass line gains
posts=<n> (stored this pass) and named=<n> (drafts naming one).
- The card's names are links, from the API. The network card's header named
sqldb-theyard-ss-basic with no link, and so did the campaign card's: both found the database's resource id but passed no tenant, and a portal URL needs one. Both now take the tenant the reader's token was issued in (AzureMetrics.TenantAsync), the same tenant-qualified shape PlanView.Portal gives every other card. The network card also names func-jobhunt-ss, the Function that runs the pass, linked the same way, and its readout no longer repeats the database's name as plain text. The page renders whatever href the API sends; it builds none.
Held by NetworkBlogLineTests; its row is in ADR-075's table.
Addendum, 2026-11-07 (1.0.4.148): the card reads the pass, and the alert counts a failure
Until this version the card's first row, "Is it logging?", took its tone from the switch alone: shadow or on read good, whatever the pass came to. And the silent-pass alert counted invocations, so a pass that ran and threw counted as a pass. Both stopped being true on the two mornings this caught. The 6 AM passes of Friday 6 November and Saturday 7 November both came to failed, SqlException ("threw before it counted anything", 6.8 s and 6.3 s in the run history), the card said good both days, and the alert stayed quiet.
What was missing was a grant. The 5 November publish made network.Conversations, network.Passes and card.Network and granted the Function's user nothing on the network schema, so its first read, PassAsync, was refused. The laptop file Grant-NetworkSchema.vbs proves the refusal as that user, grants SELECT, INSERT, UPDATE and DELETE on the schema, reads the four rows back from sys.database_permissions and proves the read again, all in its own log.
- The row reads the newest pass. The card's hourly read also keeps the newest pass the run history lists (the same Application Insights rows
/api/admin/cloud/nightly/runs/NetworkLogPass answers) as the hour's facts, the way the nightly card keeps its runs. A failed pass reads alarm, "the last pass failed", with what it came to. A blocked or late pass reads warning in its own words. No pass for 25 hours while the switch is on or shadow reads warning, "no pass since" its day and time. A pass that came through reads good with this week's count. A history that was not read reads info and says why. The switch off reads "Off" as before.
- The alert trips on either. The query counts the invocations and the failed ones over the three hours before the 13:00 UTC hour, and fires when there were none or any failed: "The network log did not run, or failed, at 6 AM Central".
- A new schema ships with its grant. A schema added to the site's database is published with its GRANT to the Function's user in the same file, and the grant is read back as that user before the lane closes.
- Gmail's slow-down is waited out, and a refusal names itself. With the grant in place the file's own pass at 08:00 Central on 7 November got past the database and failed 20 seconds in, on a 403 from Gmail's
users.threads.get (HttpRequestException, GmailThreads.cs). The first pass reads a backfill four threads at a time, and Gmail answers a user over its per-second quota with a 403 whose reason is rateLimitExceeded or userRateLimitExceeded, which the reader did not retry. It now waits that 403 out like a 429 or a server error, five times with a doubling wait, and any answer it gives up on fails with Gmail's own reason word in the message, so the next failure says whether it was the quota or a refusal.
Held by NetworkPassTests, NetworkGmailTests and TemplateTests; their rows are in ADR-075's table.
Addendum, 2026-11-09 (1.0.4.173): reads under the quota, a backfill that resumes, and the Monday after a flip
The first pass that ran whole, at 06:00 Central on 8 November, read 1,092 threads in 7 minutes 20 seconds, stopped at its 7-minute budget with 319 left, and the run log called it late. Its trace in Application Insights accounts for the time: 1,242 thread reads that took 148 seconds of call time between them, 149 answered with Gmail's quota 403, and about 382 seconds spent in the doubling waits behind those 403s, which hold all four reads of a chunk. Four reads at once ran about 33 a second, and a thread read costs 10 of the 250 quota units a second Gmail allows one user. The threads it never reached were the oldest, last touched before 16 October, which is the 21 to 45 days a follow-up is owed in.
- Every Gmail read waits for its slot. GmailThreads spaces its requests 50 milliseconds apart, 20 a second and 200 units, under the quota instead of against it. The 403 is still waited out as before, should Gmail answer one.
- A backfill that stops resumes. When the first pass runs out of time or its list meets the 1,500-thread cap, it writes the point it reached to
networklog/backfill-before.txt on the share: one second past the oldest newest-message among the threads it read. Each later pass reads its two days and, while the file holds a time, the 120-day window before that point as well, moves the point back, and writes done once a read comes back whole. A read that got no further keeps its point when cut and ends the backfill when only capped, so it never loops. The pass line counts the threads asked for that way as resumed=.
- A Monday flipped to on drafts the same day. Decision D8 of the build plan said a Monday whose shadow pass had run would build its real drafts at the next hour once the switch read on; the hour check stopped that unless the any-hour switch was also on. A Monday pass now runs outside the 6 o'clock hour when the switch reads on and the day's pass finished in shadow, once.
Held by NetworkBackfillTests, NetworkGmailTests and NetworkSqlTests; their row is in ADR-075's table.
Addendum, 2026-11-09 (1.0.4.174): LinkedIn in, and LinkedIn follow-ups out for Steve's send
The email half has logged threads since 8 November; the LinkedIn half had a spool the pass read and nothing writing it. The 6 AM program's network lane (ADR-119, the addendum of this version) now writes it each morning: every LinkedIn thread where both sides wrote, as a row in networklog/linkedin-inbox/ and its text under networklog/linkedin-inbox/text/, which is the path the TopicLine export already names for a LinkedIn row. The daily pass logs them beside the email rows and joins a person's two channels by name and company, as before.
Out: on a Monday in on, a due row whose newest exchange was on LinkedIn is no longer left waiting. Its FOLLOWUP-v1 text goes to networklog/texts/<monday>/<thread>.txt, and the week's queue, networklog/linkedin-queue-<monday>.md, lists it in the reply queue's format 2 under section A with the thread and the profile. Section A is Steve's, so the messages lane never sends it; the morning card reads the week's queue beside the day's reply queue and shows each text in full, typed in the thread only on his send (PLAN-AUTOHUNT section 2, the 11/5 rule, which the build plan's earlier default of a standing-permission send gave way to). The row stays Open: his send moves its last exchange on the next LinkedIn read, and one he leaves is due again the next Monday until it goes stale. A LinkedIn message has no subject line, so the subject check is not run on a LinkedIn row. The queue's path lives in the shared FollowUpQueue, because the network log writes it and the card reads it.
Held by NetworkLinkedInQueueTests and NetworkDraftTests, whose rows are in ADR-075's table, and by NetworkLaneTests in the machine lanes, whose rule ADR-119's addendum of this version states, because ADR-075's table cannot yet cite a machine-lane test.
Addendum, 2026-11-12 (1.0.5.48): one slot clock for the whole Function, and every Gmail call waits out a rate answer
What stopped being true: the 1.0.4.173 addendum's "every Gmail read waits for its slot" held for the network log's reads only, and only within one reader. The ATS sweep's inbox (GmailInbox), the campaign's sender (GmailSender) and the draft writer (GmailDrafts) sent their requests unspaced and failed on the first answer that was not a success, and each reader kept its own clock, while the sweep, the reply drafts, the pounce, the campaign and the network log run in one host on one user's Gmail quota. From 04:20 Central on 12 November every part of the sweep failed every half hour on Response status code does not indicate success: 403 (Forbidden), a line that never said which 403 it was.
From this version one class, GmailHttp (functions/JobHunt.Infrastructure/Shared/Google), sends every Gmail request the Function makes, for all four adapters:
- One slot clock for the process. A static clock spaces every request 50 milliseconds from the one before it, whichever adapter or timer sends it.
GmailThreads keeps Spacing, Slot, Retries, RateReasons and Reason as forwards to it.
- A rate answer is waited out, everywhere. A 429, or a 403 whose reason is
rateLimitExceeded or userRateLimitExceeded, is waited out five times on doubling waits of 2 to 32 seconds, for a POST as for a GET. A server error is waited out the same way only on a call that may be made twice (a read, a label change). A call that makes something (a send, a draft, a label) is made again after a rate answer, which Gmail gives before it does anything, and never after a server error, after which the message may already have gone.
- A failure names itself. Any other answer, or a rate answer that does not clear, fails as
Gmail answered 403 (rateLimitExceeded) after 6 tries, and a 403 that refuses (insufficientPermissions, accessNotConfigured) fails on its first try with that word. The sweep's FAILED line prints the message as it was, so inbox-pass/pass.log names the cause.
The reply drafts were not the only caller over the quota. The campaign part's 403 is in pass.log 265 times from 27 October 08:20, on 4 to 25 of 48 passes a day, 219 of them at :20, weeks before the reply drafts existed. Its next FAILED line will carry the reason word. The 07:30 card's one label read (TodayCardTimer) still calls Gmail directly and reads "not read" on any failure.
Held by GmailHttpTests and NetworkGmailTests; their row is in ADR-075's table.
Where it sits
A feature slice in each of the Function's rings and a card in the site's Admin module, with the shared concerns the campaign now reads from too. Separation of duties is the principle: the model reads and summarises, code decides and writes, a person sends. It cost a schema, an hourly timer and one sign-in. What would change it: Steve saying send for email, which would be a new record, not an addendum.
Addendum, 2026-11-12 (1.0.5.70): a resumed backfill reads one slice a morning
What stopped being true: the 1.0.4.173 addendum's item 2 has each later pass read "the 120-day window before that point as well", up to the same 1,500 threads as the first pass and under the same seven-minute budget. The point seeded on 9 November put that whole read into the 06:00 pass: on 10 November it read 1,084 threads in 7 min 52 s, resumed=1500, and came to late with 475 cut, near the host's ten-minute ceiling; on 11 November 798 threads in 343 s, after which the file said done, and on 12 November 147 threads in 79 s. It was neither a cursor reset nor a daily sweep: the morning pass is the only pass, so the backfill rode in it.
From this version a resumed read asks Gmail for at most 100 older threads (NetworkLogPass.ResumeThreads) beside the two days, so the 06:00 pass stays well under two minutes and comes to success, and the backfill takes as many mornings as it needs. A slice that comes back full counts as capped and moves the point back past it; one that comes back short ends the backfill. The first pass on an empty table keeps the 1,500 cap, since nothing else is in that run. NetworkBackfillTests holds it.
Addendum, 2026-11-17 (1.0.5.81): email reconnects send themselves, in Steve's shape
What stopped being true: the title. On 17 November Steve rewrote a reconnect himself and said "if they're email connects send these automatically in this format", and of a recruiter who had gone quiet, "send that it costs us nothing". Fourteen went out by hand that morning. From this version a row whose newest exchange was by email gets RECONNECT-v1 instead of FOLLOWUP-v1: his first name line, the topic, "Is it a bad idea to stay in contact?", one second question (the status question only while the tracker holds an open application at the company, the remote question otherwise), the six portfolio links as bold labels, and his sign-off; no greeting word, no post line, no ask for a call. LinkedIn rows are unchanged: FOLLOWUP-v1 in the week's queue for Steve's send.
- The switch. NETWORK_SEND, read only while NETWORK_LOG is
on. Shadow, the default and the shipped setting, writes each reconnect as a Gmail draft, as before, and the exact HTML that would send under networklog/would-sends/<day>/. on sends it through the campaign's GmailSender (its port moved to the Function's shared Mail code, so no slice reaches into another), into the person's own thread, and counts it only once Gmail shows it under Sent. A Monday flipped after its 06:00 pass sends that day's drafts once at the next hour, deleting each draft first.
- The guards, before any draft or send, the first that holds logged and nothing written: a name or company BLACKLIST.md blocks, a former employer, an ATS relay or no-reply address, a message from the person still unanswered (a reply owed, not a reconnect), a reconnect or draft to them in 21 days read from the thread as well as the row (so a hand send counts before a pass has read it), three to a company in 60 days, fifteen a pass.
- The records. A send marks the row Drafted with
sent: and the Gmail message id, spools the code's row the make_ref.py way (lane NetworkLogPass), drops a tracker-inbox fragment, and adds a line to networklog/sent/<day>.tsv, which the 07:30 card prints under "Reconnects sent (n)". The Admin card's reconnects row shows the last pass's sent, held and bounced counts.
- A bounce (the 11/12 rule): Hunter is asked once; an address it verifies that differs from the one that bounced gets the same reconnect again, otherwise the row closes as bounced.
- Not campaign.EmailsSent. That table's rows each belong to a campaign lead (a foreign key), and the campaign's daily cap and 30-day company rule count every row in it, so a reconnect written there would spend the campaign's day. The row, the spool and the sent file hold what it would have.
ReconnectTemplateTests and ReconnectSendTests hold it; NetworkSqlTests' rule that nothing in the network log can send became the rule that only its reconnects send, through the shared mail port.
Addendum, 2026-11-28 (1.0.5.183): a reconnect is marked before it is sent
What stopped being true: that a reconnect is sent and then marked. A send whose mark failed would leave the row Open and the next pass would send it again. From this version the row's DraftId is set to sent:pending before the send and stamped after it (PendingReconnects). At the next on run a pending row whose thread holds one of Steve's messages since it was marked is stamped; one with no such message after 30 minutes goes back to Open with no draft. The words and the people do not change. ReconnectSendTests holds it.
Addendum, 2026-11-29 (1.0.5.196): a reconnect's links carry the blog
What stopped being true: "the six portfolio links" in the addendum of 1.0.5.81. RECONNECT-v1 now prints seven, Blog after About (/?view=blog&r=<code>), on Steve's 29 November 08:16 CST word, "All emails like this should include my blog link". The template keeps its name: only the links block moved, the same change the campaign's templates took in this version (ADR-118, its addendum of this version), and a sent reconnect keeps its own bodies. Still no blog-post sentence and no ask for a call. ReconnectTemplateTests holds the order and both golden files.
Addendum, 2026-11-29 (1.0.5.200): the reconnect's LinkedIn link says LinkedIn verified him
From this version RECONNECT-v1's LinkedIn link is labelled "LinkedIn ✓ identity verified", as the campaign's is (ADR-118, the addendum on the bullet). The HTML links the word "LinkedIn" alone and the rest follows as plain text; the plain part reads "LinkedIn ✓ identity verified ->
", in the template's own arrow shape. The golden files moved with it, and nothing else in the reconnect changed.
Files
Addendum, 2026-11-30 (1.0.5.207): the switch is on, and seven gates stand in front of it
What stopped being true: "Shadow, the default and the shipped setting" in the addendum of 1.0.5.81, as the live value. On 30 November Steve said "send all email like this these don't need my approval" (09:50 CST) and "the touchbase emails should go out automatically on our email job" (09:59), so NETWORK_SEND is set to on in the Function's settings once this version runs there. The template keeps shadow, as EMAIL_CAMPAIGN's does: on is his switch, never a deploy's, and a redeploy of the template puts every reconnect back to a draft. The words do not change: RECONNECT-v1, its seven links and its name are as they were.
- One a company a day. A row is held (
company today) when a reconnect already went to its company that Central day: sent or drafted earlier in the pass, stamped sent that day, or a row of the company whose last message from Steve is of that day, so a note he sent by hand that morning counts. The batch is newest exchange first, so the newer of two contacts goes and the other is due again the next Monday.
- No shared inbox. A role's mailbox (hr, careers, press, scheduling and the like, a +tag set aside), a no-reply in the address or its tag, an Exchange system sender, a tracking system's or a job board's domain, a ticket marker in the thread's subject, or a greeting that is a mailbox's name or the company's: the row is held and closed (
shared inbox), because an address does not become a person. The list lives in the guard alone; the mail rules the inbox sweeps read are unchanged.
- The tracker's red flag, and personal mail. A tracker row of the last 180 days that names the address or the company and carries the red flag scan's RED verdict holds the row and closes it (
red flag): a verdict is not undone by a calendar. A personal mail address holds the row and leaves it open, the scan's first-contact flag.
- All of a row's threads. The guards read the row's five newest threads together, so a reply owed in a second thread holds it; a thread that will not read holds it (
thread not read). The send still goes into the newest thread.
- The topic is checked again at send time, with one check more than at import: no contraction, check_draft.py's own pattern. A row that fails is not sent, stays open, and is listed for the 4 AM lane with
fix in topics-needed.tsv. Steve's own fixed text is not judged by that check: "It's been a few weeks" is his.
- Settled every day, retried once. With sending on, every pass settles the pending sends, not only Monday's. A first send Sent never showed is put back to open as
retry:1 and sent once more in that pass, through every guard and with a fresh code; a retry that misses as well becomes a draft in its thread under Follow-up/Ready and one line in networklog/not-working.tsv, which the 07:30 card says as NOT WORKING for seven days. Nothing else about a held or failed row reaches the card.
- Shadow drafts retire. A shadow draft seven days old whose HTML is still what the shadow wrote is deleted and its row closed (
not sent in 7 days): seven days unsent is Steve's answer, so it is never sent. One he edited is left alone.
- Who was held, and why. Every held or failed row is a line in
networklog/held/<day>.tsv with every reason that holds it (ReconnectGuards.All); the pass line keeps its counts.
- A dry run.
POST /api/network/dry-run?days=...&as_of=morning|now with the function key replays the days' would-sends through the same guards, checks and render, as that day's 06:00 pass would have judged them or as they stand now, and writes networklog/dry-runs/<stamp>.tsv with the HTML beside it. It is built with no mail port and no draft port and writes no row.
- The health route says the switch,
on or shadow as the pass reads it.
The stop is one setting: NETWORK_SEND=shadow puts every reconnect back to a draft at the next pass. ReconnectGateTests, ReconnectRetryTests, ReconnectSendTests and MergerHealthTests hold it.
Enforced by
10 rules in the rulebook cite this record, each held by a test on every release.