Skip to content

docs(examples): record the FEMA bare-$ fields and which path a fetch took - #298

Merged
svonava merged 1 commit into
mainfrom
agent/doc2md-followup
Sep 17, 2026
Merged

svonava merged 1 commit into
mainfrom
agent/doc2md-followup

Conversation

@svonava

@svonava svonava commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Two follow-ups to #280, deliberately left out of it so that PR could ship without paying another review round for a section that was already true but incomplete. Closes #288.

Documentation and one forward-looking field. No artifact changed, nothing re-run, no recorded number moved.

The FEMA form loses its labels entirely

26 of the form's 124 non-blank lines are a bare $ and nothing else. Every amount field comes back as a naked dollar sign with its label stripped, and no line in the file carries a currency amount attached to a label.

- [ ] Other:

$

$

$

The README's "What the conversion gets wrong" section already covered the table behaviour — spanning headers expanded across every cell, stacked tables welded into one, cells collapsed to space-joined values — plus code-block flattening, hyphen closing and the FEMA heading-to-field separation. All true, and all about tables.

This one is the plainest thing in the corpus. A table with a repeated header still reads as a table, so a reader can talk themselves out of caring. A column of 26 dollar signs cannot be read as anything but broken. And it is a form — the category where a label and its field are related only by position on the page, and so the hardest case for any converter.

It also sharpens what the section says about the checks

contains: checks have the same shape as _table_count:

  • contains:AMOUNTS CLAIMED passes, because that heading survives at line 9
  • every field beneath it is unlabelled

Both true of the same recorded run, which scored 25 of 25. A harness that checks facts and order will not tell you your tables are wrong, and one that checks a heading is present will not tell you the fields under it are gone. Each check answers a narrower question than the claim it is used to back.

retrieval now records the route, not just the outcome

retrieval recorded publisher for both a clean first attempt and a curl fallback after a 403, so a fetch that needed the fallback read exactly like one that did not. It now records publisher-after-403-via-curl.

Why that fallback exists is written beside it, because nobody debugging a 403 would guess the direction:

urllib + Chrome UA   403
curl  + Chrome UA    403
curl, default UA     200   application/pdf, 785,324 bytes

fema.gov refuses a request carrying a Chrome user-agent and serves plain curl. The retry works because it drops the browser user-agent the first attempt sends — a WAF apparently reading "Chrome from a datacenter" as a scraper and "curl" as an honest tool.

Tested from one network only. That says nothing about what a real browser on a home connection sees, and "the FEMA link is broken" would be more than the evidence supports.

Not backfilled, deliberately

The committed run predates the finer value and records publisher for all four, which is true of all four — FEMA's arrived through the curl retry. The bytes are pinned and correct. Backfilling would mean editing a recorded artifact to say something the run did not say, which is the defect #280 exists to remove.

Checks

Every number checked against the recorded output rather than retyped — 26 bare $ lines of 124 non-blank, AMOUNTS CLAIMED at line 9. verify-run 65 of 65 · pytest 34 passed · ruff clean.

Summary by CodeRabbit

  • Documentation

    • Documented FEMA retrieval behavior, including fallback handling after access restrictions.
    • Added guidance on known conversion limitations, including missing amount labels and incomplete table relationships.
    • Clarified that evaluation checks may pass while some formatting or field relationships remain incorrect.
  • Bug Fixes

    • Retrieval records now distinguish standard publisher downloads from downloads completed through the fallback method after an access restriction.

…took

Two follow-ups to #280, deliberately left out of it so that PR could ship
without paying another review round for a section that was already true but
incomplete. Closes #288.

The FEMA finding. 26 of the form's 124 non-blank lines are a bare $ and nothing
else: every amount field comes back as a naked dollar sign with its label
stripped, and no line in the file carries a currency amount attached to a label.
It is the plainest artefact in the corpus. A table with a repeated header still
reads as a table, so a reader can talk themselves out of caring; a column of 26
dollar signs cannot be read as anything but broken. And it is a form, the
category where a label and its field are related only by position on the page.

It also sharpens what the section already said about the checks. contains:
checks have the same shape as _table_count: contains:AMOUNTS CLAIMED passes
because that heading survives at line 9, and says nothing about the 26
unlabelled fields beneath it. A harness that checks facts and order will not
tell you your tables are wrong, and one that checks a heading is present will
not tell you the fields under it are gone. Each check answers a narrower
question than the claim it is used to back.

The provenance field. retrieval recorded "publisher" for both a clean first
attempt and a curl fallback after a 403, so a fetch that needed the fallback
read exactly like one that did not. It now records
publisher-after-403-via-curl, which describes the route rather than the outcome.

Why that fallback exists is worth writing down beside it, because nobody
debugging a 403 would guess the direction: fema.gov refuses a request carrying a
Chrome user-agent and serves plain curl, so the retry works BECAUSE it drops the
browser user-agent the first attempt sends. Tested from one network only, which
says nothing about what a browser on a home connection sees.

No artifact changes and nothing re-run. The committed run predates the finer
value and records "publisher" for all four, which is true of all four -- FEMA's
arrived through the curl retry. The bytes are pinned and correct; backfilling
the record would mean editing a recorded artifact to say something the run did
not say.

Every number checked against the recorded output rather than retyped: 26 bare $
lines of 124 non-blank, AMOUNTS CLAIMED at line 9. verify-run 65 of 65, pytest
34, ruff clean.
@svonava
svonava requested a review from a team as a code owner September 17, 2026 16:32
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 8a6ff546-0ef5-4f8e-87bb-eb84ab04d797

📥 Commits

Reviewing files that changed from the base of the PR and between 7a8b09b and c2e7cea.

📒 Files selected for processing (2)
  • examples/document-to-markdown/README.md
  • examples/document-to-markdown/document_to_markdown/fetch.py

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change distinguishes FEMA curl fallback retrievals from direct publisher downloads. The README documents the fallback sequence, bare-dollar conversion output, formatting changes, and limits of the evaluation checks.

Changes

FEMA document-to-markdown example

Layer / File(s) Summary
Retrieval fallback metadata
examples/document-to-markdown/document_to_markdown/fetch.py
Curl retries after an HTTP 403 now record publisher-after-403-via-curl; direct publisher downloads retain publisher.
Conversion and evaluation observations
examples/document-to-markdown/README.md
The README documents the FEMA fallback sequence, bare-dollar amount fields, heading and hyphen changes, and the structural limits of the evaluation checks.

Suggested reviewers: dragosboca

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to c2e7c

The documentation and retrieval classification are consistent with the recorded artifacts and observed evaluation behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies both primary changes: documenting FEMA bare-dollar fields and recording the fetch retrieval path.
Linked Issues check ✅ Passed Issue #288 requires documentation in examples/document-to-markdown/README.md. The README records that 26 of 124 non-blank FEMA lines are bare $ values, states that amount labels and spatial label-…
Out of Scope Changes check ✅ Passed The only implementation change outside the README is in fetch.py. It records publisher-after-403-via-curl after the documented 403 fallback. This supports the README's retrieval documentation and …
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@svonava
svonava merged commit a62c676 into main Sep 17, 2026
19 checks passed
@svonava
svonava deleted the agent/doc2md-followup branch September 17, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(examples): record the FEMA bare-$ amount fields in document-to-markdown

1 participant