# MANIFEST: Quakes
updated:     2026-10-25T01:12:13+00:00
state:       approved
blocks:      5

applied_specs: |
  ARCHITECTURE.md sha256=a4f0e3d35e74a3a608621cd364fd70b71c5a216cf0ef99264d9f012b2fdd0b87 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-1 applied_at=2026-10-25T01:16:10+00:00 build_sha256=92928c9900864773a3d939fda519f01a558d7d02ec21879a71bdf3be55fb9be1
  ARCHITECTURE_compact.md sha256=ef0388c6a5c6e8b4538bf1a614d43a8c42342cf94c4d007db0bb6d08455ce7df commit=6776b59bef58a0ba39ab52d907f85d0dc083df9e applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=ef0388c6a5c6e8b4538bf1a614d43a8c42342cf94c4d007db0bb6d08455ce7df
  FEATURE-CliFoundation.md sha256=10dde3facdf95be310c39470ac135bc5cef9b99c3e7272273f25e68992b168ab commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-2 applied_at=2026-10-25T01:17:17+00:00 build_sha256=5f8a25bef4cf9d1d258761c0224ff20b28669ad9ddaf783f85a5e9fad7cc1eb7
  FEATURE-Daily.md sha256=af927d8220d84b9020d6a0346f5f2aaaeb4b31374e9c4ef211662973c5cc435e commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=a8b9a6ae192e0cdb56fa2b0cb913cba804e2a355554a8b0fea7f61ee9080361f
  FEATURE-EventExtraction.md sha256=4957b2bdfd1a02f3eea8e6c4dc00731b5646de970a62c3c14f4121f02013ce50 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=8505f8079174f96e874e4e8d6a58946384f3e16cd118d3072e4ae1760bf52df3
  FEATURE-ExitCodes.md sha256=528fe84c32efbef7e53de669c5948649cc2072b331e2aa048f6441593256132a commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=a12c68c4185d5be0bf68a8dbaed7a1e836059c1003738cbde894c7bf79d880d0
  FEATURE-FeedValidation.md sha256=3f1a79a9d090415aadc26da171eaaf41cb04e8b90f7b3cf4a081ce02711b6a92 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=3da5ffb535fec0e3776a2b03afad0a78c84817bccc7a64841265f366c0c6314c
  FEATURE-Fetch.md sha256=c0a6dbf14c41b93c06ef2e7eafa807a207003ee9b0b2be397c20e7b4864a5e30 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=963005a53e0d63c9d81cf9c00df45b5658b9acf1141194831154bf194f257bb5
  FEATURE-FetchFailure.md sha256=b362d4f0df51c844a4a2f8ed4eeec91e2b8fbe286066bc3704c494ac9be0a3d1 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=98971d866bbe022ab7a61febd362c639218a645648a64d34a32a38320293f7e4
  FEATURE-Formatting.md sha256=af26cf8f5898998f677934b21f1e06d7f65e8ddfc41505b0eb0c49438bce32f8 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=9cea9b8e956e96b09baa0faa6337c4dd31a9461112bbef60cf7e8648b7977586
  FEATURE-MagFilter.md sha256=3eea10a39cdb7e9f4b0f7b9597b6caff05ade4652dac9750abe41eb94359c6fe commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=912b5c8027b7cba4df0986142d005d21db303a6afcee7a8c3951b4b8fa0f7f0b
  FEATURE-Near.md sha256=845d12c3c8eca7b813e961266b87aeaf8d7e6666faba2752ab841d66ee43f07c commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=734ae0b760185a7c884682164daa454ff635ae9d8ea64407d9ef631912dd8ba4
  FEATURE-Options.md sha256=bf2e361cf0e2b0e9dccfd38478f79972d498aaeb2e202af9136d88b4df6e2777 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=42b0ffece89f4de78868d5f25b340b7b6d7f5da67c91351b875261eab0b8d12b
  FEATURE-Regions.md sha256=1e07321f364da4edf992383a15984e15d3fce1ee6dbaedc2205212e8ce177fd8 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=3248aa975b8064fb39f4faa0a1a43dee44c0c657a7330898e564f955c493408e
  FEATURE-Summary.md sha256=843cae0b4108572c56b3c04607629f35d9f353f62dde16836ad1ddb1a3665309 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=6db1e1b15154a8e3e706f8afc929840463ae241b603157b6bd78a690c93e09b7
  FEATURE-TestSuite.md sha256=11fd48a7e306837e4e8cd2a83adf155f2f520b0bf1aab3e7dd239e828eb7c7c2 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-3 applied_at=2026-10-25T01:24:22+00:00 build_sha256=ead73bbd14b5c89c72b84ef3dcfc9427ae43ce1f340cd9101f2d23d30765ed33
  FEATURE-Top.md sha256=3820e10ed7dcbcc7be764ca5a0c7bc902655ec74e40f5bfa0a7ccce40d88de14 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-4 applied_at=2026-10-25T01:30:38+00:00 build_sha256=0e7cb4b4f43f34c6abded42f90ec8fb91018326951c343a4bcc5337b106f4004
  VERIFICATION.md sha256=777dc32f98273a52fd4f8e6bb7e851fd4791e6e82a98034bf2ba33d14f5e40b6 commit=9eb0adcedc100918d42a28c6ceb820d96cfa935f applied_by=block-5 applied_at=2026-10-25T01:33:18+00:00 build_sha256=e3bfaac537324e12ebd976be07b79133d1aeec17181dcd426d291f51bae2f712
## story 1: Stand up the Python project tree, environment, dependency manifest, and pytest runner.
id:           architecture
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-1.md
summary:      Stand up the Python project tree, environment, dependency manifest, and pytest runner.
type:         foundational
kind:         capability
phase:        1
block:        1
implements:   ARCHITECTURE.md
instructions: |
  Create the application root with pyproject.toml, a committed uv.lock, a .venv created by uv venv,
  a tests/ directory, and a conftest.py that exposes the cli_runner fixture.

  Python 3.11 or newer, standard library only at runtime. pytest is the only dev dependency.

  Never read sources/run.sh or the snapshot from application code.
stack:        common.md, python.md
stack_mode:   builder
size:         7283
provides:     project tree, pytest runner
acceptance:   yes
state: closed/implemented

## story 2: Publish the cli package, main entry point, cli_runner test helper, and the quakes launcher.
id: cli-foundation
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-2.md
summary: Publish the cli package, main entry point, cli_runner test helper, and the quakes launcher.
type: foundational
kind: capability
phase: 1
block: 2
implements: FEATURE-CliFoundation.md
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: builder
size: 8060
provides: cli.main, cli.testing.cli_runner, ./quakes
instructions: |
  Create cli/__init__.py with main(argv=None) -> int and cli/testing.py with cli_runner per the
  Foundation Contract in TECHNOLOGY_STACK.md.
  
  Create an executable file named quakes at the application root that calls cli.main and exits
  with its return value.
  
  Dispatch is a skeleton here; later stories register the commands.
acceptance: yes
depends: architecture
state: closed/implemented

## story 3: Parse and validate the command, options, and file argument, with usage errors exiting 2.
id: options
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Parse and validate the command, options, and file argument, with usage errors exiting 2.
type: service
kind: capability
phase: 2
block: 3
implements: FEATURE-Options.md
covers: CLI-001
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 9279
provides: parse_args
instructions: |
  Command first, options in any order, file last. Each command accepts only its listed options.
  Decimals match -?[0-9]+(\.[0-9]+)?. --n is a positive integer. --lat in -90..90, --lon in
  -180..180, --radius positive, near requires all three. Missing or extra file, unknown command,
  and no command are usage errors.
  
  Do not use argparse default error behavior that prints to stdout; usage errors raise a UsageError
  that the dispatcher maps to exit 2.
acceptance: yes
depends: cli-foundation
state: closed/implemented

## story 4: Map usage and operational failures to exit codes 2 and 1 with silent stdout and one stderr line.
id: exit-codes
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Map usage and operational failures to exit codes 2 and 1 with silent stdout and one stderr line.
type: service
kind: capability
phase: 2
block: 3
implements: FEATURE-ExitCodes.md
covers: CLI-002
accepts: st-007
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 8411
provides: UsageError, OperationalError, exit code mapping
instructions: |
  Define UsageError (exit 2) and OperationalError (exit 1). main catches them, writes exactly one
  diagnostic line to stderr, and writes nothing to stdout. Reports build their full output before
  writing so a failure leaves stdout empty. Success, including empty reports, is exit 0.
acceptance: yes
depends: options
state: closed/implemented

## story 5: Format times, magnitudes, depths, distances, and CSV output.
id: formatting
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Format times, magnitudes, depths, distances, and CSV output.
type: service
kind: capability
phase: 2
block: 3
implements: FEATURE-Formatting.md
covers: FMT-001
context: ARCHITECTURE_compact.md
stack: python.md
stack_mode: consumer
size: 5845
provides: format_time, format_mag, format_mean, format_decimal, write_csv
instructions: |
  Time is UTC YYYY-MM-DDTHH:MM:SSZ truncated to whole seconds from epoch milliseconds. Magnitude has
  one decimal. mean_mag has two decimals and depth_km and distance_km one decimal, all rounded half
  up using decimal.Decimal with ROUND_HALF_UP on the exact repr of the value. CSV is written with
  the csv module, lineterminator "\n", UTF-8 stdout.
acceptance: yes
depends: architecture
state: closed/implemented

## story 6: Read a saved GeoJSON file and validate that it is a FeatureCollection.
id: feed-validation
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Read a saved GeoJSON file and validate that it is a FeatureCollection.
type: service
kind: capability
phase: 2
block: 3
implements: FEATURE-FeedValidation.md
covers: READ-001
context: ARCHITECTURE_compact.md
stack: python.md
stack_mode: consumer
size: 5972
provides: read_feed
instructions: |
  read_feed(path) returns the features list. An unreadable file, non-JSON content, or a value that
  is not an object with "type" equal to "FeatureCollection" and a list "features" raises
  OperationalError.
acceptance: yes
depends: exit-codes
state: closed/implemented

## story 7: Extract event fields from features and exclude null-magnitude events.
id: event-extraction
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Extract event fields from features and exclude null-magnitude events.
type: service
kind: capability
phase: 2
block: 3
implements: FEATURE-EventExtraction.md
covers: READ-002
context: ARCHITECTURE_compact.md
stack: python.md
stack_mode: consumer
size: 5712
provides: extract_events, Event
instructions: |
  Read id, properties.mag, properties.place, properties.time, properties.tsunami, and
  geometry.coordinates [lon, lat, depth_km]. Ignore every other field. A feature whose mag is null
  is dropped. A null place stays None here; regions handle it.
acceptance: yes
depends: feed-validation
state: closed/implemented

## story 8: Apply the --min-mag filter to events.
id: mag-filter
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Apply the --min-mag filter to events.
type: service
kind: capability
phase: 2
block: 3
implements: FEATURE-MagFilter.md
covers: READ-003
accepts: st-005
context: ARCHITECTURE_compact.md
stack: python.md
stack_mode: consumer
size: 5329
provides: filter_events
instructions: filter_events(events, min_mag) keeps events with mag >= min_mag; None keeps all.
acceptance: yes
depends: event-extraction
state: closed/implemented

## story 9: Provide bin/test.sh running the pytest suite.
id: test-suite
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-3.md
summary: Provide bin/test.sh running the pytest suite.
type: service
kind: test harness
phase: 2
block: 3
implements: FEATURE-TestSuite.md
covers: TEST-001
accepts: st-002
context: ARCHITECTURE_compact.md
stack: common.md, python.md
stack_mode: consumer
size: 8056
provides: bin/test.sh
instructions: |
  POSIX sh script that changes to the application root, activates .venv when present, and runs
  pytest -q unfiltered, exiting with pytest's status. Tests stub HTTP and never use the network.
acceptance: yes
depends: architecture, cli-foundation
state: closed/implemented

## story 10: The summary report.
id: summary
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: The summary report.
type: service
kind: capability
phase: 3
block: 4
implements: FEATURE-Summary.md
covers: SUM-001
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 10126
provides: quakes summary
consumes: read_feed, extract_events, filter_events, write_csv, parse_args
instructions: |
  Header events,first,last,min_mag,max_mag,mean_mag,tsunami. One row; first and last are the
  earliest and latest times; tsunami counts events equal to 1. No events yields 0,,,,,,0.
acceptance: yes
depends: mag-filter, formatting
state: closed/implemented

## story 11: The regions report of events per region.
id: regions
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: The regions report of events per region.
type: service
kind: capability
phase: 3
block: 4
implements: FEATURE-Regions.md
covers: REG-001
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 9616
provides: quakes regions
consumes: read_feed, extract_events, filter_events, write_csv, parse_args
instructions: |
  Header region,events,max_mag. Region is the text after the last ", " in place, else the whole
  place; null place is Unknown. Order by events descending then region ascending by byte value.
acceptance: yes
depends: mag-filter, formatting
state: closed/implemented

## story 12: The daily report of events per UTC date.
id: daily
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: The daily report of events per UTC date.
type: service
kind: capability
phase: 3
block: 4
implements: FEATURE-Daily.md
covers: DAY-001
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 9962
provides: quakes daily
consumes: read_feed, extract_events, filter_events, write_csv, parse_args
instructions: |
  Header date,events,max_mag. One row per date with events, ascending, then TOTAL,<events>,<max>.
  Date is the first 10 characters of the formatted time. No events yields TOTAL,0,.
acceptance: yes
depends: mag-filter, formatting
state: closed/implemented

## story 13: The top report listing the largest events.
id: top
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: The top report listing the largest events.
type: service
kind: capability
phase: 3
block: 4
implements: FEATURE-Top.md
covers: TOP-001
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 9964
provides: quakes top
consumes: read_feed, extract_events, filter_events, write_csv, parse_args
instructions: |
  Header time,mag,depth_km,place,id. Sort by mag descending then time ascending, take --n
  (default 10). Filter applies before the cut.
acceptance: yes
depends: mag-filter, formatting
state: closed/implemented

## story 14: The fetch command that downloads a USGS date range to a file.
id: fetch
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: The fetch command that downloads a USGS date range to a file.
type: service
kind: integration
phase: 3
block: 4
implements: FEATURE-Fetch.md
covers: FETCH-001
accepts: st-006, st-008
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 10213
provides: quakes fetch, build_url, http_get
consumes: parse_args, read_feed
instructions: |
  Request https://earthquake.usgs.gov/fdsnws/event/1/query with format=geojson, starttime, endtime,
  minmagnitude (default 2.5), orderby=time-asc, using urllib.request via a single replaceable
  function http_get(url) returning (status, body bytes). Write the body unchanged to --out and print
  fetched,<count>. Tests stub http_get and never open a network connection.
acceptance: yes
depends: options, exit-codes, feed-validation
state: closed/implemented

## story 15: Fetch fails without writing a file on network, HTTP, or body errors.
id: fetch-failure
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: Fetch fails without writing a file on network, HTTP, or body errors.
type: service
kind: capability
phase: 3
block: 4
implements: FEATURE-FetchFailure.md
covers: FETCH-002
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 9538
provides: fetch failure handling
consumes: http_get
instructions: |
  A network error, status other than 200, or body that is not a FeatureCollection raises
  OperationalError (exit 1) before any file is created. A pre-existing output file is left untouched.
acceptance: yes
depends: fetch
state: closed/implemented

## story 16: The near report using haversine distance.
id: near
finding: ADVISORY: implemented, not verified — no governed acceptance command covers this story. Declare one in ACCEPTANCE.json to gate it.
evidence: evidence/block-4.md
summary: The near report using haversine distance.
type: service
kind: capability
phase: 3
block: 4
implements: FEATURE-Near.md
covers: NEAR-001
accepts: st-004
context: ARCHITECTURE_compact.md
stack: python.md, cli.md
stack_mode: consumer
size: 10258
provides: quakes near, haversine_km
consumes: read_feed, extract_events, filter_events, write_csv, parse_args
instructions: |
  Header distance_km,time,mag,place,id. Haversine on a 6371.0 km sphere. Include events with
  distance <= --radius (compare unrounded distance), ordered by distance ascending then time
  ascending. Distance is written with one decimal, rounded half up.
acceptance: yes
depends: mag-filter, formatting
state: closed/implemented

## story 17: Terminal gate running the supplied grader against the finished application.
id:           verification
finding: ADVISORY: implemented, not verified — every binding criterion this story passed was already green before the story built, so none measured the work. Repair the criteria in the Blueprint to exercise this story and rebuild to obtain a verdict.
evidence: evidence/block-5.md
summary:      Terminal gate running the supplied grader against the finished application.
type:         feature
kind:         test harness
phase:        4
block:        5
implements:   VERIFICATION.md
accepts:      st-001, st-003
instructions: |
  Assembly story. Run sh sources/run.sh with Suite: full and require exit 0, and run sh bin/test.sh
  requiring exit 0. Do not modify anything under sources/.
stack:        common.md
stack_mode:   consumer
size:         4575
depends:      summary, top, daily, regions, near, fetch-failure, test-suite
acceptance:   yes
state: closed/implemented
