Skip to content

Export tables.tsv: flat inventory of captured doc tables (#111)#112

Merged
mobileskyfi merged 2 commits into
mainfrom
export-tables-inventory
Jul 17, 2026
Merged

Export tables.tsv: flat inventory of captured doc tables (#111)#112
mobileskyfi merged 2 commits into
mainfrom
export-tables-inventory

Conversation

@mobileskyfi

@mobileskyfi mobileskyfi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Adds a top-level tables.tsv dataset to rosetta export — the "what tables exist and where" list, an intermediate step under #104 taken before E4.

What

One flat row per page_tables record (855 on the rc.99 corpus), ordered by the UNIQUE(page_id, sort_order) key:

group columns
page identity page_id, rosetta_id, slug, title, url
section provenance section_id, section_anchor, source_heading
position + link sort_order, table_url
shape + size column_count, data_row_count, is_ragged, raw_bytes
  • table_url deep-links to the section containing the table (url#anchor). Docusaurus has no per-table anchor, so a table with no resolvable section (16/855 on rc.99) links to the bare page URL; a page with no URL yields NULL.
  • raw_bytes is the UTF-8 size of the stored raw_markdown (source, not rendered). The cell data itself is not exported here — that stays E4.

Why

Today tables surface only as counts (table_count/table_row_count on pages.tsv/sections.tsv). This lists the actual tables with a per-row manual.mikrotik.com deep link, covering most of the need to export table data without E4's variable per-fragment file set (blocked on #108).

Contract fit

Flat top-level dataset: no variable file set, no #108 dependency. Reuses the settled TSV serialization + manifest.toml provenance + manifest-owned prune/ownership. Adds one disclosure (table_url granularity + raw_bytes) and an anchor test asserting shape/size/deep-link for a seeded table.

Verification

  • bun test src/export.test.ts — 29 pass (new tables.tsv test + updated ALL_FILES; determinism/boundary tests unchanged).
  • Exported the rc.99 release DB (schema v10, 363 pages): 8 datasets, tables.tsv = 855 rows; spot-checked section-linked and NULL-section (\N) rows and the manifest [[files]] entry.
  • biome check clean on both changed source files.

Scope

Does not close #104 — E4 (per-fragment cell files, blocked on #108) and E3 (products) remain. Closes #111.

Summary by CodeRabbit

  • New Features
    • Added a tables.tsv export containing an inventory of captured document tables.
    • Included table location, dimensions, raggedness, source size, and deep links to owning sections when available.
    • Added tables.tsv to the exported dataset set and documented its contents.

Add a top-level `tables.tsv` dataset to `rosetta export` — one row per
`page_tables` record (855 on the rc.99 corpus) with page/section
provenance, table shape (column/data-row counts, ragged flag), source
size (`raw_bytes`, UTF-8 length of the stored Markdown), and a
`table_url` deep-linking to the containing section (`url#anchor`; bare
page URL when no section resolves, since Docusaurus has no per-table
anchor; NULL when the page has no URL).

This is the "what tables exist and where" list — it answers most
table-audit questions that today only `table_count`/`table_row_count`
on pages.tsv/sections.tsv hint at, without exporting the cell data
itself (the per-fragment cell files remain E4, blocked on #108).

Flat top-level dataset: no variable file set, no #108 dependency,
reusing the settled TSV/manifest contract and manifest-owned prune.
Adds a disclosure for table_url granularity + raw_bytes, and an anchor
test asserting shape/size/deep-link for a seeded table.

Closes #111. Intermediate step under #104 (E4/E3 unchanged).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 17, 2026 16:15
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1e6a1315-45c0-4ed6-9cb8-846d60d3c091

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

rosetta export now emits tables.tsv, containing one row per captured document table with provenance, shape metrics, source size, and section deep-link metadata. Export tests validate the new dataset and its deterministic file contract.

Changes

Tables export

Layer / File(s) Summary
Table dataset reader and export wiring
src/export.ts
readTables joins stored tables with pages and sections, computes table_url and raw_bytes, registers tables.tsv, and documents its field semantics.
Export contract validation and release documentation
src/export.test.ts, CHANGELOG.md
Export expectations and seeded-row assertions cover tables.tsv; the unreleased changelog describes the dataset.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

  • tikoci/rosetta issue 95 — Covers the table storage and export surface used by tables.tsv.

Possibly related PRs

  • tikoci/rosetta#99 — Introduced the normalized table storage and section provenance queried by this export.
  • tikoci/rosetta#103 — Established the export dataset and manifest pipeline extended with tables.tsv.
  • tikoci/rosetta#105 — Changed section attribution used for exported table anchors.

Suggested labels: area:docusaurus

Suggested reviewers: copilot

Sequence Diagram(s)

sequenceDiagram
  participant runExport
  participant readTables
  participant SQLite
  participant manifest
  runExport->>readTables: request tables.tsv rows
  readTables->>SQLite: query page_tables with pages and sections
  SQLite-->>readTables: table metadata and provenance
  readTables-->>runExport: tables.tsv dataset
  runExport->>manifest: serialize dataset metadata
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly summarizes the main change: adding a flat tables.tsv export.
Linked Issues check ✅ Passed Meets [#111] tables.tsv inventory requirements and the relevant export-contract expectations from [#104].
Out of Scope Changes check ✅ Passed No unrelated changes were introduced; export, tests, and changelog all support tables.tsv.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch export-tables-inventory

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new top-level export dataset (tables.tsv) to rosetta export, providing a flat inventory of captured Markdown tables (page_tables) with page/section provenance, deep-link URL, shape metrics, and source-size (raw_bytes) for table-audit workflows.

Changes:

  • Add readTables() dataset reader to emit tables.tsv and register it in DATASET_READERS, plus a new disclosure describing table_url + raw_bytes.
  • Extend src/export.test.ts to expect tables.tsv and assert deep-link/shape/size for a seeded table row.
  • Add a [Unreleased] changelog entry describing the new dataset.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/export.ts Adds tables.tsv dataset reader, computes table_url and raw_bytes, registers dataset, and adds disclosure.
src/export.test.ts Updates expected export file set and adds a focused tables.tsv test for link/shape/bytes.
CHANGELOG.md Documents the new tables.tsv dataset under [Unreleased].

Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/export.test.ts`:
- Line 312: Update the assertion in the relevant export test to use the exported
utf8Bytes helper from export.ts instead of calling Buffer.byteLength directly,
while preserving the existing input string and expected comparison.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a794dcb5-d009-47ec-906d-64f162b2954a

📥 Commits

Reviewing files that changed from the base of the PR and between a153888 and b85f825.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/export.test.ts
  • src/export.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: copilot-pull-request-reviewer
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Bun and TypeScript, including Bun-native runtime APIs such as bun:sqlite, Bun.serve, and bunx.

Rosetta uses Bun and TypeScript; prefer bun and bun test rather than Node/npm-oriented substitutes.

Files:

  • src/export.ts
  • src/export.test.ts
*

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Keep this Copilot instructions file short; put substantive rules in narrow instruction files under .github/instructions/*.instructions.md.

Files:

  • CHANGELOG.md
CHANGELOG.md

📄 CodeRabbit inference engine (CLAUDE.md)

Record user-visible shipped changes in CHANGELOG.md under [Unreleased] or release sections.

Files:

  • CHANGELOG.md
**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Prefer each document's canonical home and do not duplicate operational detail, schema blocks, or long rule lists in the routing index.

Files:

  • CHANGELOG.md
🔇 Additional comments (4)
src/export.ts (2)

353-394: LGTM!


532-532: LGTM!

Also applies to: 558-561

src/export.test.ts (1)

123-123: LGTM!

CHANGELOG.md (1)

29-30: LGTM!

Comment thread src/export.test.ts Outdated
- MANUAL.md: add tables.tsv to the export output tree + prose, noting
  cell data is not exported here (Copilot).
- CHANGELOG.md: cite the tracking issue #111, not the #104 umbrella
  (Copilot).
- export.test.ts: use the exported utf8Bytes helper instead of a raw
  Buffer.byteLength call (CodeRabbit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mobileskyfi
mobileskyfi merged commit 92ba5d4 into main Jul 17, 2026
8 checks passed
@mobileskyfi
mobileskyfi deleted the export-tables-inventory branch July 17, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants