Skip to content

test: add focused Hypothesis coverage and daily exploration - #69

Open
hesreallyhim wants to merge 32 commits into
mainfrom
codex/narrow-generated-testing
Open

hesreallyhim wants to merge 32 commits into
mainfrom
codex/narrow-generated-testing

Conversation

@hesreallyhim

Copy link
Copy Markdown
Member

Adds generated tests for document semantics and preservation, core session transport, and hosted request parsing. Independent expectations catch input combinations missed by fixed examples, while durable documentation distinguishes product requirements from revisable format limitations and cache mechanics.

Supersedes the implementation proposal in #67. This branch includes the retained implementation and defect fixes from that PR, with the scope and interoperability changes described below.

Changes

  • Organize Hypothesis tests and strategies under tests/properties/ and web/tests/properties/. They run in ordinary test and coverage suites, with 100 examples per property and an extended 1,000-example profile. The initial scope excludes the Python-to-Node worker, broad service/cache mutation apparatus, and separate injection corpus; focused JavaScript and browser regressions remain.
  • Add daily and manually triggered extended testing, using read-only repository permissions and no production credentials. Document failure reproduction, public log visibility, and investigation. Existing Dependabot configuration covers the SHA-pinned actions.
  • Preserve interoperability when an otherwise valid document contains a non-UTF-8 configuration comment. Shared preparation regenerates exceptional config text from validated values, so both editors can process it. Ordinary UTF-8 formatting remains preserved; targeted tests cover byte-path identities, annotations, surrounding bytes, and document exchange through both editor-loading paths.
  • Retain fixes for noncanonical byte-path identities, byte-path placement errors, malformed captured browser settings, excessive state nesting, and forged response links, with focused regressions.
  • Define shared editor responsibilities around maintaining GitHub documentation. Tests do not establish persistence, session-sharing, or cross-version transport promises; current format limitations can evolve with the product. Clarify the reported-coverage thresholds enforced by the ruleset for PRs to main.
  • Adopt the MADR minimal template and concise historical ADRs, with attribution in THIRD_PARTY_NOTICES. Accepted ADR 0006 records that convention; accepted ADR 0007 supersedes 0003. Current requirements live in durable documentation.

Validation

Local validation on macOS, Python 3.11:

  • Core suite: 1,278 passed, 2 skipped; 99.45% coverage.
  • Hosted suite: 449 passed; 99.56% coverage.
  • Browser suite: 303 passed; JavaScript tests: 35 passed.
  • Ordinary and extended properties passed. The extended command also passed with CI=true: 26 core cases and 3 hosted properties.
  • Formatting, lint, core/hosted type checks, lock validation, actionlint, documentation links, and README integration passed.
  • Independent source/diff review against ADRs 0006 and 0007 found no actionable issues.

Windows and container builds were not rerun locally for this branch. GitHub CI results and execution of the new scheduled workflow remain to be observed.

hesreallyhim and others added 30 commits November 27, 2026 00:35
Development-only in both projects, locked with uv. Each suite registers an
ordinary and an extended profile; both disable per-example deadlines and
explicitly randomize, overriding Hypothesis's derandomized CI profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JSON can carry lone surrogates. Escapes of bytes that form valid UTF-8
(\udcc2\udc80 for U+0080) passed validation, then changed identity when a
document or transport re-encoded them. Only the canonical surrogateescape
decoding now identifies a path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Documents: generated trees render and parse to facts built from the model,
updates preserve bytes outside the region across BOM, CRLF, and fenced
examples, unsupported entries are document errors, and parsed documents
re-render to the same meaning. Unrepresentable symlink targets must be
rejected. Sessions: rejected edits change nothing, and JSON transport
preserves curation and later behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A placement conflict on a non-UTF-8 path put the raw question into the
error's extra fields, which bypassed message escaping, so the JSON response
failed to encode and the request returned 500 instead of 409.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Equivalent config is retained verbatim, so an undecodable byte in a config
comment reached the region text and the preview failed with 500 after the
snapshot was cached. The service shows the region as text, so it now
reports a curation error before caching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Define the browser test mechanism and Node requirement, the identity domain
and controlled errors, the fabricated-commit and server-state requirements,
unrepresentable entries on printed text, execution profiles, the shared
startup validator, and the URL-sink checks. Independent review corrected two
first-draft claims and found two hosted 500 responses, now fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hypothesis auto-loads its CI profile when CI is detected; deriving from the
default profile keeps local and CI settings identical apart from what the
suite chooses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A test-owned predicate reads names, targets, and annotations as printed,
with trailing whitespace escaped. The renderer must reject exactly the rows
it matches and round-trip all others, so an unexpected rejection and an
over-broad predicate both fail. Corrects the ADR example accordingly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Arbitrary JSON and single-field mutations of valid operation and placement
requests must end in domain rejections. Accepted requests keep their source
and stay within the snapshot tree; rejected ones leave the cache, including
expiry, unchanged and make no upstream request. Pinned commits drawn from
real objects and random hex never name the commit upstream or read trees
or blobs. Each example uses a fresh application.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A link or saved draft whose settings root was null, missing, or a malformed
byte path passed the shallow startup guard and threw while filling the form,
before the service could reject it; a draft failed later, on resume. One
validator now gates both journeys, so such links show the invalid-session
error and such drafts are never offered.

Responses also derive the repository link and history address from their own
identity: a forged permalink could otherwise yield a protocol-relative
address, and a forged link any URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JSON.parse accepts very deep input, but restoring the session serializes it
again, and JSON.stringify overflows the stack, leaving an unhandled
rejection at startup. Saved states nest about five levels; decodeState now
returns null beyond 32, so such links report invalid editing state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hypothesis generates fragments, routes, queries, captured sessions, stored
drafts, and synthetic responses; a persistent Node worker evaluates them
with the page's own logic.js and draft.js. Supported states keep identity,
accepted sessions can be displayed, offered drafts can be resumed, and
everything else ends in null or a controlled Error. Length and depth
boundaries are explicit. The worker reports exceptions as data, checks
Object.prototype, and restarts if it exits. Needs Node 24: skipped locally
without it, failed under CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mutations choose a depth before a member and favor type swaps, and each
example runs several independent single-field mutations in its fresh
application. A deterministic sweep replaces every member of a valid
operation and placement request with one value of each JSON type; it
catches an injected missing revision check on every run, which random
mutation found in about half of extended runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dedicated fixture repository commits HTML, SVG, and event-handler payloads
as Git paths and notes. Journeys through placement, the editor, Markdown
output, the source browser, query errors, script-scheme input, and a
synthetic forged repository link check literal text and the absence of
foreign markup, executed sentinels, dialogs, stray requests, and
navigation. Rendering journeys repeat with CSP bypassed in the test browser;
a control shows the sentinels notice a payload that does run.

Regressions cover links and drafts whose settings cannot be displayed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
make test-properties runs only the generated tests in both suites, and
make test-properties-extended raises the example budget. The coverage
workflow installs Node from .nvmrc, as the hosted job already does, because
the hosted suite now drives the page's JavaScript modules. The testing
policy describes generated tests, profiles, reproduction, and limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Budgets, measured runtimes, the defects found and fixed, and the
intentional-defect checks that each property detected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An absolute forged permalink with an empty owner still matched its own
repository fields and yielded a protocol-relative address. Owner, name, and
commit must now match the identities the service accepts, and the address is
built from them, keeping only the permalink's query.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
capturedValues returns the form values startup shows, or null, and both the
fragment and draft journeys use it. The decoding worker calls the same
function instead of repeating app.js's conversions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The earlier check rejected any undecodable byte in the loaded region, so a
hand-written row with a raw byte, which used to open and re-render with
escapes, returned 422. Only bytes retained verbatim, such as a config
comment, now need to be UTF-8; the composed region is checked before the
snapshot is cached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The error showed internal surrogates. It now names the text the escapes
spell, and a document-level regression covers a row written with escapes of
valid UTF-8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parametrized cases cover every rule the ADR lists, including representable
neighbors, for both the predicate and the renderer; generators now often end
names and targets with row syntax. The unsupported-entry property starts from
a representable model, avoids name collisions, and matches the error. The
prose filter follows the region finder's own boundary rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clock advances before each mutated request, so a rejected request that
renewed the snapshot lease now fails the expiry check. Request parsers may
not raise MarkerError; only SVG export may. The request log records full
URLs. Mutation documents its semantics and is never a no-op. Browser
identity compares JSON text, and synthetic addresses must resolve on the
page's origin. The worker shuts down through end of input, closes its pipes,
and gives each process its own reply queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop comments that narrate provenance or restate readable code, keeping
only those that give a non-obvious reason. Names now carry what comments
explained: RESPONSE_TIMEOUT_SECONDS, WORKER_EXITED, UNLIMITED,
servable_object_ids, isDisplayableSession, lenient_json_values,
TYPE_SWAP_VALUES, and test parameter ids. The prose filter imports the
region finder's boundary pattern instead of copying it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hesreallyhim
hesreallyhim marked this pull request as ready for review November 27, 2026 23:06

@BittuBarnwal7479 BittuBarnwal7479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I reviewed the test results and identified the following points:

Test results:

  • Core suite: 1267 passed, 3 symlink-related failures caused by Windows permission restrictions.
  • Web Python: 56 setup errors related to the quote "me".txt fixture, which also reproduces on main.

Review findings:

  1. PUBLIC_BASE_URL does not correctly handle URLs containing a path.
  2. Configuration comments containing non-UTF-8 bytes are not handled correctly.

Both issues are reproducible and need to be addressed. Thanks!

@hesreallyhim

Copy link
Copy Markdown
Member Author

Thanks @BittuBarnwal7479 !

Could you clarify the first review finding a little bit? We operate the editor at the domain root and don't permit prefixes in the format of the URL. Could you share a URL or request that fails on the hosted service or the PR preview?

For the second one: this branch regenerates otherwise valid config containing non-UTF-8 comment bytes, with regression coverage for preview and exchange between editors. If you can still reproduce a failure on 3abaabb, could you share the document and the steps you used?

Thanks! 🙏

@BittuBarnwal7479

Copy link
Copy Markdown
Member

Thanks @BittuBarnwal7479 !

Could you clarify the first review finding a little bit? We operate the editor at the domain root and don't permit prefixes in the format of the URL. Could you share a URL or request that fails on the hosted service or the PR preview?

For the second one: this branch regenerates otherwise valid config containing non-UTF-8 comment bytes, with regression coverage for preview and exchange between editors. If you can still reproduce a failure on 3abaabb, could you share the document and the steps you used?

Thanks! 🙏

Thanks for the clarification! I checked both findings again.

1. PUBLIC_BASE_URL

I'll withdraw this finding. I couldn't reproduce it on the hosted service or PR preview. My test used a hypothetical URL with a path prefix (https://example.org/ts), while the current deployment uses a bare domain. So I don't consider this a confirmed issue.

2. Non-UTF-8 configuration comments

I can still reproduce this on 3abaabb.

I created a README with a generated Treestamp configuration and added a comment containing a non-UTF-8 byte (0xFF) above root = "sub".

Running treestamp check README.md gives:

  • main (2.0.0): exits with code 0.
  • 3abaabb: exits with code 1 because the comment gets replaced with � during regeneration.

I understand that regenerating the configuration may be intentional. However, existing READMEs that passed treestamp check on the previous version will now fail after upgrading until they are regenerated.

@hesreallyhim
hesreallyhim force-pushed the codex/narrow-generated-testing branch from 4d83f10 to 9fc9de1 Compare November 28, 2026 20:11
Clarify supported config formatting edits and refresh the README treestamp.

Signed-off-by: Really Him <git-dev@hesreallyhim.com>
@hesreallyhim
hesreallyhim force-pushed the codex/narrow-generated-testing branch from 9fc9de1 to 70ada24 Compare November 28, 2026 20:33
Signed-off-by: Really Him <git-dev@hesreallyhim.com>
@hesreallyhim

Copy link
Copy Markdown
Member Author

ok thanks @BittuBarnwal7479 nice catch on that one - this was not sufficiently documented - we don't support manual editing of the config block, but we tolerate certain discrepancies - since treestamp doesn't write comments to the config, this is not officially supported behavior, but it was a regression compared to the behavior on main - i've updated the branch so that check will pass even though update will change the config block and updated the README to clarify this constraint.

@BittuBarnwal7479

Copy link
Copy Markdown
Member

ok thanks @BittuBarnwal7479 nice catch on that one - this was not sufficiently documented - we don't support manual editing of the config block, but we tolerate certain discrepancies - since treestamp doesn't write comments to the config, this is not officially supported behavior, but it was a regression compared to the behavior on main - i've updated the branch so that check will pass even though update will change the config block and updated the README to clarify this constraint.

Thanks for quick fix and clarification!

@hesreallyhim

Copy link
Copy Markdown
Member Author

@BittuBarnwal7479 can you submit a review when you have a chance?

@BittuBarnwal7479 BittuBarnwal7479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

This branch has not been deployed

No deployments
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.

2 participants