Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "v2.3"
target-branch: "v2.4"
schedule:
interval: "weekly"
pull-request-branch-name:
Expand All @@ -12,7 +12,7 @@ updates:
prefix: "🔧[Config] "
- package-ecosystem: "npm"
directory: "/"
target-branch: "v2.3"
target-branch: "v2.4"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- main
- v2
- v2.3
- v2.4

permissions:
contents: read
Expand Down Expand Up @@ -88,6 +88,12 @@ jobs:
- name: Verify responsive navigation, metadata layouts and accessibility
run: node tests/browser/responsive.mjs

- name: Verify scanner inputs, orientation, lifecycle and privacy
run: node tests/browser/scanner.mjs

- name: Verify scanner PDF output, source quality and lifecycle
run: node tests/browser/scanner-pdf.mjs

- name: Inspect isolated release review artifact
run: node scripts/inspect-release-artifact.mjs

Expand All @@ -107,4 +113,6 @@ jobs:
path: |
.ts-build/production-smoke
.ts-build/responsive
.ts-build/scanner-qa
.ts-build/scanner-pdf-qa
retention-days: 7
4 changes: 2 additions & 2 deletions .github/workflows/security-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Security monitoring

on:
pull_request:
branches: [v2.3, main]
branches: [v2.4, main]
push:
branches: [v2.3, main]
branches: [v2.4, main]
schedule:
- cron: '29 3 * * 3'
workflow_dispatch:
Expand Down
12 changes: 6 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Protected branches

- `main` is production-only. `v2.3` is the active integration branch for the v2.3.0 development cycle.
- Never commit feature, fix, test, or chore work directly to `main` or `v2.3`.
- `main` is production-only. `v2.4` is the active integration branch for the v2.4.0 development cycle, bootstrapped from production `main` after v2.3.0.
- Never commit feature, fix, test, or chore work directly to `main` or `v2.4`.

## Development work

- Create short-lived `feat/*`, `fix/*`, `test/*`, or `chore/*` branches from `v2.3`.
- Sprint and routine development pull requests target `v2.3`, not `main`.
- Create short-lived `feat/*`, `fix/*`, `test/*`, or `chore/*` branches from `v2.4`.
- Sprint and routine development pull requests target `v2.4`, not `main`.
- After a successful merge, delete only the merged short-lived branch when cleanup is authorized.

## Commit messages
Expand All @@ -30,8 +30,8 @@

## Production promotion

- Normal development reaches `main` only through a dedicated release or hardening pull request from `v2.3`.
- Creating the v2.3.0 tag or release requires separate explicit authorization after final verification.
- Normal development reaches `main` only through a dedicated release or hardening pull request from `v2.4`.
- Creating the v2.4.0 tag or release requires separate explicit authorization after final verification.

## Hotfixes

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.4.0 — Unreleased

- Add source-resolution Scan to PDF with per-page appearance, EXIF-aware ordered pages, A4 fitting, cancellable generation, local PDF preview/download, export workload limits and cleanup.

- Add Document Scanner Core with local JPEG/PNG/WebP input, page ordering, removal, clear, EXIF-aware bounded previews, and Original/Grayscale/Document modes.
- Bound the scanner queue to 20 pages and 200 MiB, release temporary resources, and invalidate cancelled or replaced preview work.
- Establish v2.4 integration policy and scanner regression/browser coverage. PDF export and scanner OCR are reserved for later sprints.

## 2.3.0 — Release candidate, unpublished

### Security and reliability
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ Release history is recorded in the [changelog](./CHANGELOG.md). The current v2.0
Source: [SecureToolsProject/Secure_Tools](https://github.com/SecureToolsProject/Secure_Tools)

See [LICENSE](./LICENSE). Vendored third-party code retains its own license beside each dependency.

## v2.4 development

Document Scanner Core is available in the development build at `/scan/document/`: local multi-image input, accessible ordering, orientation-aware previews, and Original/Grayscale/Document appearance. Scan to PDF now exports source-resolution pages with per-page appearance, progress/cancel, local PDF preview and download. Optional scanner OCR remains planned. See [Sprint 24B implementation and QA](docs/sprint-24b-scan-to-pdf.md). See [Sprint 24A implementation and QA](docs/sprint-24a-scanner-core.md).
10 changes: 10 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,13 @@ Secure Tools may evolve as both:
- a discovery hub for separately deployed companion applications that need different runtime or resource models.

This is a direction, not a current integration contract. There is no companion registry, external-application schema, plugin framework, service discovery mechanism, or v3 navigation implementation in the present architecture.

## Document Scanner Core (v2.4 / 24A)

`tools/shared/scan.ts` decodes through the existing signature-validated, EXIF-aware image helper, bounds previews to 1,000 pixels on the longest edge, composites transparency over white, and provides deterministic pixel preprocessing. `tools/scan/document/state.ts` holds ordered source Files and preview URLs, with 20-page/200-MiB aggregate limits, per-operation cancellation and stale-result guards. It releases replaced/removed/cleared URLs and decoded/canvas resources. Only one current queue operation may publish results. The UI is a static ES module with native picker, drop/paste inputs and keyboard ordering.

Appearance is recorded per page; cancelling a batch retains completed previews. Apply to all pages retries the selected mode. Originals remain immutable and are retained as File references for future full-resolution export. 24B must decode originals again and must not compose a PDF from bounded thumbnails. Shared OCR/PDF services remain unchanged. No new external service, persistence, runtime dependency or CSP relaxation is introduced.

## Scanner PDF export (v2.4 / 24B)

`tools/scan/document/pdf.ts` composes ordered source Files with their per-page modes through the existing Images to PDF writer. `renderScanImage` shares preview preprocessing at full source resolution, using bounded pixel strips; PNG output preserves the document threshold. Exports are serialized and guarded against stale publication. `result.js` reuses LocalPdfRenderer for a bounded canvas preview and destroys its worker/document on invalidation. The UI owns output Blob/download lifetime; changes to source/order/appearance discard the result. See [24B implementation, budgets and verification](sprint-24b-scan-to-pdf.md).
20 changes: 11 additions & 9 deletions docs/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@ Secure Tools separates product versions from Sprint numbers. A Sprint is a bound
## Branch roles

- `main` is the production branch. Routine development does not target it.
- `v2.3` is the active integration branch for the v2.3.0 cycle.
- Short-lived `feat/*`, `fix/*`, `test/*`, and `chore/*` branches start from `v2.3` and return through pull requests into `v2.3`.
- Direct feature or fix commits to `main` or `v2.3` are prohibited.
- `v2.4` is the active integration branch for the v2.4.0 cycle.
- Short-lived `feat/*`, `fix/*`, `test/*`, and `chore/*` branches start from `v2.4` and return through pull requests into `v2.4`.
- Direct feature or fix commits to `main` or `v2.4` are prohibited.

```text
main (production)
↑
release PR after v2.3 hardening
release PR after v2.4 hardening
↑
v2.3 (active integration)
v2.4 (active integration)
↑
Sprint PRs
↑
feat/* fix/* test/* chore/*
```

The v2.4 branch starts at production main commit `2eb8e865e32558bfd031cd65c85d5d0fea64f5c7`. The policy migration is reviewed as a separate prerequisite commit in the first v2.4 PR; no integration or production merge is implied. Existing v2.3 dependency proposals remain unmerged and require separate review.

## Sprint delivery

1. Update local `v2.3` from `origin/v2.3`.
1. Update local `v2.4` from `origin/v2.4`.
2. Create a short-lived branch from that exact integration state.
3. Commit and validate only the Sprint’s intended changes.
4. Open a pull request into `v2.3` and wait for required CI.
4. Open a pull request into `v2.4` and wait for required CI.
5. Treat review and merge as a separate step. An agent does not merge its own pull request or enable auto-merge unless the user explicitly authorizes that specific action.
6. After a successful merge and verification, remove the merged short-lived branch when branch cleanup is authorized.

Expand All @@ -40,12 +42,12 @@ CI validates non-merge commits introduced by the pull request’s actual base-to

## Production release

The v2.2.0 cycle is released. The v2.3.0 cycle is active development. After the v2.3.0 scope is integrated, complete release hardening and final verification on `v2.3`. Promote it through a dedicated `v2.3` → `main` pull request. Only after that pull request is explicitly reviewed and merged may a separately authorized task create the v2.3.0 tag and release.
The v2.3.0 cycle is released. The v2.4.0 cycle is active development. After the v2.4.0 scope is integrated, complete release hardening and final verification on `v2.4`. Promote it through a dedicated `v2.4` → `main` pull request. Only after that pull request is explicitly reviewed and merged may a separately authorized task create the v2.4.0 tag and release.

## Hotfixes

Urgent production fixes use a dedicated `hotfix/*` branch and pull request into `main`. They are never pushed directly. After production verification, carry the correction back into the active integration line as needed through an appropriate pull request.

## Enforced pull request policy

CI permits routine `feat/*`, `fix/*`, `test/*`, and `chore/*` pull requests into `v2.3`. Pull requests into `main` pass the branch-policy gate only when the head is exactly `v2.3` or a dedicated `hotfix/*` branch. The repository protects both long-lived branches with required pull requests, the existing `Validate static tools` check, resolved review conversations, blocked force pushes, and blocked deletion. Because the repository currently has one maintainer, an approving-review count is not required; explicit merge authorization remains mandatory.
CI permits routine `feat/*`, `fix/*`, `test/*`, and `chore/*` pull requests into `v2.4`. Pull requests into `main` pass the branch-policy gate only when the head is exactly `v2.4` or a dedicated `hotfix/*` branch. Existing main/v2.3 branch protections are unchanged. The new v2.4 branch does not inherit remote branch protections automatically; equivalent required-PR/check, resolved-conversation, force-push and deletion protections remain an administrator follow-up. This PR enforces the branch policy in CI but does not claim to configure remote protection settings. Because the repository currently has one maintainer, an approving-review count is not required; explicit merge authorization remains mandatory.
71 changes: 71 additions & 0 deletions docs/sprint-24a-scanner-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Sprint 24A — Document Scanner Core

## Implementation

The v2.4 development scanner is `/scan/document/`. It accepts signature-validated JPEG, PNG and WebP from the native multi-file picker, drop and paste. Pages can be moved with semantic keyboard-accessible buttons, removed, or cleared. All six existing locales are supported. Original, Grayscale and Document modes operate locally; Document uses a deterministic threshold of 160, with no corner detection or perspective correction.

Previews retain aspect ratio and EXIF normalization through `decodeImage`. Each preview is at most 1,000 pixels on its longest edge. Source File references remain unchanged; decoded bitmaps and canvas backing stores are released after processing. Preview URLs are revoked on replacement, removal, clear and page exit. The queue admits at most 20 pages / 200 MiB total, plus existing 50-MiB-file / 50-megapixel / 16,384-pixel decoder limits. Oversized or broken inputs produce recoverable messages, while valid files in the batch remain available.

Adding another batch cancels publication from the previous batch. Clear and cancellation invalidate in-flight results. Cancelling appearance changes retains completed pages with their actual mode labels; Apply to all pages is the retry mechanism. Native decoding/encoding cannot be interrupted mid-call, but resources are released and stale results cannot enter the queue. Replacement previews wait for existing native work to finish, preventing overlapping full-resolution decodes under rapid input changes.

## Branch policy

Production `main` and tag v2.3.0 were inspected at `2eb8e865e32558bfd031cd65c85d5d0fea64f5c7`; no v2.4 branch existed. v2.4 was bootstrapped from that production commit. The prerequisite policy migration is an independent Config commit in the scanner feature branch, covering AGENTS, workflow documentation, CI/security triggers, Dependabot targets and policy tests. It remains reviewable in the v2.4 PR; neither integration nor production was merged. Existing v2.3 maintenance PRs were not changed. Remote protections do not inherit automatically onto a newly created branch; equivalent v2.4 protection settings remain an administrator follow-up. Dependabot’s new target configuration takes effect when present on the repository default branch; this task does not promote development changes into main.

## Verification

- `npm run typecheck`: passed.
- `npm run compile:ts`: passed.
- `node tests/scanner.test.mjs`: passed (state/order, all modes, invalid inputs, limits, stale completion, orientation contract, resource cleanup).
- `npm run build`: passed; 20 canonical pages, 17 existing redirects, pinned OCR/font asset checks unchanged.
- `npm test`: local functional/regression tests passed through release artifact checks; the HTTP hardening gate failed because host AdGuard rewrites CSP. The strict expected policy was preserved. Clean hosted CI is required for the full result.
- `node tests/browser/scanner.mjs`: completed 30 viewport/locale functional cases (320×568, 390×844, 844×390, 768×1024, 1280×900; en/ko/ja/es/de/fr), actual JPEG/PNG/WebP inputs, EXIF orientation=6 JPEG, grayscale pixels, Document mode, keyboard ordering/focus, removal/clear, drop/paste, two 12-megapixel photos, stale clear, URL cleanup. The local privacy gate failed on injected `local.adguard.org` traffic/CSP mutations; it was not waived. The same strict test is included in hosted CI.
- Browser screenshots were visually inspected at Korean 320px and English desktop widths. Physical mobile, Firefox and Edge were not exercised locally.

No upload, telemetry, document persistence, new dependency or global CSP change was added. Host-injected traffic is recorded separately from app behavior; a clean privacy pass must come from hosted CI. Local diagnostic output and screenshots are in ignored `.ts-build/scanner-qa/`; the hosted failure artifact retains the same directory.

## Follow-ups

24B: compose the ordered original source images with shared PDF tooling, applying the chosen per-page appearance at export resolution; add output preview/download, export budgets, cancellation and cleanup. Do not export thumbnail pixels. 24C: adapt the existing shared OCR worker service. 24D: adapt existing OCR geometry/searchable-PDF capabilities. No PDF export, OCR controls, searchable-PDF rewrite, library replacement, production deployment, release tag or merge is included here.

## Changed files

- `.github/dependabot.yml`
- `.github/workflows/ci.yml`
- `.github/workflows/security-monitoring.yml`
- `AGENTS.md`
- `CHANGELOG.md`
- `README.md`
- `docs/architecture.md`
- `docs/development-workflow.md`
- `docs/sprint-24a-scanner-core.md`
- `docs/tool-status.md`
- `js/i18n.js`
- `js/locales/document-scanner.js`
- `scripts/site-routes.mjs`
- `scripts/typescript-modules.mjs`
- `scripts/validate-branch-policy.mjs`
- `sitemap.xml`
- `tests/action-pins.test.mjs`
- `tests/branch-policy.test.mjs`
- `tests/browser/scanner.mjs`
- `tests/category-availability.test.mjs`
- `tests/ci-foundation.test.mjs`
- `tests/i18n-quality.test.mjs`
- `tests/pdf-to-text.test.mjs`
- `tests/release-hardening-http.test.mjs`
- `tests/run-all.mjs`
- `tests/scanner.test.mjs`
- `tests/security-monitoring.test.mjs`
- `tests/seo-foundation.test.mjs`
- `tests/typescript-foundation.test.mjs`
- `tests/url-namespace.test.mjs`
- `tools/scan/document/app.js`
- `tools/scan/document/index.html`
- `tools/scan/document/state.ts`
- `tools/scan/document/tool.css`
- `tools/scan/index.html`
- `tools/shared/image.d.ts`
- `tools/shared/scan.ts`
- `tsconfig.build.json`
- `tsconfig.json`
Loading
Loading