Conversation
…pitfalls `opencli browser verify` now loads `~/.opencli/sites/<site>/verify/<cmd>.json` when present and validates row count / columns / types / patterns / notEmpty against the live adapter output. Without a fixture, behavior is unchanged (just runs the adapter and prints). New flags `--write-fixture`, `--update-fixture`, `--no-fixture` seed / refresh / bypass the spec. Motivation: previous verify only checked that the adapter exited 0 and produced *something* — shape regressions (author name bleeding across rows, a column silently becoming null after a site refresh, duplicated thread-level time on every post) all passed "✓ Adapter works!" and shipped broken. Skill doc updates (opencli-adapter-author): - adapter-template.md: new "COOKIE adapter 骨架" section — HttpOnly + dual-domain cookie read via `page.getCookies`, Node-side fetch for HTML (explaining why `page.evaluate(fetch(...))` is the wrong tool when `navigateBefore: false` or the response is non-UTF-8), and empty-state sentinel row over `[]` - api-discovery.md §4: note that BBS engines (Discuz/phpBB/vBulletin) set auth cookies on the root domain + HttpOnly, so single-domain `getCookies` calls silently miss them - SKILL.md Step 10/12: make `--write-fixture` part of the runbook, forbid debug dumps outside `~/.opencli/sites/<site>/fixtures/` or `/tmp/`
Reviewer feedback blocker: fixture.args was Record<string, unknown>, expanded as --key value only, so positional-subject adapters (<tid>/<url>/<query>) couldn't be verified. Repo convention is "主语优先 positional". - verify-fixture.ts: args now accepts Record<string, unknown> | unknown[]. Object → --k v pairs; array → verbatim passthrough. New helper expandFixtureArgs() centralizes the branching. - cli.ts verify action: swap inline expansion for expandFixtureArgs(). - verify-fixture.test.ts: 6 new cases covering array form, mixed positional+flag, empty shapes, passthrough stringification. - site-memory.md: Layer 2 tree now lists verify/<cmd>.json; new schema block distinguishes it from fixtures/<cmd>-<ts>.json; runbook timing section gets a Step 10 verify-write row. Repo-tree debug-dump ban clarified. - adapter-template.md: new "Verify fixture" section with named-flag and positional recipes, honest about --write-fixture only seeding named. Smoke-tested 1point3acres/thread (positional <tid>): fixture round-trip green (args=["1173710","--limit","2"]).
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.
Summary
Addresses the three P0/P1 items from the 1point3acres adapter retro:
Runtime —
opencli browser verifynow validates values, not just "ran":~/.opencli/sites/<site>/verify/<cmd>.jsonwhen present and checks row count / columns / types / patterns / notEmpty against live adapter output.--write-fixture/--update-fixture/--no-fixture.Skill —
opencli-adapter-authorcaptures the gotchas that bit me writing the 1p3a COOKIE adapters:adapter-template.md— new "COOKIE adapter 骨架" section:page.getCookies({ domain: '.x' })+({ domain: 'www.x' })merge, so HttpOnly auth cookies on the root domain don't silently dropfetch(url, { headers: { Cookie } })+TextDecoder('gbk')is the right shape for HTML / non-UTF-8 /navigateBefore: falseadapters (vspage.evaluate(fetch(...)), which blows up with "Failed to fetch" under cross-origin or GBK)return []api-discovery.md §4— note that Discuz/phpBB/vBulletin engines set auth on the root domain, so a single-domaingetCookiescall comes up emptySKILL.mdrunbook — Step 10 folds--write-fixtureinto the adapter-author loop; Step 12 adds theverify/<cmd>.jsondeliverable and forbids.dbg-*/ raw HTML dumps in the repo treeFixture schema
{ "args": { "limit": 3 }, "expect": { "rowCount": { "min": 1, "max": 3 }, "columns": ["rank", "tid", "title", "url"], "types": { "rank": "number", "tid": "string|number", "url": "string" }, "patterns": { "url": "^https://www\\\\.example\\\\.com/" }, "notEmpty": ["title", "url"] } }typessupports unions ("number|string") and"any"wildcardpatternsskip null/undefined values so optional fields don't false-positive--write-fixtureomitpatterns/notEmpty— author hand-tunesTest plan
npx vitest run src/— 58 files / 820 passed / 2 skipped (same as main + new tests acrossverify-fixture.test.tsandcli.test.ts)npx tsc --noEmitcleanopencli browser verify 1point3acres/hot— no fixture → prints rows + hint--write-fixture→ seeds~/.opencli/sites/1point3acres/verify/hot.jsonwith derived schema--no-fixture→ bypasses validation even when fixture exists--write-fixturewith existing fixture → no-op with hint to use--update-fixtureNon-goals
~/.opencli/sites/<site>/fixtures/<cmd>-<timestamp>.json, existing convention).