Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,30 @@ on:
pull_request:

jobs:
core-fill-tests:
rust-core:
name: Rust core (tests, formatting, lint)
runs-on: ubuntu-latest

timeout-minutes: 15
steps:
- uses: actions/checkout@v7.0.1
- uses: denoland/setup-deno@v2.0.5
with:
deno-version: v2.x

- uses: dtolnay/rust-toolchain@v1
- run: deno task test:core-fill

extension-build:
with:
toolchain: stable
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --manifest-path rust/pdftool_core/Cargo.toml -- --check
- name: Run unit tests
run: cargo test --manifest-path rust/pdftool_core/Cargo.toml --locked
- name: Run Clippy
run: cargo clippy --manifest-path rust/pdftool_core/Cargo.toml --locked --all-targets -- -D warnings

workflow-lock:
name: Verify Actions lockfile
runs-on: ubuntu-latest

timeout-minutes: 5
steps:
- uses: actions/checkout@v7.0.1
- uses: denoland/setup-deno@v2.0.5
with:
deno-version: v2.x

- uses: dtolnay/rust-toolchain@v1
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: "latest"

- run: deno task build:wasm
- run: deno task build
- name: Install GNU awk
run: sudo apt-get update && sudo apt-get install -y gawk
- name: Verify workflow lockfile
run: ./scripts/check-lock-sync.sh
60 changes: 17 additions & 43 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,35 @@ icons)
operations
* `+scripts/+` — build helpers for WASM and extension bundles

== Quick Start
== Current status

[arabic]
. Install dependencies (Deno-first):
+
[source,bash]
----
deno install
----
The Rust PDF core is implemented and has unit tests. The browser-extension
frontend is a prototype: this checkout does not include an AffineScript compiler
configuration, JavaScript package manifest, or a reproducible extension bundle
pipeline. Therefore the previously documented `deno task build`, `deno task dev`,
and `deno task test:core-fill` commands are not available and the extension is
not currently release-ready.

[arabic]
. Build AffineScript output and bundle extension assets:
+
[source,bash]
----
deno task build
----
== Rust core development

[arabic]
. Build the Rust WASM package:
+
[source,bash]
----
deno task build:wasm
----
Run the implemented native checks from the repository root:

[arabic]
. Run the extension in Firefox via `+web-ext+`:
+
[source,bash]
----
deno task dev
cargo fmt --manifest-path rust/pdftool_core/Cargo.toml -- --check
cargo test --manifest-path rust/pdftool_core/Cargo.toml --locked
cargo clippy --manifest-path rust/pdftool_core/Cargo.toml --locked --all-targets -- -D warnings
----

[arabic]
. Run core fill fixture tests (error taxonomy + AcroForm writeback):
+
Build the Rust WASM package (requires `wasm-pack` and the WASM Rust target):

[source,bash]
----
deno task test:core-fill
scripts/build-wasm.sh
----

See `+rust/pdftool_core/README.adoc+` for scope and known limitations.

== Notes

* Rust `+fill_blocks+` now performs AcroForm-aware writeback for
Expand All @@ -69,19 +56,6 @@ text/select and button widgets, and emits structured taxonomy errors
Rust WASM boundary.
* Source files include SPDX headers targeting MPL-2.0.

== Firefox Troubleshooting

* If `+deno+` `+task+` `+dev+` fails with `+ECONNREFUSED+`
`+127.0.0.1:<port>+`, verify Firefox is installed and runnable.
* Close stale Firefox instances launched by prior `+web-ext+` sessions,
then retry `+deno+` `+task+` `+dev+`.
* You can run `+web-ext+` directly with an explicit binary when needed:
+
[source,bash]
----
deno run -A npm:web-ext run --source-dir dist --firefox /usr/bin/firefox
----

== Architecture

See TOPOLOGY for a visual architecture map and completion dashboard.
Expand Down
45 changes: 30 additions & 15 deletions rust/pdftool_core/README.adoc
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
== pdftool_core
= pdftool_core

Rust/WASM core for `+blocky-writer+`.
Rust/WASM core for `blocky-writer`.

=== Current scope
== Implemented

* Exposes `+detect_blocks(pdf_data)+` for block metadata extraction
(placeholder output for now).
* Exposes `+fill_blocks(pdf_data, blocks, fields)+` for writeback
(currently passthrough).
* `detect_blocks` parses PDF AcroForm widget annotations and returns their
labels and rectangles. It does not perform OCR or general-purpose visual
block detection.
* `fill_blocks` updates matching AcroForm field values and returns serialized
PDF bytes. It supports the field types and validation covered by the unit
tests; it is not a PDF renderer.
* Core parsing and writeback behavior is covered by Rust unit tests in
`src/lib.rs`.

=== Build
== Native development checks

From the repository root:

[source,bash]
----
wasm-pack build --target web --out-dir pkg
cargo fmt --manifest-path rust/pdftool_core/Cargo.toml -- --check
cargo test --manifest-path rust/pdftool_core/Cargo.toml --locked
cargo clippy --manifest-path rust/pdftool_core/Cargo.toml --locked --all-targets -- -D warnings
----

=== Next implementation milestones
== WebAssembly packaging

Install Rust with the `wasm32-unknown-unknown` target and `wasm-pack`, then run:

[source,bash]
----
scripts/build-wasm.sh
----

[arabic]
. Parse PDF page geometry and form widgets.
. Integrate OCR-backed fallback for scanned documents.
. Write field values back into PDF objects with deterministic
positioning.
The extension frontend currently has no checked-in compiler/package manifest or
reproducible bundle build. The `.affine` source files are a prototype and are
not presently wired into a verified extension build. Do not treat the frontend
as a release-ready browser extension until that toolchain and its integration
tests are established.