<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: BrowserAct</title>
    <description>The latest articles on DEV Community by BrowserAct (@browser_act_e2505dbdf454a).</description>
    <link>https://dev.to/browser_act_e2505dbdf454a</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3947214%2F204cb39f-93e9-433b-bd18-afe93715d34c.png</url>
      <title>DEV Community: BrowserAct</title>
      <link>https://dev.to/browser_act_e2505dbdf454a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/browser_act_e2505dbdf454a"/>
    <language>en</language>
    <item>
      <title>LinkedIn Sales Navigator Scraper: Build a Lead List Without Your Login</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Fri, 13 Nov 2026 09:04:24 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/linkedin-sales-navigator-scraper-build-a-lead-list-without-your-login-450k</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/linkedin-sales-navigator-scraper-build-a-lead-list-without-your-login-450k</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp5b5nplv2qmwibicp20v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp5b5nplv2qmwibicp20v.png" alt="LinkedIn Sales Navigator Scraper: Build a Lead List Without Your Login" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A small B2B team wants to find revenue operations leaders, but nobody wants to connect a personal LinkedIn session to a scraping tool. A no-login LinkedIn Sales Navigator scraper can help collect candidate profiles using supported keywords or an existing people-search URL. The important preparation is deciding which conditions the input can express and which you will need to check in the returned list.&lt;/p&gt;

&lt;p&gt;BrowserAct's LinkedIn Sales Navigator Lead Scraper provides that collection step without asking for your own LinkedIn login or cookies. You still need BrowserAct access. Start with a small query, inspect the returned people, and build a reviewed prospect list before looking for contact details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Define the person, employer and location you want before collecting names; a search match is a candidate, not a qualified lead.&lt;/li&gt;
&lt;li&gt;Choose an input route that supports your criteria. Keywords are not separate title, company or location filters, and a search URL must already be available.&lt;/li&gt;
&lt;li&gt;Review returned roles, companies and locations, keep uncertain records separate, and deduplicate by profile identity before combining batches.&lt;/li&gt;
&lt;li&gt;Treat contact discovery and outreach as later decisions. A profile record does not guarantee an email address, buying intent or permission to contact.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What a No-Login Sales Navigator Scraper Can Help You Do
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Separate People Searches from Company Research
&lt;/h3&gt;

&lt;p&gt;Use a people search when your next decision concerns a person: whether their current role and employer make them relevant to your offer. The useful output is a list of names with professional context and profile links you can revisit. A company research task starts with organizations and needs different information, such as their products, customer segments or headquarters.&lt;/p&gt;

&lt;p&gt;For example, a company selling sales operations software might want people responsible for revenue systems at B2B software businesses. A matching phrase in a profile can identify someone worth checking, but it does not establish their budget, authority or current need. Keep those questions in your review process.&lt;/p&gt;

&lt;h3&gt;
  
  
  No LinkedIn Session to Connect; BrowserAct Access Still Applies
&lt;/h3&gt;

&lt;p&gt;For this BrowserAct template, no login means you do not have to supply your own LinkedIn account or paste a LinkedIn cookie. It does not remove BrowserAct authentication or usage charges. Check the template's &lt;strong&gt;Pricing&lt;/strong&gt; tab before starting, especially before increasing the requested number of profiles.&lt;/p&gt;

&lt;p&gt;The input routes also have different preparation requirements. Keyword search does not require you to build a Sales Navigator search first. The URL route requires an existing Sales Navigator people-search link; creating that search inside Sales Navigator requires the appropriate access. No-login extraction does not give you a Sales Navigator subscription or its full interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define the People You Want Before You Search
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Write Down Role, Employer, Person Location and Exclusions
&lt;/h3&gt;

&lt;p&gt;Write one sentence describing the people you want to research, then turn it into review criteria. For the sales operations software example, that might be: people working in revenue operations at B2B software companies, with the individual based in your service region. Decide whether consultants, agencies and former employees belong in the same list.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criterion&lt;/th&gt;
&lt;th&gt;What to specify&lt;/th&gt;
&lt;th&gt;What to check in the result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Role&lt;/td&gt;
&lt;td&gt;Responsibilities and acceptable title variations&lt;/td&gt;
&lt;td&gt;Is the role current, and does it involve the problem you solve?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Employer&lt;/td&gt;
&lt;td&gt;Target companies or a clear business category&lt;/td&gt;
&lt;td&gt;Does the company actually fit that category?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Person location&lt;/td&gt;
&lt;td&gt;The region where the individual needs to be based&lt;/td&gt;
&lt;td&gt;Does the person's stated location fit, rather than only the company's headquarters?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exclusions&lt;/td&gt;
&lt;td&gt;Roles or company types outside your audience&lt;/td&gt;
&lt;td&gt;Is there a clear reason to remove the record?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Separate Must-Have Criteria from Information to Check Later
&lt;/h3&gt;

&lt;p&gt;Some criteria will decide whether a record stays in your list. Others will help you prioritize it later. A current employer may be essential; a detailed About section may simply be useful. Keeping those categories separate prevents you from treating an incomplete profile as an automatic rejection.&lt;/p&gt;

&lt;p&gt;A missing field is a question to resolve. If location is essential and the returned location is blank, put the record aside for a location check. Do not fill the gap with the employer's headquarters or assume the search already established it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose Keywords or an Existing People-Search URL
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Start with Keywords When You Do Not Have a Search URL
&lt;/h3&gt;

&lt;p&gt;The template's &lt;code&gt;keywords&lt;/code&gt; input searches text matched against lead profiles. It supports Boolean expressions, such as &lt;code&gt;AI OR "machine learning"&lt;/code&gt;. For a first pass at revenue operations contacts, you could start with &lt;code&gt;revenue operations&lt;/code&gt; and inspect whether the returned roles fit your definition.&lt;/p&gt;

&lt;p&gt;That phrase is a keyword query, not a dedicated current-job-title filter. It may match professional context beyond the person's current role. Likewise, adding a company or place name to the phrase does not turn it into a separate employer or geography filter. Review those attributes in the returned records.&lt;/p&gt;

&lt;p&gt;The current inputs also include optional &lt;code&gt;first_name&lt;/code&gt; and &lt;code&gt;last_name&lt;/code&gt; filters. These help narrow a known name; they do not establish identity by themselves. People with the same name still need a profile and employer check.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use an Available Sales Navigator People-Search URL
&lt;/h3&gt;

&lt;p&gt;If you or a colleague already has access to the relevant Sales Navigator people search, copy the address of the actual people-search results page into the template's &lt;code&gt;url&lt;/code&gt; input. Record the intended criteria alongside it. A personal profile, company page or saved lead list is a different input; do not substitute one for a people-search URL.&lt;/p&gt;

&lt;p&gt;This route can carry criteria encoded in the search URL, but the returned list still needs checking. Do not assume that every Sales Navigator filter, saved list or account-specific relationship can be reproduced by a separate service. If you cannot obtain a usable people-search URL, use the keyword route and retain the extra review work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Know Which Input Wins When a URL Is Supplied
&lt;/h3&gt;

&lt;p&gt;When &lt;code&gt;url&lt;/code&gt; is supplied, the template ignores the other search filters except &lt;code&gt;limit&lt;/code&gt;. Adding keywords or a first name beside the URL will not further narrow that URL-based search. Choose one input route for the query you intend to run.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input route&lt;/th&gt;
&lt;th&gt;What you prepare&lt;/th&gt;
&lt;th&gt;What still needs review&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Keywords, optionally a first or last name&lt;/td&gt;
&lt;td&gt;Relevant profile text and a modest result limit&lt;/td&gt;
&lt;td&gt;Current role, employer, person location and identity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Existing people-search URL&lt;/td&gt;
&lt;td&gt;A usable Sales Navigator people-search link and its intended criteria&lt;/td&gt;
&lt;td&gt;Whether returned people actually match; any missing or unsupported context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No usable keyword or search URL yet&lt;/td&gt;
&lt;td&gt;A clearer audience definition&lt;/td&gt;
&lt;td&gt;Refine the search before submitting a task&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Run a Small Search and Read the Returned Profiles
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Open the Template, Choose One Input Route and Set the Limit
&lt;/h3&gt;

&lt;p&gt;Open the &lt;a href="https://www.browseract.com/template/linkedin-sales-navigator-lead-scraper?co-from=blog-Sales-Navigator-Lead-List-DEV" rel="noopener noreferrer"&gt;LinkedIn Sales Navigator Lead Scraper&lt;/a&gt; in BrowserAct. For a keyword-based configuration example, leave &lt;code&gt;url&lt;/code&gt; empty, enter &lt;code&gt;revenue operations&lt;/code&gt; in &lt;code&gt;keywords&lt;/code&gt;, and set &lt;code&gt;limit&lt;/code&gt; to &lt;code&gt;10&lt;/code&gt;. This describes a setup you can try; it does not predict the people or number of matches you will receive.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select &lt;strong&gt;Run&lt;/strong&gt; on the template page.&lt;/li&gt;
&lt;li&gt;Enter your keywords or an existing people-search URL, then set &lt;code&gt;limit&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Run&lt;/strong&gt; to submit the task.&lt;/li&gt;
&lt;li&gt;Open the completed result and review the returned profiles against your criteria.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result limit defaults to 25 and accepts values from 1 to 2,500. It is the maximum number requested, not a promise that the search will find that many people. Increasing it will not fix an unclear target or make a keyword query behave like a precise title filter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Review Names, Current Roles, Employers, Locations and Source Links
&lt;/h3&gt;

&lt;p&gt;The result structure contains a &lt;code&gt;leads&lt;/code&gt; list, with one record per returned person. Read &lt;code&gt;full_name&lt;/code&gt;, &lt;code&gt;job_title&lt;/code&gt;, &lt;code&gt;company&lt;/code&gt; and &lt;code&gt;location&lt;/code&gt; together. Keep &lt;code&gt;linkedin_url&lt;/code&gt; and &lt;code&gt;profile_id&lt;/code&gt; so you can identify and revisit the person, and use the available &lt;code&gt;about&lt;/code&gt; text for context. Company identifiers or summaries can be missing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6v805evuud8rscmq7zqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6v805evuud8rscmq7zqy.png" alt="Process illustration separating profile collection from your review and research notes" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Process illustration. You review the fit and add the notes; these are not automatic qualification results.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A recognizable name or a relevant headline is not enough to accept a record. Check whether the role is current and whether the employer is the company you intended. If opening a profile brings up a login wall, the guide to &lt;a href="https://www.browseract.com/blog/view-linkedin-without-account?co-from=blog-Sales-Navigator-Lead-List-DEV" rel="noopener noreferrer"&gt;viewing LinkedIn profiles without an account&lt;/a&gt; explains what public information may be available and where visibility can stop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turn Search Results into a Reviewed Prospect List
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Keep Matching, Uncertain and Excluded Records Separate
&lt;/h3&gt;

&lt;p&gt;Add your own review columns next to the returned data. A practical set is role fit, company fit, location fit, decision, reason and next check. These are your working notes, not automatic qualification fields supplied by the template.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Review decision&lt;/th&gt;
&lt;th&gt;When to use it&lt;/th&gt;
&lt;th&gt;Next action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Matches research criteria&lt;/td&gt;
&lt;td&gt;The available evidence supports each must-have condition&lt;/td&gt;
&lt;td&gt;Retain the person for the next research step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Needs checking&lt;/td&gt;
&lt;td&gt;A required fact is missing, ambiguous or conflicting&lt;/td&gt;
&lt;td&gt;Record the exact fact to verify before accepting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exclude from this segment&lt;/td&gt;
&lt;td&gt;A known fact conflicts with a must-have condition&lt;/td&gt;
&lt;td&gt;Keep the reason so the same record is not repeatedly reviewed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Consider a hypothetical review for an in-house revenue operations audience. A Head of Revenue Operations at a confirmed target company, with the required person location, can stay for further research. A Revenue Operations Consultant at an agency would be excluded if agencies are outside the segment. The same relevant title with an unclear employer or missing location goes into the needs-checking group. The rule is to decide from the full set of required facts, not the title alone.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deduplicate by Profile Link or Identifier, Then Review Conflicts
&lt;/h3&gt;

&lt;p&gt;Before combining batches, compare &lt;code&gt;profile_id&lt;/code&gt; and &lt;code&gt;linkedin_url&lt;/code&gt;. If the same profile identifier appears with different links, retain those links as aliases while reviewing the repeated record. If identifiers disagree or only a name matches, check the profiles before merging. Count distinct people after resolving duplicates, rather than adding each batch's row count.&lt;/p&gt;

&lt;p&gt;If two records point to the same profile but show different employers, keep the conflict visible until you can check which information is current. A more recent collection date tells you when you obtained a value; it does not prove when the person updated their profile.&lt;/p&gt;

&lt;h3&gt;
  
  
  Save the Search Recipe, Source Link and Review Date
&lt;/h3&gt;

&lt;p&gt;Keep the keywords or search URL, the audience definition and your review date with the working list. This lets a teammate understand why the people were collected and what still needs checking. For another pass, change one search decision at a time so you can understand the difference in relevance.&lt;/p&gt;

&lt;p&gt;For example, if a keyword query mostly surfaces consultants when you want in-house operators, first review the wording and employer context. Do not respond only by requesting more rows. A larger list with the same mismatch creates more sorting work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decide What Each Accepted Record Needs Next
&lt;/h2&gt;

&lt;p&gt;Once a person matches your research criteria, decide what you need to learn next. That might be confirming responsibilities from a public professional source, reading the company's product pages, or checking whether there is an appropriate business contact route. Keep company research and person-level conclusions separate.&lt;/p&gt;

&lt;p&gt;This lead search returns profile information, not a guaranteed email address or phone number. If contact discovery is your next task, the guide to &lt;a href="https://www.browseract.com/blog/find-email-from-linkedin-without-login?co-from=blog-Sales-Navigator-Lead-List-DEV" rel="noopener noreferrer"&gt;finding available emails from LinkedIn profiles without logging in&lt;/a&gt; covers the separate lookup and the checks to make before relying on an address.&lt;/p&gt;

&lt;p&gt;Start with one narrow query, review the results, and decide which people deserve further research. That is the useful role of a no-login LinkedIn Sales Navigator scraper in this process: collecting profiles you can assess against a clear audience definition.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.browseract.com/template/linkedin-sales-navigator-lead-scraper?co-from=blog-Sales-Navigator-Lead-List-DEV" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwba9queq9d3qxtvf50xr.png" alt="Build a prospect list you can review. Run the Lead Search with keywords or an available people-search URL" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I Use a Sales Navigator Scraper Without Connecting My LinkedIn Account?
&lt;/h3&gt;

&lt;p&gt;BrowserAct's no-login LinkedIn Sales Navigator Lead Scraper does not require your own LinkedIn login or cookies. You still need access to BrowserAct, and usage charges apply. This concerns the collection step; creating a search inside Sales Navigator is a separate task that requires access to that service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I Need a Sales Navigator Search URL to Start?
&lt;/h3&gt;

&lt;p&gt;No. You can start with the template's &lt;code&gt;keywords&lt;/code&gt; input, optionally adding a first or last name. An existing Sales Navigator people-search URL is another input route. Keyword matching does not provide the same control as separate job-title, employer and location filters, so review those attributes yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I Enter Job Title, Company and Location as Separate Filters?
&lt;/h3&gt;

&lt;p&gt;The current template inputs are &lt;code&gt;url&lt;/code&gt;, &lt;code&gt;keywords&lt;/code&gt;, &lt;code&gt;first_name&lt;/code&gt;, &lt;code&gt;last_name&lt;/code&gt; and &lt;code&gt;limit&lt;/code&gt;. Separate job-title, company and location inputs are not included. Use a supported query route and check those criteria in the results. When you supply &lt;code&gt;url&lt;/code&gt;, other search filters are ignored except &lt;code&gt;limit&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Did the Search Return Fewer Profiles Than My Limit?
&lt;/h3&gt;

&lt;p&gt;The limit is a maximum, not a guaranteed result count. Matching records or source information may be unavailable. Review the query and any task messages before changing it. A completed search with fewer matches is different from a failed task; neither should be turned into an assumed full list.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does a Returned Lead Record Include an Email Address?
&lt;/h3&gt;

&lt;p&gt;This template's output describes names, professional roles, employers, locations, profile links, identifiers and available summaries. It does not include a dedicated email or phone field. Treat contact lookup as a separate step, and check that any address you find belongs with the right person and your intended purpose.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>software</category>
      <category>tools</category>
      <category>webscraping</category>
    </item>
    <item>
      <title>How to Find Email from LinkedIn Without Logging In</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Fri, 13 Nov 2026 09:03:42 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/how-to-find-email-from-linkedin-without-logging-in-49fc</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/how-to-find-email-from-linkedin-without-logging-in-49fc</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3952csm2vdjx48b80um6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3952csm2vdjx48b80um6.png" alt="How to Find Email from LinkedIn Without Logging In" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You have a prospect's LinkedIn profile URL and a reason to contact them, but no work email. You can try to find email from LinkedIn without logging in by checking public business contact sources or using a service that accepts a profile URL. Either route may return no address. The profile helps identify the person; it does not give you access to their private LinkedIn login email.&lt;/p&gt;

&lt;p&gt;BrowserAct's no-login profile and email template offers the URL-based route: enter the profiles you want to research, click &lt;strong&gt;Run&lt;/strong&gt;, and review the available profile details and email results together. You need access to BrowserAct, but you do not need to supply your own LinkedIn account or cookies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Use the profile to confirm the right person and current employer before looking for an address.&lt;/li&gt;
&lt;li&gt;Check public business contact sources first; a LinkedIn profile URL can also be an input to an email lookup without your own LinkedIn login.&lt;/li&gt;
&lt;li&gt;A found email still needs an identity, company and verification check; a status label is not a delivery guarantee.&lt;/li&gt;
&lt;li&gt;Keep missing or uncertain results separate and use an appropriate public contact route rather than guessing an address or sending automatically.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Can You Find Someone's Email Without Connecting on LinkedIn?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What LinkedIn Email Visibility Actually Tells You
&lt;/h3&gt;

&lt;p&gt;Sometimes you can find a work email without being connected, particularly when the person or their company has published it elsewhere. That is different from seeing the email registered to their LinkedIn account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/help/linkedin/answer/a523134/visibility-of-your-email-address-on-linkedin" rel="noopener noreferrer"&gt;LinkedIn's email-visibility guidance&lt;/a&gt; explains that the registered primary email is visible to direct connections by default, with additional rules for email contacts and connected services. Members can change that setting. Being connected therefore does not guarantee visibility, and a public profile does not guarantee a public email address.&lt;/p&gt;

&lt;p&gt;A LinkedIn email finder may use a profile URL to search for an available contact address. Do not assume that an address returned by a separate service is the person's LinkedIn sign-in email or that it is suitable for business outreach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choose a Route Based on the Information You Already Have
&lt;/h3&gt;

&lt;p&gt;Start with your strongest identifying information. If you need help checking a profile while signed out, follow the guide to &lt;a href="https://www.browseract.com/blog/view-linkedin-without-account?co-from=blog-Find-Email-From-LinkedIn-DEV" rel="noopener noreferrer"&gt;viewing LinkedIn profiles without an account&lt;/a&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What you have&lt;/th&gt;
&lt;th&gt;Useful next step&lt;/th&gt;
&lt;th&gt;Before you rely on it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A work address published by the person or company&lt;/td&gt;
&lt;td&gt;Read the surrounding contact instructions&lt;/td&gt;
&lt;td&gt;Is it current and intended for your purpose?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A profile URL belonging to the right person&lt;/td&gt;
&lt;td&gt;Try a profile-URL lookup&lt;/td&gt;
&lt;td&gt;Does the returned person and employer match?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A name and current employer&lt;/td&gt;
&lt;td&gt;Check the official company site and public professional pages&lt;/td&gt;
&lt;td&gt;Could the result belong to someone else?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Conflicting identity or company information&lt;/td&gt;
&lt;td&gt;Resolve the mismatch first&lt;/td&gt;
&lt;td&gt;An email result alone will not settle it&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No-login lookup does not unlock private profile information. Some details or email addresses may be unavailable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check Public Work Contact Sources
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Confirm the Person's Current Company and Its Official Website
&lt;/h3&gt;

&lt;p&gt;Use the profile's available experience information, then cross-check it against a current company page or another public professional source. A headline may describe someone's specialty, several roles, or a previous position. It is not enough on its own to confirm their employer.&lt;/p&gt;

&lt;p&gt;Visit the company's official website and check the domain. A familiar brand name in a search result can lead to a reseller, an old company site, or an unrelated business with the same name. Match the organization before attaching an address to the person.&lt;/p&gt;

&lt;h3&gt;
  
  
  Look for a Relevant Address or Contact Route on Public Pages
&lt;/h3&gt;

&lt;p&gt;Check the company team page, a published author or speaker biography, and any professional website the person links to. Look for an address explicitly associated with the person and the type of inquiry you want to make.&lt;/p&gt;

&lt;p&gt;Read the context around the address. A press contact is intended for media inquiries; a support mailbox serves customers. A general company address can be a useful way to ask for the right contact, but it should stay labeled as a company channel rather than the person's direct email.&lt;/p&gt;

&lt;p&gt;Save the page URL and the date you checked it. If the page refers to an old employer, keep that discrepancy visible instead of assuming the address is still current. When these sources do not provide a suitable address, a profile-URL lookup is another option.&lt;/p&gt;

&lt;h2&gt;
  
  
  Look Up Available Emails from Profile URLs with BrowserAct
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prepare the Profile URLs
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://www.browseract.com/template/linkedin-profile--email-scraper?co-from=blog-Find-Email-From-LinkedIn-DEV" rel="noopener noreferrer"&gt;LinkedIn Profile Email Scraper&lt;/a&gt; accepts one or more profile URLs in the required &lt;code&gt;profile_urls&lt;/code&gt; input. Separate them with new lines or commas. Start with a profile whose identity you can check, then inspect the result before processing a longer list.&lt;/p&gt;

&lt;p&gt;Use links to individual profiles. A name, company homepage, or LinkedIn search-results page is not a substitute for the profile URLs this input requires. Remove duplicate entries from your working list so that you can review each person once.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the No-Login Profile and Email Template
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the template in BrowserAct and select &lt;strong&gt;Run&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter your profile URLs in &lt;code&gt;profile_urls&lt;/code&gt;, one per line or separated by commas.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Run&lt;/strong&gt; to submit the task.&lt;/li&gt;
&lt;li&gt;Open the completed result. Use &lt;strong&gt;Input &amp;amp; Output&lt;/strong&gt; on the template page to review field definitions and examples.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You do not need to paste LinkedIn cookies or connect your own LinkedIn account for this template. BrowserAct access and its usage charges still apply; check the template's &lt;strong&gt;Pricing&lt;/strong&gt; tab before running your list. Submitting a task starts the lookup rather than guaranteeing an immediate or complete result.&lt;/p&gt;

&lt;h3&gt;
  
  
  Read the Returned Profile and Email Data Together
&lt;/h3&gt;

&lt;p&gt;Each returned person has a record containing available profile information and any email results found. Review the name, profile link and professional history alongside the contact data. This context helps you check whether an address belongs with the person you intended to research.&lt;/p&gt;

&lt;p&gt;Email results can include returned checking indicators, such as status, deliverability, catch-all information or a quality score. Read the fields actually present in your result. They describe the returned checks; they do not guarantee delivery or establish the recipient's permission to receive a message.&lt;/p&gt;

&lt;p&gt;Some fields can be empty or &lt;code&gt;null&lt;/code&gt;. The template also describes email and career sections as JSON text, so a cell may contain a nested list rather than one short value. Several addresses within one person's record should not be counted as several different people.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg96bq6j2xyd2vdevwc30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg96bq6j2xyd2vdevwc30.png" alt="Decision illustration for an address returned, uncertain email checks or no email found" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Decision illustration, not a task result. Use the fields and checking information actually returned.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Check an Email Before You Add It to a Contact List
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Match the Address to the Person and Current Employer
&lt;/h3&gt;

&lt;p&gt;A plausible address is a starting point for review. Check that the returned name and profile URL match your target, then compare the employer information with the organization behind the email domain. If they disagree, investigate the mismatch before adding the address to an outreach list.&lt;/p&gt;

&lt;p&gt;An address may be personal, associated with a previous employer, or a shared company mailbox. Keep that distinction in your record. For a business inquiry, choose a channel relevant to the person's work and the purpose of your message.&lt;/p&gt;

&lt;h3&gt;
  
  
  Separate Confirmed, Uncertain and Missing Results
&lt;/h3&gt;

&lt;p&gt;Use the result to decide what needs attention next. The following are review categories you can apply to your own contact list, rather than a fixed set of BrowserAct output labels.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What you observe&lt;/th&gt;
&lt;th&gt;What it establishes&lt;/th&gt;
&lt;th&gt;Next action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;An address, a matching person/company and a favorable checking result&lt;/td&gt;
&lt;td&gt;There is a supported contact candidate&lt;/td&gt;
&lt;td&gt;Record the source and check date; assess whether contact is appropriate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Catch-all or accept-all information&lt;/td&gt;
&lt;td&gt;The domain response does not confirm the specific mailbox&lt;/td&gt;
&lt;td&gt;Keep the address in a separate review group&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unknown status or no checking information&lt;/td&gt;
&lt;td&gt;Validity is unresolved&lt;/td&gt;
&lt;td&gt;Obtain further confirmation before using it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An invalid result&lt;/td&gt;
&lt;td&gt;The address did not pass the reported check&lt;/td&gt;
&lt;td&gt;Leave it out of the sending list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No email returned&lt;/td&gt;
&lt;td&gt;The lookup has not provided an address&lt;/td&gt;
&lt;td&gt;Keep the profile record and consider another contact route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An employer or domain mismatch&lt;/td&gt;
&lt;td&gt;The address may not fit the current professional context&lt;/td&gt;
&lt;td&gt;Cross-check the company and source before proceeding&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For general verification terminology, Hunter's &lt;a href="https://help.hunter.io/en/articles/6103281-what-are-the-possible-verification-statuses-for-an-email" rel="noopener noreferrer"&gt;status explanations&lt;/a&gt; distinguish catch-all domains from confirmed mailboxes and describe unknown results as unresolved. Use each provider's own definitions when interpreting its checks; these terms do not imply that BrowserAct uses Hunter.&lt;/p&gt;

&lt;p&gt;If an address was checked some time ago, review it again before relying on it. Hunter's &lt;a href="https://help.hunter.io/en/articles/15899247-email-verification-faqs" rel="noopener noreferrer"&gt;verification FAQ&lt;/a&gt; notes that mailbox status can change after verification. A favorable result is useful evidence at a point in time, not a promise about a future message.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Do When No Email Is Found
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Keep the Missing Result and Use a Public Business Contact Route
&lt;/h3&gt;

&lt;p&gt;An empty email field means the result has not supplied an address. It does not prove that the person has no work email, and it is not a reason to fill the gap with a guessed address.&lt;/p&gt;

&lt;p&gt;For a concrete reading example, the template page shows a historical profile result with this email value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"emails"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For that historical record, keep the available profile details, leave the email field blank and mark the next action as checking a public business contact route. A returned profile gives you research context even when it has not supplied an address. This example shows how to handle a missing result, not a successful email discovery.&lt;/p&gt;

&lt;p&gt;Check the person's current public professional contact page or the company's relevant contact form. You can ask for the appropriate business channel there. If you already have another suitable way to speak with the person, ask which address they prefer for the conversation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Save the Source, Check Date and Next Action
&lt;/h3&gt;

&lt;p&gt;Keep the profile URL, confirmed company, address if available, returned checking information, source, check date and next action together. These are suggested review columns for your working contact list. Keeping an unresolved row is useful: it stops someone else on the team from treating the same person as ready to email.&lt;/p&gt;

&lt;p&gt;For a separate workflow using your own logged-in LinkedIn Bot and an AI client, see the guide to &lt;a href="https://www.browseract.com/blog/linkedin-profile-data-mcp-contact-research?co-from=blog-Find-Email-From-LinkedIn-DEV" rel="noopener noreferrer"&gt;organizing LinkedIn contact research with MCP&lt;/a&gt;. That guide has its own login requirements. To carry out the no-login profile-URL lookup described here, use the template steps above.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.browseract.com/template/linkedin-profile--email-scraper?co-from=blog-Find-Email-From-LinkedIn-DEV" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzke8n2dg7lczsjnaxbst.png" alt="Run the Profile and Email Template to look up available contact data with profile context" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I Find a Work Email from a LinkedIn Profile Without Connecting?
&lt;/h3&gt;

&lt;p&gt;Sometimes. A person or their company may publish a work address, and a service accepting profile URLs may find an available contact email. Being unconnected does not rule out those routes, but neither a public profile nor a lookup guarantees an address. Confirm the person's current employer and the address's business relevance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I Need a LinkedIn Account or Cookies to Use the BrowserAct Template?
&lt;/h3&gt;

&lt;p&gt;You do not need to supply your own LinkedIn account or cookies for the LinkedIn Profile Email Scraper (No Login). You still need access to BrowserAct and must meet its usage conditions. Enter the required profile URLs, run the task and review what it returns.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I Look Up Emails from Several LinkedIn Profile URLs?
&lt;/h3&gt;

&lt;p&gt;Yes. The template accepts multiple profile URLs in &lt;code&gt;profile_urls&lt;/code&gt;, separated by new lines or commas. Check the input requirements and Pricing tab before submitting your list. Multiple inputs do not mean that every profile will return an email.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Does a Catch-All or Unknown Email Result Mean?
&lt;/h3&gt;

&lt;p&gt;In common verification terminology, catch-all or accept-all means the domain accepts addresses without confirming that the specific mailbox exists. Unknown means validity has not been determined. Read the checking provider's definitions and keep uncertain addresses separate until you have enough evidence to use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is a Found Email Guaranteed to Be Delivered?
&lt;/h3&gt;

&lt;p&gt;No. Finding an address and checking it do not guarantee future delivery. The mailbox or its settings can change, and the address may no longer fit the person's current role. Review identity, company, checking information and your reason for contact before sending.&lt;/p&gt;

&lt;p&gt;To find email from LinkedIn, begin with one correctly matched profile and choose a method that fits what you already know. Keep useful profile context, inspect any available address, and leave uncertain records out of automatic sending.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Represent one combined receipt as one artifact with several coverage links</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 19:42:45 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/represent-one-combined-receipt-as-one-artifact-with-several-coverage-links-688</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/represent-one-combined-receipt-as-one-artifact-with-several-coverage-links-688</guid>
      <description>&lt;p&gt;One downloaded PDF can cover several advertising charges. If a collector increments its completed-file counter once for every covered transaction, a single combined receipt suddenly looks like three individual receipt files. The transaction coverage may be useful, but the archive has claimed a document shape it never received.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our Meta Ads guide makes this a concrete implementation question: how should a collection service represent one artifact linked to multiple charges? This article builds an application-side acceptance function with fictional records and local synthetic checks. It does not access Meta, parse actual receipts, download files or test a BrowserAct Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the output type part of the requirement
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.browseract.com/blog/download-meta-ads-receipts?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Meta Ads source guide&lt;/a&gt;, based on Meta help checked November 9, separates an individual transaction receipt, a single PDF receipt covering transactions in a selected range, and billing reports in PDF or CSV. The documented Download all transactions option produces one receipt; it is not a ZIP of separate charge receipts.&lt;/p&gt;

&lt;p&gt;That distinction belongs in the job contract before retrieval. A finance team might accept a combined receipt for a group of charges. Another request may require each charge's individual document. A report with several rows should not silently satisfy either receipt requirement merely because it contains matching amounts.&lt;/p&gt;

&lt;p&gt;The guide also describes searching by the charge reference number found on a card statement. Use reviewed account and reference identity when connecting a receipt to a requested charge. Several equal amounts are not evidence that two records describe the same transaction. Monthly invoicing and unrelated Meta purchases remain separate routes, outside this example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model coverage as links, not duplicated files
&lt;/h2&gt;

&lt;p&gt;The request below contains an internal ad-account reference, an explicit nonempty list of charge references and a reviewed evidence policy. The artifact describes one physical file plus its independently reviewed charge coverage. All field names are our application contract, not Meta API response fields or guaranteed page selectors.&lt;/p&gt;

&lt;p&gt;An artifact receipt identifies a previously verified retained file. The same receipt reference can appear on several charge links without implying multiple stored files. Keep the original document intact. Splitting pages or copying a combined PDF into differently named files does not create supplier-issued individual receipts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;assess_receipt_coverage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;refs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ad_account_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;wanted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"charge_refs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;refs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wanted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_request"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"evidence_policy"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"one_file_per_charge"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"combined_receipt_allowed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_policy"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ad_account_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_account"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"individual_receipt_pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"combined_receipt_pdf"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_document_kind"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;covered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"covered_charge_refs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;refs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;covered&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_coverage"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"individual_receipt_pdf"&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;covered&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_cardinality"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"combined_receipt_pdf"&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"one_file_per_charge"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"needs_individual_receipts"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;covered&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wanted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_coverage"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;receipt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"artifact_receipt_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"coverage_reviewed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"file_verified"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_artifact_evidence"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ready_for_finance_review"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"physical_file_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"covered_charge_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;covered&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"links"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"charge_ref"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"artifact_receipt_ref"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;wanted&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The success status deliberately stops at finance review. It neither posts expenses nor declares charges reconciled. The function preserves requested order in its links while comparing coverage as a set. Reference spelling is exact and case-sensitive; any normalization belongs in a reviewed upstream adapter. Blank and repeated references are rejected instead of being silently removed.&lt;/p&gt;

&lt;p&gt;A combined receipt remains a combined receipt even if it covers only one charge. Under the strict individual-file policy it still needs the requested document type. That explicit rule avoids guessing from transaction count and makes a change of finance policy visible rather than hiding it in an exporter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test document shape and scope independently
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Supplied artifact&lt;/th&gt;
&lt;th&gt;Request policy or scope&lt;/th&gt;
&lt;th&gt;Expected result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One combined receipt covering three requested charges&lt;/td&gt;
&lt;td&gt;Combined receipt allowed&lt;/td&gt;
&lt;td&gt;One file, three coverage links, ready for review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The same combined receipt&lt;/td&gt;
&lt;td&gt;One file per charge&lt;/td&gt;
&lt;td&gt;Request individual receipts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One individual receipt claiming two covered charges&lt;/td&gt;
&lt;td&gt;Either policy&lt;/td&gt;
&lt;td&gt;Review cardinality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Billing report PDF or CSV with matching charges&lt;/td&gt;
&lt;td&gt;Either receipt policy&lt;/td&gt;
&lt;td&gt;Review document kind&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Receipt for another ad account&lt;/td&gt;
&lt;td&gt;Matching charge text&lt;/td&gt;
&lt;td&gt;Review account&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing, extra or duplicated covered references&lt;/td&gt;
&lt;td&gt;Otherwise valid metadata&lt;/td&gt;
&lt;td&gt;Review coverage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Coverage matches but file evidence is unverified&lt;/td&gt;
&lt;td&gt;Either policy&lt;/td&gt;
&lt;td&gt;Review artifact evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The local checks also cover reordered references, missing account identity, unsupported policies, whitespace-only receipt references and strict boolean handling. A string such as "true" does not count as a reviewed boolean. For a valid three-charge combined fixture, assertions require exactly one physical file and three links to the same artifact receipt.&lt;/p&gt;

&lt;p&gt;These checks exercise control flow over synthetic dictionaries. They do not establish that a real document contains the listed references. The coverage_reviewed and file_verified flags are a trust boundary: production ingestion must verify the retained file, inspect its document type and coverage, and bind that evidence to the supplied artifact receipt. This function does not authenticate a supplier or prevent a caller from inventing trusted flags.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep coverage evidence separate from delivery and accounting
&lt;/h2&gt;

&lt;p&gt;This finite request names specific charge references. Even exact coverage does not prove that a whole month is complete; discovery of all expected charges is another task. Nor does the example check dates, amounts, currency, refunds or tax treatment. Those require appropriate document inspection and finance review, with their own evidence.&lt;/p&gt;

&lt;p&gt;Persist the artifact once, then store its coverage links and review record transactionally. A production system needs uniqueness constraints and access controls across account, document and review identities. The pure function does not supply database atomicity, idempotent writes or concurrency protection. Replaying it must not itself create another expense or another physical-file count.&lt;/p&gt;

&lt;p&gt;For a future BrowserAct collector, the acceptance test would require authorized account selection, a verified reference match, the requested native output, actual retained-file verification and an auditable handoff. No account or advertising configuration was changed for this article. The useful design boundary is smaller and testable: count physical artifacts separately from the transactions they cover, and let finance choose which evidence shape satisfies the request.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Keep localized invoice filenames outside the archive key</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 18:36:42 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/keep-localized-invoice-filenames-outside-the-archive-key-mig</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/keep-localized-invoice-filenames-outside-the-archive-key-mig</guid>
      <description>&lt;p&gt;A downloaded invoice can have a different filename after an account language change. Consider a design scenario: a collector accepts only invoice-prefixed PDFs, so a valid document with a localized name becomes a missing item. A second download in English then looks like a separate expense. The archive has let a presentation detail define document identity.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our Canva guide suggested an implementation worth isolating: preserve the supplier filename for traceability, but keep it outside the archive key. The example below plans an internal storage key and hashes supplied bytes. Local checks use fictional metadata and deliberately synthetic byte strings, not actual invoices or valid PDF fixtures. No Canva account, API, download or Bot is tested here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why filename rules are the wrong collection boundary
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.browseract.com/blog/download-canva-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Canva source guide&lt;/a&gt;, based on help checked November 9, notes that downloaded invoice filenames follow the user's language setting. It also separates the purchase email, active team and billing channel. A member's own purchase history and a team-wide invoice view are different scopes.&lt;/p&gt;

&lt;p&gt;Website purchases use the documented Orders and invoices route. App Store or Google Play purchases need the respective store's document route. An English-looking PDF cannot resolve any of these distinctions. Nor does a localized name prove that the file belongs to the correct purchase.&lt;/p&gt;

&lt;p&gt;The same guide says invoice copies can arrive by email. Browser downloads and email delivery may therefore yield two observations of the same document. Retaining both delivery observations is useful; treating each filename as another invoice is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate three values in the archive record
&lt;/h2&gt;

&lt;p&gt;Keep a reviewed document identity, the original filename and a content digest. In this application design the identity contains a stable purchase-account reference, team reference and invoice ID, plus the issuer route. Those are internal contract fields, not a Canva API schema or a claim that the same hierarchy fits every seller.&lt;/p&gt;

&lt;p&gt;The adapter must resolve and review those references before planning storage. A display name, design URL or company email domain is not a stable account identifier. Preserve the exact identifier spelling; the function does not trim or case-fold invoice IDs, even though it rejects empty or whitespace-only values.&lt;/p&gt;

&lt;p&gt;The filename stays as metadata exactly as observed. It is never interpolated into a path. The output path uses fixed text and hexadecimal digests, so a localized name, slash or traversal-like string cannot choose a directory through this function. That is a naming property, not a complete secure-storage implementation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;plan_invoice_archive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;identity_fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"purchase_account_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"team_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"invoice_id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;identity_fields&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_identity"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"purchase_channel"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"canva_website"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_billing_channel"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"document_kind"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"invoice_pdf"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_document_kind"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"document_match_reviewed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"review_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_document_match"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"original_filename"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_filename_metadata"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;bytes&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"review_payload"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;identity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;identity_fields&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"issuer_route"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"canva_website"&lt;/span&gt;
    &lt;span class="n"&gt;identity_bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sort_keys&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ensure_ascii&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                &lt;span class="n"&gt;separators&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;","&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;":"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;identity_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;identity_bytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;content_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"planned_only"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"relative_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"canva/{identity_key}/{content_key}.pdf"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"identity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"original_filename"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"original_filename"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;content_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"bytes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"review_ref"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"review_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The review flag and reference are an upstream trust boundary. This function does not inspect PDF syntax, authenticate a supplier document, extract the invoice ID, check permissions or confirm that the bytes match the metadata. Production ingestion must perform those checks and retain the review evidence. Giving arbitrary bytes a .pdf suffix does not make them a PDF.&lt;/p&gt;

&lt;p&gt;Likewise, the digest identifies byte content; it does not establish the financial meaning of those bytes. Two PDFs can represent one invoice while differing in rendering or metadata. Changed bytes produce another content version under the same identity directory, not an automatically new payable item.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make invariants visible in the tests
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Change in the input&lt;/th&gt;
&lt;th&gt;Expected plan&lt;/th&gt;
&lt;th&gt;Interpretation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Filename language changes, identity and bytes stay equal&lt;/td&gt;
&lt;td&gt;Same relative key&lt;/td&gt;
&lt;td&gt;Filename is presentation metadata&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Only the original filename contains path separators&lt;/td&gt;
&lt;td&gt;Same relative key&lt;/td&gt;
&lt;td&gt;Raw filename never chooses storage location&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same invoice ID belongs to another team&lt;/td&gt;
&lt;td&gt;Different identity directory&lt;/td&gt;
&lt;td&gt;Team context remains part of identity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same identity has different bytes&lt;/td&gt;
&lt;td&gt;Different content key in the same directory&lt;/td&gt;
&lt;td&gt;Preserve a candidate version for review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Purchase channel is a mobile store&lt;/td&gt;
&lt;td&gt;Review billing channel&lt;/td&gt;
&lt;td&gt;Do not file it under the website issuer route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Identity, match review or payload is missing&lt;/td&gt;
&lt;td&gt;Review the specific boundary&lt;/td&gt;
&lt;td&gt;No successful archive claim&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The synthetic checks exercise these properties with English, Turkish, Chinese, accented and path-like names, plus wrong channels, missing fields, strict boolean handling and empty or non-bytes payloads. Hashing those synthetic bytes is a real local computation. It is not PDF parsing, supplier authentication or an account download benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  A storage plan is still not a saved document
&lt;/h2&gt;

&lt;p&gt;A storage worker must write the retained bytes, verify the resulting object and commit an artifact receipt. Use an atomic or conditional create operation, scoped access controls and a manifest transaction suitable for the storage system. This pure function neither writes files nor protects against filesystem symlinks, concurrent writers or an incorrect storage-root configuration.&lt;/p&gt;

&lt;p&gt;If the key already exists, compare the retained object's digest before linking another delivery observation. Do not overwrite an existing object based only on the original filename. Also do not suppress a second observation merely because its bytes match: the delivery record can explain when the same invoice was recovered from email or the browser.&lt;/p&gt;

&lt;p&gt;For BrowserAct or another collector, a Canva-specific adapter would still need authorized purchaser and team selection, correct invoice matching, real PDF delivery and independent archive verification. Keeping localized filenames outside the key gives that future test a precise invariant while preserving the source name and original bytes for the reviewer.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Suspend an invoice retry until its access blocker has actually changed</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 18:02:44 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/suspend-an-invoice-retry-until-its-access-blocker-has-actually-changed-3e6</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/suspend-an-invoice-retry-until-its-access-blocker-has-actually-changed-3e6</guid>
      <description>&lt;p&gt;A missing Billing menu and a failed PDF download should not share one retry instruction. In a design scenario, an invoice collector runs hourly under an account that cannot reach billing. Repeating the download job changes neither the actor nor the available controls. It only creates a longer log of the same unresolved access condition.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our ActiveCampaign invoice guide suggested a concrete scheduler boundary: suspend access failures until a reviewed access change, while keeping a small retry budget for a specific failed document download. This article implements that decision as a pure Python function with fictional records. It does not test an ActiveCampaign account, API, invoice PDF or portal Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Record the failure at the right boundary
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.browseract.com/blog/download-activecampaign-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;ActiveCampaign source guide&lt;/a&gt; follows official help checked November 9. It notes conflicting access wording: the introduction mentions purchase permissions, while the Take note section limits Billing &amp;amp; Upgrade to the Primary Account Admin or Account Owner and excludes ordinary Admin-group users. The guide starts conservatively with the owner; it does not promise that any administrator can enter billing.&lt;/p&gt;

&lt;p&gt;The documented Invoices list has separate View and Download actions. Download saves a PDF, while viewing a document does not establish delivery. The reviewed help also says invoices cannot be emailed through that supplier option. A scheduler should not invent an email fallback or a bulk ZIP to resolve a blocked account.&lt;/p&gt;

&lt;p&gt;Capture one of three failure reasons: billing access, a requested record not found in the reviewed scope, or a selected document whose download failed. Store the account and order reference with the reason. Changing the invoice date cannot repair a missing billing menu, and repeating all historical downloads cannot establish the right account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resume from evidence, not elapsed time
&lt;/h2&gt;

&lt;p&gt;A suspended access job keeps the reviewed access observation that caused the block. A later observation may support resumption only after an authorized reviewer confirms a material change and the billing controls are visible in the same account and actor context. A different screenshot identifier alone does not constitute such a change.&lt;/p&gt;

&lt;p&gt;The following fields are our application's contract. They are not ActiveCampaign permission names, API response fields or a mechanism for granting access. collection_authorized represents an upstream authorization decision for this exact collection context. The function cannot make or verify that decision itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;next_invoice_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;identity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"account_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"actor_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_job"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"account_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"actor_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_context"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"collection_authorized"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_authorization"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_observation"&lt;/span&gt;
    &lt;span class="n"&gt;failure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"failure"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;failure&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"billing_access"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"blocked_access_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"access_review_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;changed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"access_change_reviewed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;old&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;changed&lt;/span&gt; \
                &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"billing_visible"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"reinspect_exact_invoice"&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"wait_for_access_review"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;failure&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"record_not_found"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_requested_scope"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;failure&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"download_failed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_failure_kind"&lt;/span&gt;
    &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"download_attempts"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_attempt_counter"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_delivery_failure"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"billing_visible"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"wait_for_access_review"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"row_order_id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_selected_invoice"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"download_available"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_download_control"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"retry_exact_download"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even after an access change, the output is reinspect_exact_invoice. It does not immediately retry a download from an old row selection. The worker must observe the intended order again and create a fresh document attempt under the current account context.&lt;/p&gt;

&lt;p&gt;If collection moves to the owner instead of the original actor, create an appropriately authorized job or explicitly review its reassignment. Do not copy an owner's credentials into the old worker, change account ownership or add privileges to make the check pass. A handoff can contain internal account and order references plus the required deliverable; it does not need passwords or full financial documents in scheduler logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give download attempts their own budget
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure or observation&lt;/th&gt;
&lt;th&gt;Next action&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Billing still unavailable&lt;/td&gt;
&lt;td&gt;wait_for_access_review&lt;/td&gt;
&lt;td&gt;Repeating file selection cannot repair access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reviewed access change in the same context&lt;/td&gt;
&lt;td&gt;reinspect_exact_invoice&lt;/td&gt;
&lt;td&gt;Old selection may no longer be valid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Requested order not found&lt;/td&gt;
&lt;td&gt;review_requested_scope&lt;/td&gt;
&lt;td&gt;Account, filters and period need review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Known order, visible Download, budget remains&lt;/td&gt;
&lt;td&gt;retry_exact_download&lt;/td&gt;
&lt;td&gt;Retry only the unresolved delivery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two download attempts already recorded&lt;/td&gt;
&lt;td&gt;review_delivery_failure&lt;/td&gt;
&lt;td&gt;Stop automatic repeat work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Actor, account or selected order differs&lt;/td&gt;
&lt;td&gt;Review the specific mismatch&lt;/td&gt;
&lt;td&gt;Avoid collecting another account's document&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two attempts is an example application budget, not an ActiveCampaign limit. Persist the counter before dispatching an attempt, and use a transaction or lease so two workers cannot independently consume the same remaining allowance. This function only chooses a plan from a snapshot; it neither updates the counter nor serializes workers.&lt;/p&gt;

&lt;p&gt;The strict integer check rejects booleans as attempt counters, even though Python treats bool as a subclass of int. Strict boolean checks also avoid accepting strings such as true as authorization, visibility or download availability. These are small contract checks, not substitutes for verifying the underlying evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the pause and the narrow resume
&lt;/h2&gt;

&lt;p&gt;Local synthetic checks cover unchanged access observations, unreviewed changes, a new reviewed access observation, another actor or account, missing authorization, missing evidence, a wrong order, a missing download control and exhausted or malformed attempt counters. They exercise only routing. No supplier page, actual permission state or real document is used.&lt;/p&gt;

&lt;p&gt;A production runner should keep the original blocked reason and append the observation that justified resumption. Store a separate artifact receipt only after the intended PDF arrives and its identifiers are checked. Neither retry_exact_download nor a successful View action closes the invoice request, and portal payment status does not prove a bank settlement.&lt;/p&gt;

&lt;p&gt;For BrowserAct or another browser-assisted worker, the next useful test is the authorized account-specific adapter and its document delivery. The scheduler design keeps those responsibilities explicit: access waits for a reviewed change, missing records go to scope review, and a failed download gets a bounded retry for the exact order rather than another sweep of the whole account.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Keep an invoice lookup alive when the billing summary becomes an estimate</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 17:27:30 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/keep-an-invoice-lookup-alive-when-the-billing-summary-becomes-an-estimate-3mdm</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/keep-an-invoice-lookup-alive-when-the-billing-summary-becomes-an-estimate-3mdm</guid>
      <description>&lt;p&gt;An archive lookup should survive a dashboard changing its summary. Consider a design scenario: a worker can retrieve the latest Enterprise invoice, but after payment the Overview card shows an estimate instead. A selector waiting for the old heading fails. If the job converts that failure into “no invoice,” it has confused a page state with document history.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. While adapting our GitHub billing guide, this transition suggested a useful developer example: an explicit lookup plan that distinguishes summary states from historical evidence. The Python below is an application-side contract tested on fictional observations. It does not access GitHub billing, call an API, make a payment, retrieve a real invoice or validate a GitHub Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  An estimate is a routing signal
&lt;/h2&gt;

&lt;p&gt;Our &lt;a href="https://www.browseract.com/blog/download-github-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;GitHub source guide&lt;/a&gt; follows official instructions checked on November 9. For invoiced Enterprise customers, Overview can expose Latest invoice and View invoice. When all invoices are paid, GitHub describes the section changing to Estimated next payment. Historical documents remain a separate Past invoices route, using the invoice reference.&lt;/p&gt;

&lt;p&gt;Personal and organization Payment history have their own available receipt or invoice controls. Azure-connected billing and Enterprise Server without the corresponding GitHub.com account also require separate context. This example deliberately handles only a known invoice reference for an invoiced Enterprise account. It does not use a repository URL, paid seat or personal receipt to infer that context.&lt;/p&gt;

&lt;p&gt;The operational implication is small but important: when the summary becomes an estimate, plan another read of Past invoices. Do not click a payment control, edit billing information or request a new arrangement just to make the previous summary appear again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model observations rather than CSS failures
&lt;/h2&gt;

&lt;p&gt;The request contains a reviewed enterprise reference, billing model and known invoice reference. The view contains independently observed account context, surface, heading and evidence reference. The names in this contract are ours, not GitHub API fields or promised DOM attributes. A separately tested adapter must derive them from the actual authorized page.&lt;/p&gt;

&lt;p&gt;Use stable internal account references rather than display names. An administrator can manage several enterprises while also owning a personal plan. Matching an amount or seeing a familiar avatar does not establish the charge owner. Unknown account scope goes to review before any document action is planned.&lt;/p&gt;

&lt;p&gt;The function returns action names, not URLs, browser clicks or completion flags. That makes the estimate transition testable without putting credentials or billing links into the example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;plan_invoice_lookup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;required&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"enterprise_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"invoice_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;required&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_request"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"billing_model"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"invoiced_enterprise"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_billing_route"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"enterprise_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"enterprise_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_account_scope"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_observation"&lt;/span&gt;
    &lt;span class="n"&gt;surface&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"surface"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;surface&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"overview"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"heading"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"estimated_next_payment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"inspect_past_invoices"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"heading"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"latest_invoice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_page_state"&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;surface&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"past_invoices"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_billing_route"&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"rows"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_observation"&lt;/span&gt;
    &lt;span class="n"&gt;matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"invoice_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"invoice_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_ambiguous_reference"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"document_kind"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"invoice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_document_kind"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"download_available"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"review_download_control"&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"open_latest_invoice"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;surface&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"overview"&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"open_past_reference"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;surface&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"overview"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"inspect_past_invoices"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"not_found_in_reviewed_view"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"listing_complete"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt; \
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"continue_history_inspection"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An unknown heading is not silently treated as an estimate. That could hide a permission message or a changed interface. Similarly, a receipt or estimated amount with the requested reference is not accepted as an invoice. A matching reference still requires the observed invoice document kind and a current download control.&lt;/p&gt;

&lt;p&gt;These evidence fields are trust boundaries. The function does not authenticate an observation, check the operator's role, verify a PDF or prevent the UI changing after observation. A browser worker must recheck the account and selected invoice immediately before following a planned control, then save a separate artifact receipt after inspecting the downloaded document.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give history lookup a bounded meaning
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observed state&lt;/th&gt;
&lt;th&gt;Planned result&lt;/th&gt;
&lt;th&gt;What it does not establish&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Overview shows an estimate&lt;/td&gt;
&lt;td&gt;inspect_past_invoices&lt;/td&gt;
&lt;td&gt;No historical invoices exist&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latest invoice matches the requested reference&lt;/td&gt;
&lt;td&gt;open_latest_invoice&lt;/td&gt;
&lt;td&gt;File delivery is complete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latest invoice is another reference&lt;/td&gt;
&lt;td&gt;inspect_past_invoices&lt;/td&gt;
&lt;td&gt;The requested invoice was deleted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Past invoices has one matching invoice control&lt;/td&gt;
&lt;td&gt;open_past_reference&lt;/td&gt;
&lt;td&gt;The saved PDF has been verified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;History observation is incomplete and has no match&lt;/td&gt;
&lt;td&gt;continue_history_inspection&lt;/td&gt;
&lt;td&gt;Absence from complete history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reviewed view is complete and has no match&lt;/td&gt;
&lt;td&gt;not_found_in_reviewed_view&lt;/td&gt;
&lt;td&gt;Supplier-wide document absence&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;listing_complete is supplied by the adapter after it has reviewed the bounded view and its pagination or filters. It is not inferred from an empty rows array. Even a complete reviewed view has a scope and observation time; it may not cover every historical period or another billing account. Keep that boundary in the task record.&lt;/p&gt;

&lt;p&gt;Duplicate matches are ambiguous, even when they appear visually similar. Preserve both observations and review the mapping. Do not pick the first row based on DOM order or collapse different references because the amounts happen to match.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the transition before wiring browser actions
&lt;/h2&gt;

&lt;p&gt;The local synthetic checks exercise estimate-to-history routing, a known latest reference, another latest reference, a matching past reference, incomplete history, strict boolean handling, duplicate matches, wrong account scope, missing evidence and document-kind mismatch. They run only this pure function; no actual GitHub page, API response or invoice file is used.&lt;/p&gt;

&lt;p&gt;In production, capture the reason for each planned read, execute only the corresponding document-navigation action, and record the new observation before replanning. Apply a bounded inspection budget so an incomplete listing does not create an endless history loop. A download error should remain a delivery error, while a page-state review remains a page-state review.&lt;/p&gt;

&lt;p&gt;BrowserAct or another authorized browser worker would need a separately validated adapter for these routes. The implementation boundary is useful regardless of the worker: a dashboard estimate can change where the lookup continues, while the original invoice request stays open until the specific document is actually delivered and verified.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Index billing invoices by scope and document identity, not the seat roster</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 16:53:30 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/index-billing-invoices-by-scope-and-document-identity-not-the-seat-roster-3l62</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/index-billing-invoices-by-scope-and-document-identity-not-the-seat-roster-3l62</guid>
      <description>&lt;p&gt;A seat roster is a poor primary key for an invoice archive. In a design scenario, a team adds seats after an annual renewal, then finance asks for the period's documents. Building the expected invoice list from today's users can lose the renewal, the adjustment, or the distinction between billing groups.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our Figma billing guide made a narrower implementation question useful: when two observations appear to describe one invoice, what should an index merge, and what should it preserve for review? The example below is application-side Python with local synthetic checks. It is not a Figma API integration, account download, PDF parser, or tested Figma Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start from issued documents and billing scope
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.browseract.com/blog/download-figma-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Figma source guide&lt;/a&gt;, based on documentation checked November 9, separates team or organization billing from Enterprise billing groups. It describes selecting an invoice and downloading its PDF. The invoice-number link can open the corresponding Stripe view; it does not establish that all plans share one identical external interface.&lt;/p&gt;

&lt;p&gt;Renewals, additional seats and AI credits can produce different billing records. That is a reason to discover the actual invoice history, not a formula for generating invoice IDs or predicting one document per month. Keep the reviewed history scope and the collection interval beside the register, without claiming that the current member list proves historical completeness.&lt;/p&gt;

&lt;p&gt;Use an internal scope reference that resolves to the relevant team, organization and, where applicable, billing group. The code assumes an upstream adapter has already resolved that reference. It does not discover the hierarchy or prove the operator has billing permission.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate identity, observation and disagreement
&lt;/h2&gt;

&lt;p&gt;An invoice candidate has a composite identity: scope_ref plus invoice_number. Neither a filename nor a display name belongs in that key. We do not assume invoice numbers are globally unique across unrelated billing scopes. Preserve them exactly; this example does not lowercase, trim or otherwise rewrite identifiers.&lt;/p&gt;

&lt;p&gt;An observation has its own reference and evidence reference. Seeing the same candidate twice should retain two observations, even when the amount and currency agree. However, replaying an observation reference is a different condition: the batch needs review, so a conflicting replay cannot silently disappear into the first record.&lt;/p&gt;

&lt;p&gt;Different amounts or currencies under one composite key are conflicts. Do not implement last-write-wins or assume the later page is a corrected invoice. Preserve both upstream evidence records and have an authorized reviewer decide whether the scope, extraction, document version or association is wrong.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;decimal&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Decimal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;InvalidOperation&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build_invoice_index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;observations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;required&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"scope_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"invoice_number"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s2"&gt;"observation_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
               &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;required&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"missing_or_untyped_field"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;observation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"observation_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;observations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"duplicate_observation_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;observations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;currency&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s2"&gt;"ABCDEFGHIJKLMNOPQRSTUVWXYZ"&lt;/span&gt;
                                     &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"invalid_currency_code"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Decimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_finite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;InvalidOperation&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;InvalidOperation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"invalid_amount"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"scope_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"invoice_number"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;entry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setdefault&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"variants"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"observations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"variants"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"observations"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"conflict_review"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"variants"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
                      &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"candidate_for_document_check"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"observations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"observations"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"variant_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"variants"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"invoices"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"rejected"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"batch_needs_review"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rejected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"conflict_review"&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The return value intentionally contains no grand total. Currency syntax is checked, but three uppercase letters do not prove a valid or applicable currency. Decimal values avoid binary-float comparison, and equivalent decimal spellings compare equally. This code does not impose two decimal places, round values, convert currencies or infer tax treatment.&lt;/p&gt;

&lt;p&gt;A negative amount remains a candidate value. Its sign alone does not identify a refund, credit note, payment or replacement invoice. Those classifications need separate reviewed document metadata. Amount and currency agreement is also only a consistency check: two observations can agree and still describe the wrong document.&lt;/p&gt;

&lt;h2&gt;
  
  
  Route each ambiguity to a named action
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input situation&lt;/th&gt;
&lt;th&gt;Index behavior&lt;/th&gt;
&lt;th&gt;Required follow-up&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Same scope and invoice, matching values&lt;/td&gt;
&lt;td&gt;One candidate, both observations retained&lt;/td&gt;
&lt;td&gt;Verify the selected original document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same invoice number, different scopes&lt;/td&gt;
&lt;td&gt;Separate candidates&lt;/td&gt;
&lt;td&gt;Review each billing scope independently&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same key, different amount&lt;/td&gt;
&lt;td&gt;conflict_review&lt;/td&gt;
&lt;td&gt;Inspect both evidence records&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same key, different currency&lt;/td&gt;
&lt;td&gt;conflict_review&lt;/td&gt;
&lt;td&gt;Resolve association or extraction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replayed observation reference&lt;/td&gt;
&lt;td&gt;Batch requires review&lt;/td&gt;
&lt;td&gt;Resolve replay before accepting the batch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing identifiers, invalid amount or code syntax&lt;/td&gt;
&lt;td&gt;Rejected row, batch requires review&lt;/td&gt;
&lt;td&gt;Repair from source evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A candidate_for_document_check result does not mean the PDF exists, is authentic, or has been saved. Rejected rows are not proof of missing invoices. A production caller must respect batch_needs_review and retain the original input plus row-level failure provenance; this compact function returns reason codes only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep document delivery outside this index
&lt;/h2&gt;

&lt;p&gt;The local synthetic checks exercise identity collisions across scopes, repeated observations, conflicting values, equivalent decimal spellings, negative values, non-finite numbers, missing evidence, malformed currency syntax and a duplicate observation reference. They use fictional records and perform no network or file operations.&lt;/p&gt;

&lt;p&gt;After this stage, a separate worker must match the retained candidate to the authorized invoice view, download and inspect the original document, and record its artifact receipt. If a linked Stripe view is used, establish its relationship to the selected Figma invoice; do not substitute an unrelated processor identifier without an explicit, reviewed mapping.&lt;/p&gt;

&lt;p&gt;Persist observations append-only, and commit an accepted candidate version with concurrency control. This pure in-memory reducer cannot serialize two workers or enforce database uniqueness. It also cannot establish that every page of billing history was inspected. Capture that discovery evidence separately before calling a collection complete.&lt;/p&gt;

&lt;p&gt;For BrowserAct or another browser-assisted collector, this is a boundary to test around the native administrative route. It requires a separately validated Figma adapter and authorized access. The register should explain which documents were observed and which disagreements remain, while membership changes stay contextual evidence rather than becoming an invented invoice schedule.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Match an emailed billing export to its request before parsing the CSV</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 16:17:51 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/match-an-emailed-billing-export-to-its-request-before-parsing-the-csv-3gfk</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/match-an-emailed-billing-export-to-its-request-before-parsing-the-csv-3gfk</guid>
      <description>&lt;p&gt;A billing export that arrives by email is a delayed delivery, not the return value of a button click. Consider a design scenario: two stores request October exports, a worker receives a CSV later, and the job accepts it because the filename contains October. The file can be real while the association is wrong.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. While adapting our Shopify billing guide for developers, the useful engineering question was how to preserve request identity across that delay. This article proposes an application-side review gate, with synthetic Python checks. It does not report access to a Shopify store, mailbox integration, a Shopify API call, or a tested invoice Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the supplier behavior separate from your contract
&lt;/h2&gt;

&lt;p&gt;Our &lt;a href="https://www.browseract.com/blog/download-shopify-bills?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Shopify source guide&lt;/a&gt;, checked against the linked documentation on November 9, distinguishes an individual bill PDF or CSV from a billing-history CSV sent to the account email. The history export is not a ZIP of individual PDFs. A statement of charges answers another reporting question.&lt;/p&gt;

&lt;p&gt;That distinction determines the consumer. A history CSV can enter a ledger-validation queue. It cannot satisfy a PDF-archive request merely because the export completed. Here we handle only the asynchronous history CSV association. We do not parse Shopify CSV columns, download bill PDFs, or assert document completeness.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create an internal request before requesting an export
&lt;/h2&gt;

&lt;p&gt;Persist a request reference, stable store reference, requested interval and output kind. Use an internal store identifier rather than a display name that can change. Keep the operational recipient separately in access-controlled configuration; do not put mailbox addresses in general task logs.&lt;/p&gt;

&lt;p&gt;In this example intervals are half-open: start is included, end is excluded. That is our application convention, not a claim about Shopify date-picker semantics. An adapter must review how the actual selected dates map to that interval before storing them. A current-page export also needs a reviewed page manifest; do not squeeze it into a date-range contract without that evidence.&lt;/p&gt;

&lt;p&gt;The request reference below is generated by our application. Shopify is not claimed to echo it in an email, filename, CSV column or API response. A reviewer associates a candidate delivery with that reference only after inspecting its provenance and scope. If that association cannot be supported, leave the delivery unassigned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Refuse ambiguity before validating the file
&lt;/h2&gt;

&lt;p&gt;The gate accepts a reviewed delivery receipt, not a raw email. It requires exactly one pending request for the same store, interval and output kind. Two overlapping attempts with identical scope remain ambiguous even if somebody copies one request reference onto the receipt. Resolve or cancel the redundant attempt explicitly before continuing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;route_delivery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;keys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"store_ref"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"end"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"end"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"billing_history_csv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"invalid_request"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"request_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"store_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"invalid_request"&lt;/span&gt;
        &lt;span class="n"&gt;peers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;pending&lt;/span&gt;
                 &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;peers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;peers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"request_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"request_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"ambiguous_request"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"reviewed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"review_evidence"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"needs_review"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"scope_mismatch"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"request_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"request_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"request_mismatch"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"artifact_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"artifact_missing"&lt;/span&gt;
        &lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;delivery&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;re_full_sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"artifact_missing"&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"ready_for_csv_validation"&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;KeyError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"invalid_request"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;re_full_sha256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s2"&gt;"0123456789abcdef"&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The evidence reference points to the upstream review record. A boolean alone is insufficient, but neither field proves the review was truthful. The trusted adapter must verify the sender and delivery route under its own policy, inspect the attachment safely, establish store and range, and retain the evidence. A subject line or apparent sender is not authentication.&lt;/p&gt;

&lt;p&gt;Likewise, artifact_ref and sha256 are assertions from that adapter. This function checks their presence and digest syntax; it does not read bytes, calculate a digest, inspect a CSV, or prove the object still exists. The next worker must open the retained object and recompute the digest before schema and content validation. A filename extension cannot replace those checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the next action explicit
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observed condition&lt;/th&gt;
&lt;th&gt;Routing result&lt;/th&gt;
&lt;th&gt;Next action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One pending scope, reviewed matching delivery&lt;/td&gt;
&lt;td&gt;ready_for_csv_validation&lt;/td&gt;
&lt;td&gt;Validate retained bytes and CSV contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two pending requests with identical scope&lt;/td&gt;
&lt;td&gt;ambiguous_request&lt;/td&gt;
&lt;td&gt;Resolve attempt ownership&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delivery belongs to another store or interval&lt;/td&gt;
&lt;td&gt;scope_mismatch&lt;/td&gt;
&lt;td&gt;Quarantine association for review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scope matches but internal request differs&lt;/td&gt;
&lt;td&gt;request_mismatch&lt;/td&gt;
&lt;td&gt;Reconcile the review record&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Review missing or evidence absent&lt;/td&gt;
&lt;td&gt;needs_review&lt;/td&gt;
&lt;td&gt;Inspect provenance and scope&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Artifact reference or digest missing&lt;/td&gt;
&lt;td&gt;artifact_missing&lt;/td&gt;
&lt;td&gt;Recover a verifiable retained artifact&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A successful result only schedules CSV validation. It does not mark the export reconciled, the PDFs archived, or the finance task complete. For missing mail, keep the original request pending with an observation timestamp. Use a bounded operational follow-up policy; a timeout does not prove Shopify has no bills, and blind retries can create more indistinguishable deliveries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the association before building the mailbox worker
&lt;/h2&gt;

&lt;p&gt;The local synthetic checks cover another store, another interval, another output kind, mismatched request references, duplicate pending attempts, absent review evidence, strict boolean handling, missing artifact references, malformed digests and invalid date ranges. They exercise only these routing decisions. No supplier request or real attachment is involved.&lt;/p&gt;

&lt;p&gt;Production persistence needs an additional guarantee: reserve the chosen request and record the delivery association in one transaction, with a uniqueness rule for the accepted attempt. This pure function cannot prevent two concurrent workers from accepting the same candidate after separate reads. Keep an append-only observation record when the same bytes arrive twice; content deduplication must not silently erase the second delivery event.&lt;/p&gt;

&lt;p&gt;For a browser-assisted collector, use the same receipt boundary after an authorized operator requests the native export. BrowserAct would still need a separately tested store adapter and delivery path. The engineering gain here is a specific handoff: an asynchronous CSV becomes eligible for validation only after its association is reviewed, while the original PDF collection request remains independently open.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Resolve the workspace before reusing a billing-role snapshot</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 15:42:59 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/resolve-the-workspace-before-reusing-a-billing-role-snapshot-1fke</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/resolve-the-workspace-before-reusing-a-billing-role-snapshot-1fke</guid>
      <description>&lt;p&gt;A billing request says “the company workspace.” The worker has several workspaces with similar names and remembers that one operator was an owner during an earlier session. It chooses the familiar name and reports that no invoice is available.&lt;/p&gt;

&lt;p&gt;That result may describe the wrong workspace or an outdated role observation.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our Notion invoice guide emphasizes that plans belong to individual workspaces and that workspace ownership matters for billing access. It also keeps the documented upcoming-invoice view separate from an unverified historical-PDF export. Those limits suggest a useful application boundary: resolve the exact workspace and assess the age of the identity observation before a billing lookup begins.&lt;/p&gt;

&lt;p&gt;This article implements that boundary with synthetic records. It does not authenticate to Notion, inspect a customer's workspace, call a billing API, retrieve invoice files, or test a BrowserAct Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the finance request a stable workspace reference
&lt;/h2&gt;

&lt;p&gt;Display names help an operator recognize a workspace. They make fragile database keys: names can change, and different workspaces can look similar. An email address also does not identify which workspace owns a subscription charge.&lt;/p&gt;

&lt;p&gt;Use a stable internal workspace reference in the request. Maintain an explicitly reviewed mapping between that reference and the supplier workspace. The example does not assume a particular Notion endpoint exposes this mapping or that a page title proves it.&lt;/p&gt;

&lt;p&gt;The same principle applies to the operator. An internal actor reference should map to the authorized identity used for the task. Keep credentials and session tokens outside the observation record. The data below needs identity evidence, not secrets copied into a job log.&lt;/p&gt;

&lt;h2&gt;
  
  
  Store an observation, not a permanent owner flag
&lt;/h2&gt;

&lt;p&gt;A role observation has a timestamp, an actor, a workspace, and supporting evidence. It should not become a timeless boolean such as &lt;code&gt;has_billing_access = True&lt;/code&gt; attached to the entire login.&lt;/p&gt;

&lt;p&gt;Workspace membership or ownership can change. Switching to another workspace can also invalidate what the worker previously observed. A recent observation reduces uncertainty but does not guarantee that authorization remains unchanged at the moment of use.&lt;/p&gt;

&lt;p&gt;The freshness limit below is an application policy supplied by the caller. It is not a Notion session lifetime or a vendor promise. Set it according to the workflow's review requirements, and recheck after a relevant navigation, role, or identity change even if the time limit has not expired.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timedelta&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;workspace_review&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;workspace_ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actor_ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;observations&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="n"&gt;max_age_minutes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;workspace_ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actor_ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Resolve workspace and actor references"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_age_minutes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;max_age_minutes&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tzinfo&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;utcoffset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Use an aware clock and positive freshness policy"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;observations&lt;/span&gt;
               &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"workspace_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;workspace_ref&lt;/span&gt;
               &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"actor_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;actor_ref&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"identity_review_required"&lt;/span&gt;
    &lt;span class="n"&gt;observation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"identity_verified"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"identity_review_required"&lt;/span&gt;
    &lt;span class="n"&gt;evidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"identity_review_required"&lt;/span&gt;
    &lt;span class="n"&gt;observed_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"observed_at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observed_at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tzinfo&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;observed_at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;utcoffset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Observation timestamp must include its timezone"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;observed_at&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;minutes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;max_age_minutes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"refresh_identity_observation"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"owner"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"owner_review_required"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"ready_for_billing_lookup_review"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function matches references exactly and does not fall back to a display-name search. Duplicate matching observations ask for review instead of silently choosing the newest one. The caller should supply one selected current observation from its history while retaining older evidence separately.&lt;/p&gt;

&lt;p&gt;Timezone-aware timestamps allow two equivalent instants with different UTC offsets to compare correctly. A future observation is rejected as a clock or data-quality issue. The policy boundary is inclusive: an observation exactly at the allowed age is accepted by this example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the readiness result narrow
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ready_for_billing_lookup_review&lt;/code&gt; says that one supplied observation passed these checks. It grants no role and proves no server-side authorization. The actual service remains responsible for enforcing permissions, and the operator must still verify the current billing context.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;identity_verified&lt;/code&gt; field is another trust boundary. A qualified observer must establish it from the real workspace and actor. Copying the expected references into an observation and setting the flag would make the gate meaningless.&lt;/p&gt;

&lt;p&gt;The source guide's documented invoice view concerns an upcoming invoice. Even with a fresh owner observation, this code cannot turn that view into proof that historical supplier-original PDFs were downloaded. Keep requested period, purchase type, and actual artifact evidence in separate fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the reasons a familiar workspace can be wrong
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Synthetic observation&lt;/th&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Similar display name, different stable reference&lt;/td&gt;
&lt;td&gt;Identity review required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Correct workspace, different actor&lt;/td&gt;
&lt;td&gt;Identity review required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two matching observations&lt;/td&gt;
&lt;td&gt;Identity review required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verified identity with expired or future timestamp&lt;/td&gt;
&lt;td&gt;Refresh observation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fresh member observation&lt;/td&gt;
&lt;td&gt;Owner review required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fresh owner observation with evidence&lt;/td&gt;
&lt;td&gt;Ready for billing lookup review&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Local synthetic checks cover these cases, strict boolean flags, timezone offsets, and the freshness boundary. They do not validate a vendor role, prove invoice access, or establish a bulk-download path.&lt;/p&gt;

&lt;p&gt;For an unresolved identity, ask the responsible owner to clarify the workspace mapping. For an expired observation, collect fresh evidence through the permitted route. Do not automatically promote a member, change the plan, or cycle through unrelated identities until a billing page appears.&lt;/p&gt;

&lt;p&gt;Notion plan purchases and credits can require separate document tracking in the source guide. Resolving a workspace does not establish that one invoice covers every purchase. A useful handoff preserves the exact workspace, actor observation, purchase context, and what was actually obtained.&lt;/p&gt;

&lt;p&gt;The next worker should be able to explain why this workspace was selected without relying on the previous worker's memory.&lt;/p&gt;

&lt;p&gt;Source and native retrieval context: &lt;a href="https://www.browseract.com/blog/find-notion-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Find Notion invoices for the correct workspace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Model receipt exports as observed state transitions, not a successful click</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 15:06:16 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/model-receipt-exports-as-observed-state-transitions-not-a-successful-click-14pe</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/model-receipt-exports-as-observed-state-transitions-not-a-successful-click-14pe</guid>
      <description>&lt;p&gt;A worker requests a receipt export and marks the job complete. The interface is still generating the files. When the next worker runs, it either starts another export or assumes the archive already exists.&lt;/p&gt;

&lt;p&gt;The missing boundary is between requesting an export and receiving its artifacts.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our LinkedIn Ads receipt guide describes a native workflow that selects payment records, chooses PDF or CSV, waits for generation, and then downloads the result. That sequence is a useful example for application state design. The code here operates on synthetic observations; it does not visit Campaign Manager, request a real export, download receipts, or test a BrowserAct Bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Name the observations that permit progress
&lt;/h2&gt;

&lt;p&gt;A successful click is not evidence that generation finished. A ready download is not evidence that a file was saved. A saved file is not evidence that it belongs to the requested account and receipts.&lt;/p&gt;

&lt;p&gt;Use separate application states with a concrete observation for each transition:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;From&lt;/th&gt;
&lt;th&gt;Observed event&lt;/th&gt;
&lt;th&gt;To&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;requested&lt;/td&gt;
&lt;td&gt;Generation has started for this request&lt;/td&gt;
&lt;td&gt;generating&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;generating&lt;/td&gt;
&lt;td&gt;This export is ready&lt;/td&gt;
&lt;td&gt;ready&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ready&lt;/td&gt;
&lt;td&gt;Its artifact was saved&lt;/td&gt;
&lt;td&gt;saved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;saved&lt;/td&gt;
&lt;td&gt;The saved artifact passed the required review&lt;/td&gt;
&lt;td&gt;verified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;generating&lt;/td&gt;
&lt;td&gt;Generation failure was observed&lt;/td&gt;
&lt;td&gt;blocked&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These labels are an internal model, not LinkedIn status values or documented API events. An adapter must supply evidence from the actual permitted workflow. If the page does not establish readiness, keep the job generating or request review; do not invent an event after an arbitrary sleep.&lt;/p&gt;

&lt;p&gt;The receipt guide also separates card receipts from monthly invoices and distinguishes receipt PDFs from CSV details. The requested output type and selected receipt manifest belong to the job definition. Switching format or account should create a new job rather than reusing the old readiness state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bind every event to one account and export request
&lt;/h2&gt;

&lt;p&gt;An account reference and application job ID identify the work below. The job ID is created by the application; the example does not assume the portal exposes a durable export ID.&lt;/p&gt;

&lt;p&gt;The record also has a version. A producer includes the version it observed, so a stale observation cannot overwrite a newer state silently. This is especially useful after a delayed worker resumes or two observers report the same readiness event.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;TRANSITIONS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"requested"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"generation_started"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"generating"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"generating"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"generation_ready"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ready"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ready"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"artifact_saved"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"saved"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"saved"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"artifact_verified"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"verified"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"generating"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"generation_failed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"blocked"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;advance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;field&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"account"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"job"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;field&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing job identity"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;field&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Observation belongs to another job"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"expected_version"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"expected_version"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Read the current record before applying an event"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;evidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"evidence_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Observation evidence is required"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"kind"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;TRANSITIONS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"state"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Transition is not allowed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"artifact_saved"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"artifact_verified"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;artifact&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"artifact_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Saved-artifact reference is required"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"artifact_verified"&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"artifact_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Review does not identify the saved artifact"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"artifact_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="n"&gt;last_evidence_ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The pure function returns a new record and leaves its input unchanged. It does not persist the result. Production storage must perform a conditional update against the expected version atomically; checking a version in Python and then doing an unconditional database write would still allow a race.&lt;/p&gt;

&lt;p&gt;This example rejects a stale event rather than making it idempotently successful. The caller should reread the ledger and reconcile existing evidence. It should not interpret the error as permission to request another portal export.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat verification as a separate trust boundary
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;artifact_verified&lt;/code&gt; means a qualified upstream review supplied evidence for the same saved artifact reference. The reducer cannot inspect a PDF or decide whether a CSV contains every selected receipt.&lt;/p&gt;

&lt;p&gt;The review needs to compare account, document type, identifiers, and requested membership. Preserve the original selection manifest and the saved output references. A PDF batch may contain separate receipt files, so a package reference is only a handle to the reviewable artifact set; it does not prove that every member passed inspection.&lt;/p&gt;

&lt;p&gt;Likewise, a CSV report does not fill a PDF requirement merely because it lists the same charges. Historical document unavailability is another kind of exception. Starting a new generation job cannot establish that a no-longer-available original PDF can be recovered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test skipped and stale transitions
&lt;/h2&gt;

&lt;p&gt;Local synthetic checks cover the full successful chain, generation failure, stale versions, wrong accounts and jobs, missing evidence, attempts to skip readiness, and a review for the wrong saved artifact. They test this reducer rather than the supplier interface or any real receipt content.&lt;/p&gt;

&lt;p&gt;The blocked state has no automatic outgoing transition in this example. Keep the failure evidence and obtain a specific recovery decision before creating fresh work. Do not turn every timeout into a new export request.&lt;/p&gt;

&lt;p&gt;For a job still generating, use bounded observation and retain the last known state. If a later run finds the original output ready, continue from that observation. If the result is uncertain, reconcile the original request before submitting another one.&lt;/p&gt;

&lt;p&gt;No payment, advertising, or permission change is needed to implement this ledger. It is a way to report progress truthfully while a separately authorized native retrieval process does the actual work.&lt;/p&gt;

&lt;p&gt;The completion badge should describe accepted artifact evidence, not the last button the worker clicked.&lt;/p&gt;

&lt;p&gt;Source and native retrieval context: &lt;a href="https://www.browseract.com/blog/download-linkedin-ads-receipts?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Download LinkedIn Ads receipts: PDF and CSV guide&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>A current billing setup is not a historical document coverage plan</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 14:01:26 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/a-current-billing-setup-is-not-a-historical-document-coverage-plan-2eb8</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/a-current-billing-setup-is-not-a-historical-document-coverage-plan-2eb8</guid>
      <description>&lt;p&gt;An agency requests six months of billing documents for a client. The worker opens the current billing view and retrieves everything it can see. The folder looks complete until someone notices that the client's billing arrangement changed during the requested period.&lt;/p&gt;

&lt;p&gt;The current view was treated as the historical scope.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our Google Ads invoice guide describes a separate lookup for documents issued under an earlier billing setup, using the native Billing transfers and previous Invoice setup context. That distinction suggests an application design: plan historical lookup scopes before declaring a collection job ready.&lt;/p&gt;

&lt;p&gt;This article implements a small interval check with synthetic data. It does not query Google Ads, discover actual billing-transfer dates, download invoices, or validate an accounting reconciliation. No ad, budget, permission, payment, or billing configuration is changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make a lookup plan before starting retrieval
&lt;/h2&gt;

&lt;p&gt;The plan should identify the client account, the requested document type, and the lookup contexts needed for the requested history. Keep an earlier setup as a separate context instead of replacing its identifier with the current one.&lt;/p&gt;

&lt;p&gt;Invoices, statements, payment receipts, and activity exports remain different artifacts in the source guide. A time interval covered by an activity report is not proof that the required invoice files exist. Nor does advertising spend imply that every account receives the same tax document.&lt;/p&gt;

&lt;p&gt;For this example, an account owner supplies reviewed historical intervals for one customer and one document-retrieval task. Each interval names a lookup setup and has supporting review evidence. These are proposed application fields, not a Google Ads API response or a guaranteed mapping from setup dates to document dates.&lt;/p&gt;

&lt;p&gt;That last boundary matters. A supplier may issue a later correction or place a document somewhere unexpected. A reviewer must decide the lookup plan from actual account evidence; calendar arithmetic cannot decide where every invoice will appear.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use half-open intervals for the planning boundary
&lt;/h2&gt;

&lt;p&gt;Represent an interval as &lt;code&gt;[start, end)&lt;/code&gt;: include the first date and exclude the end date. Adjacent scopes can then meet at one boundary without counting the same day twice. For a whole-month request, the end is the first date after the requested period, not the final day at an assumed time of night.&lt;/p&gt;

&lt;p&gt;The code below parses calendar dates only. It does not convert payment timestamps, account timezones, service dates, or invoice issue dates. A real implementation must state which date basis its reviewed lookup intervals use.&lt;/p&gt;

&lt;p&gt;Do not infer those intervals from the creation time of a local file. Preserve the account evidence and the review reference so another operator can understand why the historical scope was divided.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lookup_slices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Resolve the customer before planning"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Expected a nonempty requested interval"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;slices&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"customer"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Mixed customer history needs review"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"reviewed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Unreviewed lookup history"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                   &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"setup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"review_ref"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing setup or review evidence"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromisoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"end"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Invalid historical interval"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;clipped_start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;clipped_end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;clipped_start&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;clipped_end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;slices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clipped_start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;clipped_end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"setup"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                           &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"review_ref"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;slices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;evidence&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;slices&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Overlapping lookup scopes need review"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"A historical lookup scope is missing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"The requested history is not fully planned"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"setup"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="s2"&gt;"end"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isoformat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"review_ref"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;evidence&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;slices&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is a retrieval plan, not a completed archive. The strict &lt;code&gt;reviewed&lt;/code&gt; check also rejects truthy strings and integers. It cannot prove that the reviewer was correct or that the supplied evidence is accessible to the worker.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reject gaps instead of extending the latest setup
&lt;/h2&gt;

&lt;p&gt;Suppose a synthetic request spans January through June. Reviewed context A covers January through March, and context B covers April through June. The output contains two tasks. Reversing the input order produces the same plan.&lt;/p&gt;

&lt;p&gt;If context A is absent, the function raises an error. It does not stretch B backwards to January. If A and B overlap, it asks for review rather than choosing whichever entry was most recently added.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Synthetic input&lt;/th&gt;
&lt;th&gt;Planning result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Two adjacent reviewed scopes&lt;/td&gt;
&lt;td&gt;Two clipped lookup tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request entirely inside one scope&lt;/td&gt;
&lt;td&gt;One clipped task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing beginning, middle, or end&lt;/td&gt;
&lt;td&gt;Validation error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overlapping or duplicate intervals&lt;/td&gt;
&lt;td&gt;Validation error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A different customer mixed into history&lt;/td&gt;
&lt;td&gt;Validation error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing review evidence&lt;/td&gt;
&lt;td&gt;Validation error&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These checks establish properties of the supplied plan. They do not establish actual Google Ads document availability, infer a paying-manager relationship, or make the same date basis appropriate for receipts and monthly invoices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep plan coverage separate from file coverage
&lt;/h2&gt;

&lt;p&gt;After planning, each task still needs an authorized retrieval path. The source guide separates native Documents selection, payment receipts, and the monthly-invoicing API route. A working path for one client is not proof that every client can use it.&lt;/p&gt;

&lt;p&gt;Keep the requested customer, setup context, document type, document number when known, and artifact evidence together. Record a lookup with no matching document separately from a failed save. Do not convert a successfully planned interval into a “documents complete” flag.&lt;/p&gt;

&lt;p&gt;A change to the reviewed history should invalidate the pending plan. Retain the previous version and its observations; review the affected gap before repeating collection. This avoids erasing why an earlier worker searched another setup.&lt;/p&gt;

&lt;p&gt;The useful output of the planner is modest: every requested date has an explicitly reviewed lookup context, and no supplied contexts overlap within that request. Actual files, corrections, country-specific requirements, and reconciliation still need their own evidence.&lt;/p&gt;

&lt;p&gt;Source and native retrieval context: &lt;a href="https://www.browseract.com/blog/download-google-ads-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Download Google Ads invoices, statements and receipts&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>dataengineering</category>
    </item>
    <item>
      <title>Verify the selected invoice set before starting a native batch download</title>
      <dc:creator>BrowserAct</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:25:34 +0000</pubDate>
      <link>https://dev.to/browser_act_e2505dbdf454a/verify-the-selected-invoice-set-before-starting-a-native-batch-download-4dma</link>
      <guid>https://dev.to/browser_act_e2505dbdf454a/verify-the-selected-invoice-set-before-starting-a-native-batch-download-4dma</guid>
      <description>&lt;p&gt;A finance request names three invoices. A worker opens billing history, checks three boxes, and starts a download. The count looks right, but one checkbox was left over from a previous search. Two requested invoices and one unrelated document were selected.&lt;/p&gt;

&lt;p&gt;Checking the count would not catch the mistake. The application needs to compare identities.&lt;/p&gt;

&lt;p&gt;I work on BrowserAct. Our Adobe invoice guide distinguishes individual-account retrieval from directly billed team contracts. Its November 9 documentation review describes a native Admin Console flow for selecting one or more invoices, with contract-owner access. That native feature is the starting point here: add a selection check before using it, rather than assume a new collector must reproduce the entire workflow.&lt;/p&gt;

&lt;p&gt;The Python example below checks synthetic selection snapshots. It does not sign in to Adobe, operate Admin Console, download PDFs, or test a BrowserAct Bot. The fields are an application contract, not an Adobe API response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the purchase route outside the selection algorithm
&lt;/h2&gt;

&lt;p&gt;An individual Adobe purchase, a directly billed team contract, and a reseller purchase have different retrieval paths. Product access does not prove billing access. A missing team Billing history tab should prompt a contract-ownership check, not an automatic switch to another identity.&lt;/p&gt;

&lt;p&gt;This gate applies after an authorized operator has established the correct native route. It does not authorize access or make the personal-account interface support team batch controls. Reseller documents remain a separate request to the reseller.&lt;/p&gt;

&lt;p&gt;The caller supplies an expected account and contract reference. These may be internal normalized references. The upstream adapter must explain how it establishes the mapping to the current page; the function cannot discover or verify that mapping itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Freeze the requested IDs before touching checkboxes
&lt;/h2&gt;

&lt;p&gt;Use the invoice references from the finance request as the expected set. Amounts and dates can help locate rows, but repeated subscription amounts make poor document identities. A matching amount is not a substitute for the requested invoice number.&lt;/p&gt;

&lt;p&gt;Keep that expected set separate from the observed selection. Building both from the same checked rows would only prove that a list equals itself. If the request changes, create a new request revision and obtain a new selection observation rather than silently editing the earlier evidence.&lt;/p&gt;

&lt;p&gt;The observer must enumerate all selected rows, including selections retained across filters or pages. Reading only the visible table while assuming hidden selections are clear defeats the check. If complete enumeration is unavailable, the application should require manual review instead of setting a completeness flag optimistically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compare scope, document type, and exact membership
&lt;/h2&gt;

&lt;p&gt;The gate rejects missing identifiers and duplicate IDs instead of silently normalizing them away. It then requires a complete, independently verified selection snapshot in the intended scope. Finally, each selected row must represent an invoice in that scope, and its ID must match the request exactly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;checked_ids&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Expected a nonempty list of invoice IDs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Resolve every invoice ID"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Duplicate invoice IDs need review"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kt"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;selection_gate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected_scope&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;requested_ids&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected_scope&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;tuple&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected_scope&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                   &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;expected_scope&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Expected an account and contract scope"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;checked_ids&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;requested_ids&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"scope_verified"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"scope_review_required"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"selection_complete"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"selection_review_required"&lt;/span&gt;
    &lt;span class="n"&gt;observed_scope&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"account"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"contract"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observed_scope&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;expected_scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"scope_mismatch"&lt;/span&gt;
    &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;snapshot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"selected_rows"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"selection_empty"&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Expected selected-row records"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"account"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"contract"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;expected_scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"row_scope_mismatch"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"document_type"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"invoice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"document_type_mismatch"&lt;/span&gt;
    &lt;span class="n"&gt;observed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;checked_ids&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"invoice_id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;observed&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"selection_membership_mismatch"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"ready_for_native_download"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The strict booleans prevent a string such as &lt;code&gt;"false"&lt;/code&gt; from qualifying as verified evidence. The ID comparison is intentionally exact. If a portal formats identifiers differently, implement and test an explicit mapping before this boundary; do not strip punctuation until two distinct invoices collapse into one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test substitutions as well as missing rows
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Synthetic selection&lt;/th&gt;
&lt;th&gt;Expected outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Requested IDs selected in another order&lt;/td&gt;
&lt;td&gt;Ready for the native download step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same count, one unrelated ID substituted&lt;/td&gt;
&lt;td&gt;Membership mismatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One requested ID missing or one extra ID retained&lt;/td&gt;
&lt;td&gt;Membership mismatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same ID appears twice&lt;/td&gt;
&lt;td&gt;Validation error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A row belongs to another contract&lt;/td&gt;
&lt;td&gt;Row scope mismatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A payment receipt fills an invoice slot&lt;/td&gt;
&lt;td&gt;Document type mismatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Selection completeness is unconfirmed&lt;/td&gt;
&lt;td&gt;Selection review required&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The local checks exercise these cases and malformed inputs. They do not establish that Adobe exposes a particular selector, retains checkbox state in a particular way, or returns a specific file package. The stale-selection opening example is a design scenario, not a reported Adobe defect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make readiness expire when the page changes
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ready_for_native_download&lt;/code&gt; is a decision about one supplied snapshot. It is not proof of a saved file. Bind the decision to the request revision and the observation that produced it. If the account, contract, filter, selection, or page state changes before the native action, discard the readiness decision and obtain fresh evidence.&lt;/p&gt;

&lt;p&gt;A production adapter must control that interval. This small pure function cannot prevent another operator from changing the page or ensure the snapshot is truthful. Avoid storing a reusable “approved” flag that survives navigation to another contract.&lt;/p&gt;

&lt;p&gt;After the native download, verify the actual artifacts against the requested invoices. A returned file count alone repeats the same mistake at a later stage. Keep invoice identity, document type, and archive evidence, and retain missing items without substituting nearby periods.&lt;/p&gt;

&lt;p&gt;Adobe invoices and payment receipts serve different purposes in the source guide. Retrieving a record does not call for changing a payment method or contract owner. Keep those actions outside a document-selection workflow.&lt;/p&gt;

&lt;p&gt;Native batch controls can save repeated work. A small identity check helps ensure that the work they save is still the work that was requested.&lt;/p&gt;

&lt;p&gt;Source and native retrieval context: &lt;a href="https://www.browseract.com/blog/download-adobe-invoices?co-from=blogbotdevto" rel="noopener noreferrer"&gt;Download Adobe invoices: personal and team accounts&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>testing</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
