Repository navigation
feat: add __kosh.page and list published pages in the inventory - #90
Merged
Merged
Conversation
katodea
marked this pull request as ready for review
November 5, 2026 19:08
|
🔱 Poseidon started reviewing this PR — central run. |
There was a problem hiding this comment.
🔱 Poseidon Review
Summary — Adds a single __kosh.page() call for each page (scroll, images, contrast with ranges for gradient text and placeholders, headings, main text, clipped text, overflow) and adds published pages to the inventory. The risk is low: the Node fetch is restricted to the site's host, it fails closed, and the PR already notes the redirect issue. Two measurement edge cases could steer the model wrong.
Walkthrough
- ✨ New —
__kosh.page()collects each page's checks in one call; contrast now has aratioRangefor gradient text and::placeholderrows; the inventory printspublishedfrom?rest_route=/?sitemap=. - ♻️ Refactor — The inventory prints one line per page and per link; null share tags are collapsed into
missingMeta. - 📝 Docs — The functional-design skill and AGENTS.md now describe
page(),publishedand the contrast rules. - 🧪 Tests — Adds jsdom tests over real axe color code, tests for
publishedand the inventory output, and new promptfoo cases.
🟡 Suggestions
- collectors/kosh.js:L296 —
gradientRange(and the placeholder path) ignores theopacityof the text element and its ancestors, so faded text gets aratioRangethat is too high and can be skipped as passing. The testa layer's opacity scales its stopsexpects 5.32 where the browser renders 1:1. Return no range when an element in the chain has opacity below 1, or fold that opacity intoforeground.alpha. - collectors/kosh.js:L420 —
overflow()counts elements off the left edge (rect.left < -1), such as skip links atleft: -9999px. Those never cause horizontal scrolling, so the model may report overflow that isn't there. Count only elements whoserect.rightis past the viewport width.
🤖 Prompt for AI agents — fix all findings
Verify each finding against the current code and only fix it if
needed.
Suggestions:
In `collectors/kosh.js`:
- Line 296: In `gradientRange`, the foreground comes from
`getComputedStyle(node.element).getPropertyValue(
'-webkit-text-fill-color')`, and the `opacity` of the text element
and its ancestors is never applied. Only `backgroundsBehind` uses
opacity, to scale the gradient stops. Faded text therefore gets a
`ratioRange` that is too high. The skill says to skip a row whose
`min` clears `threshold`, so failing text can be skipped. Walk from
`node.element` up to `document.documentElement`. If any computed
`opacity` is below 1, return null so the row falls back to judging
by eye. Apply the same check to `field` in `placeholders()` before
calling `ratioRange`; keep the existing `::placeholder` opacity
multiplication. Update the test `a layer's opacity scales its
stops` in tests/collectors.test.js: it expects 5.32 where the
browser renders 1:1. Have it expect no `ratioRange` instead. Keep
the try/catch and the `!foreground.alpha` early return.
- Line 420: In `overflow()`, the condition `(rect.right <= width + 1
&& rect.left >= -1)` counts any element whose left edge is below
-1. Content off the left edge never causes horizontal scrolling.
Skip links and screen-reader text placed at `left: -9999px` are
common in themes, and `heldBack` does not exempt them. They show
up in `overflow.elements` on every page, and the model may report
a layout bug that does not exist. Change the check so only
elements whose right edge passes the viewport count, e.g.
`if (!rect.width || !rect.height || rect.right <= width + 1)
continue;`. At minimum, skip elements with `rect.right <= 0`. Keep
the `shown`/`heldBack` filters and the outermost-element logic
using `past`. Add a case to the `page: overflow ...` test in
tests/collectors.test.js with an element at left -9999 that must
not be listed.
ℹ️ Review info
- Commit: f4c6d95
- Files reviewed: AGENTS.md, collectors/capture.js, collectors/kosh.js, evals/tests/functional-design.yaml, scripts/page-capture.js, skills/functional-design/SKILL.md, tests/capture.test.js, tests/collectors.test.js, tests/image-resolution-script.test.js, tests/page-capture.test.js
- Files skipped: none
- Model: claude-opus-5-5
There was a problem hiding this comment.
🔱 Poseidon Review
No issues found on this pass. Both fixes since the prior review work as described and have tests.
♻️ Previously flagged
Resolved
- ✅ collectors/kosh.js:L288 —
ratioRangenow returns null viafaded()when the element or an ancestor has opacity below 1. This covers gradient text and placeholders, and new tests check both. - ✅ collectors/kosh.js:L428 —
overflow()now counts only elements past the right edge, so a skip link parked off the left is no longer listed. A test case covers it.
ℹ️ Review info
- Commit: f672054
- Files reviewed: AGENTS.md, collectors/capture.js, collectors/kosh.js, evals/tests/functional-design.yaml, scripts/page-capture.js, skills/functional-design/SKILL.md, tests/capture.test.js, tests/collectors.test.js, tests/image-resolution-script.test.js, tests/page-capture.test.js
- Files skipped: none
- Model: claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
collectors/kosh.js__kosh.page(): scrolls the page so lazy content loads, then returnsimages,contrast,headings,text(whatmainshows, cut at 8,000 characters),clippedandoverflowin one callcountratioRangeworked out from the gradient's stops, over axe's own background stacktextColorkeeps its transparency (#ffffff at 30%), for placeholders and gradient textcollectors/capture.jsloads axe for__kosh.pageas well as__kosh.contrastscripts/page-capture.jsinventorypublishedfirst: the site's published pages the run hasn't loaded or seen a link to, read from Node through?rest_route=, then?sitemap=, so it works on plain permalinks and in a subdirectoryerrorinstead of an empty list when it can't tellmissingMetaskills/functional-design/SKILL.md__kosh.page()in place of the scroll loop,__kosh.images()and__kosh.contrast()textfor spelling and grammarpublishedevals/tests/functional-design.yaml: new cases for gradient ranges, placeholders, icon glyphs,textandpublishedAGENTS.md:__kosh.pageloading axe, and howpublishedreads the sitetests/collectors.test.jsandtests/page-capture.test.jswhy
the functional-design after runs wrote about as much page code as before the rewrite. it was ~33K characters of
browser_evaluatea run, much of it the same each page: scroll loops (16–31 a run), main-text reads and hand-written contrast math (16 calls across six runs), which is how wrong ratios get into reports.three rounds of runs on a staging site, Opus 5 at
xhigh:page()alone halved the code (33.5K → 17.5K mean) and took the contrast math to zero, but the contact page's sentence fragment went from 5/6 to 3/6. the misses never had that sentence in any tool result, sotextwent intopage().text, the fragment came back 3/3 and code fell further (17.0K → 10.4K). then a published test page with broken gallery images, a high in every earlier run, went from 6/6 to 0/3. Opus 5 had only ever found it through the REST API, and two reports said the menu was the whole site.publishedand the skill sentence, the page is back 3/3. all three runs found it with their own REST call before readinginventory, sopublishedis a backstop that no run has needed yet. code 13.9K, output tokens 57K, HTML 23 MB, pages 9.7 (mean). the placeholder is reported at 2.54:1, measured, in every run.the inventory change came from the first of those runs: it read the pretty-printed output with
head -200andtail, so the middle pages' rows were never read. a one-line-per-row inventory of the same run is 55 lines rather than 685, and both later runs read it whole.notes
publishedis only shown to the model, so a run that ignoresnotReachedleaves no trace in the report. not built since no run ignored it.?rest_route=and?sitemap=routes were checked on a live site with pretty permalinks and against WordPress core's source. plain permalinks and subdirectory installs were only tested against a stub server.inventory, likecheck-links.js, follows a redirect before checking its host, so a site can send it to a private address. one shared fix for both is tracked.co-authored by claude opus 5.5 🧹