Skip to content

feat(validate): mirror the three app_unlock rules the schema will not express - #782

Merged
ZacxDev merged 4 commits into
mainfrom
zach/validate-app-unlock-rules
Oct 4, 2026
Merged

ZacxDev merged 4 commits into
mainfrom
zach/validate-app-unlock-rules

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

The defect, measured end-to-end

civitai app validate accepted every manifest the paid-app path can get wrong, and the server rejected all three at submit. Built the binary from origin/main and from this branch, ran both over four manifests derived from civitai-block-starter:

fixture origin/main this branch message
app_unlock, no justification ACCEPTED rc=0 REJECTED rc=1 goods[0].justification is required for an app_unlock good — it makes the app paid, so a moderator must be told why
app_unlock priced 7777 ACCEPTED rc=0 REJECTED rc=1 goods[0].priceBuzz must be a whole number between 2 and 5000 Buzz for an app_unlock good
two app_unlock goods ACCEPTED rc=0 REJECTED rc=1 goods may declare at most 1 app_unlock good (found 2) — app access is one question with one answer
a correct app_unlock (control) ACCEPTED rc=0 ACCEPTED rc=0 ✓ is valid

The control is the point — the probe discriminates rather than rejecting anything that mentions app_unlock.

Why these three belong here, and the general price range does not

goodsChecks already ports the goods rules JSON Schema cannot express, and these pass the same test — the vendored schema does not reject any of them and deliberately will not:

  • priceBuzz.maximum stays 50000 for every kind, with the narrow bound in a prose description that names the server validator authoritative.
  • justification is absent from required and could not be there: the requirement is conditional on kind, which a per-item subschema cannot state.
  • Arity is a whole-array property a per-item subschema cannot state at all.

Values mirrored from block-goods.constants.ts (:117, :183, :459) with the server's message text.

blockGoodMinPriceBuzz/blockGoodMaxPriceBuzz are not checks — the schema's minimum/maximum own the general range, and re-checking it here is the duplicated-predicate mistake this file warns about twice. They exist so the message can name the real ceiling, and so the app_unlock check is scoped to exactly the window where the schema passes (2..50000). Above 50000 this stays silent rather than reporting twice what the server reports once.

🔴 The price message names the kind's ceiling, verbatim including the for an app_unlock good suffix. The server's comment is explicit about why: for an app_unlock that string is the only machine-delivered statement of the real limit, so getting it wrong tells a developer at 5001 to stay "between 2 and 50000" — the bound they just satisfied.

Order and arity

Checks sit at the server's own positions, each ending the entry, because the server is a forEach whose every rejection returns — two findings for one entry would make the local output a different set from the 400 it predicts. Arity is the exception: additive, at path goods not goods[i], mirroring the server pushing it and falling through.

Arity counts only entries that survived, mirroring the server's parsed-goods array. That cost a test round and is now pinned: three unlocks where two fail produce no arity finding. Stated limit — the server also enforces rules this package leaves to the schema, so an entry failing one of those is dropped from its count and cannot be dropped from ours; on a manifest already failing the schema we can report an arity violation the server would not. Same bounded trade the duplicate-id note already documents.

Also: the AGENTS.md the CLI writes

Its ### Docs section had zero references to goods, earning, unlock or justification, so an agent following the file the onboarding prompt calls "the source of truth" had no route to these rules. It now points at apps/guide/earning.md and names the three. The golden in agent_setup_docs_test.go is updated in the same commit, as that guard's own failure message instructs — it caught this correctly.

Verification

  • 22 new subtests. Every want spelled out rather than built from the code under test, since these strings are a contract with the server's 400.
  • 10 mutants, all killed, each verified to have applied and compiled before its result was read: price ceiling 5000→50000; arity 1→2; both comparisons >→>=; delete the required-justification arm; key it on good instead; message names the general ceiling; drop the kind suffix; never count a surviving unlock; drop the TrimSpace. Run under -count=1 so Go's test cache cannot serve a stale pass.
  • ⚠️ The first harness scored a false KILL and is worth recording: inline Python lost its quoting, the file was emptied, the build failed, and rc=1 read as a dead mutant with zero failing tests. Rewritten to a file that asserts a unique anchor (refusing on 0 or >1 matches), and the runner now separates "does not compile" from "killed".
  • Full suite at -count=1: failing-test name set byte-identical to origin/main — 6 lines, the 3 container-dependent TestOracle* tests plus subtests, red at base too. Attributable delta zero. gofmt clean, go vet clean.

Context

Found while evaluating whether an agent following civitai.com/agent-onboarding can author a paid app. Sibling docs fix: civitai/civitai-developer-docs#150, which adds the justification row the manifest reference omitted. This PR is the deterministic half — docs tell an author the rule, the validator enforces it.

🤖 Generated with Claude Code

… express

`civitai app validate` ACCEPTED every manifest the paid-app path can get wrong,
and the server rejected all three at submit. Measured end-to-end with the binary
built from origin/main against the binary built from this branch, on four real
manifests derived from the civitai-block-starter:

  fixture                        origin/main      this branch
  app_unlock, no justification   ACCEPTED rc=0    REJECTED rc=1
  app_unlock priced 7777         ACCEPTED rc=0    REJECTED rc=1
  two app_unlock goods           ACCEPTED rc=0    REJECTED rc=1
  a CORRECT app_unlock (control) ACCEPTED rc=0    ACCEPTED rc=0

The control is the point: the probe discriminates rather than rejecting
everything that mentions app_unlock.

WHY THESE THREE BELONG HERE AND THE GENERAL PRICE RANGE DOES NOT

`goodsChecks` already ports the goods rules JSON Schema cannot express, and the
app_unlock rules pass that same test — the vendored schema does not reject any
of them and deliberately will not. Its `priceBuzz.maximum` stays 50000 for every
kind with the narrow bound in a prose `description` that names the server
validator authoritative; `justification` is absent from `required` and could not
be there, because the requirement is conditional on `kind`; and arity is a
whole-array property a per-item subschema cannot state. Values mirrored from
block-goods.constants.ts (:117, :183, :459) with the server's message text.

`blockGoodMinPriceBuzz`/`blockGoodMaxPriceBuzz` are deliberately NOT checks —
the schema's minimum/maximum own the general range and re-checking it here would
be the duplicated-predicate mistake this file warns about twice. They exist so
the message can name the real ceiling, and so the app_unlock check can be scoped
to exactly the window where the schema passes (2..50000). Above 50000 this stays
SILENT rather than reporting twice what the server reports once.

The price message names the KIND'S ceiling, verbatim including the
` for an app_unlock good` suffix. The server's own comment is explicit about why:
for an app_unlock that string is the only machine-delivered statement of the real
limit, so getting it wrong tells a developer at 5001 to stay "between 2 and
50000" — the bound they just satisfied.

ORDER AND ARITY, THE TWO CONTRACTS THAT ARE EASY TO BREAK

Checks are inserted at the server's own positions, each ending the entry, because
the server is a forEach whose every rejection returns — emitting two findings for
one entry would make the local output a different SET from the 400 it predicts.
Arity is the exception and is ADDITIVE, at path `goods` rather than `goods[i]`,
mirroring the server pushing it and falling through.

Arity counts only entries that SURVIVED, mirroring the server's parsed-goods
array. That subtlety cost a test round and is now pinned: three unlocks where two
fail produce no arity finding at all. The stated limit is that the server also
enforces rules this package leaves to the schema, so an entry failing one of
those is dropped from its count and cannot be dropped from ours — on a manifest
already failing the schema we can report an arity violation the server would not.
Same bounded trade the duplicate-id note above already documents.

Also updated: the `### Docs` section of the AGENTS.md the CLI writes had ZERO
references to goods, earning, unlock or justification, so an agent following it
had no route to the rules at all. It now points at apps/guide/earning.md and
names the three. Its golden in agent_setup_docs_test.go is updated in the same
commit, as that guard's own failure message instructs.

VERIFICATION

- 22 new subtests, every `want` spelled out rather than built from the code,
  since these strings are a contract with the server's 400.
- 10 mutants, ALL KILLED, each verified to have applied AND compiled before its
  test result was read: price ceiling 5000->50000; arity 1->2; both comparisons
  > -> >=; delete the required-justification arm; key it on `good` instead;
  message names the general ceiling; drop the kind suffix; never count a
  surviving unlock; drop the TrimSpace. Run under -count=1 so Go's test cache
  cannot serve a stale pass.
  ⚠ The first harness scored a false KILL: inline Python lost its quoting, the
  file was emptied, the BUILD failed, and rc=1 read as a dead mutant with zero
  failing tests. Rewritten to a file that asserts a unique anchor and refuses on
  0 or >1 matches, and the runner now separates "does not compile" from "killed".
- Full suite at -count=1: failing-test NAME SET byte-identical to origin/main
  (6 lines: the 3 container-dependent TestOracle* tests and their subtests, red
  at base too). Attributable delta zero. gofmt clean, go vet clean.
…dit findings answered, one rejected

Round 0 on this PR found four defects in it. Three are fixed, one is REJECTED
with its evidence, and the reasoning that produced the worst of them is replaced
rather than patched.

D1 — ACCEPTED, and it was the real one. The price check was clamped to the window
where the vendored schema passes (2..50000) "so as not to report twice what the
server reports once". Measured consequence: an app_unlock at 60000 got ONLY the
schema's `maximum: got 60,000, want 50,000` — ten times the real ceiling — so a
developer is told to come down to 50000, does, and is rejected again with a
different number. Verified against both binaries:

  priceBuzz 60000   before: `maximum: got 60,000, want 50,000` (alone)
                     after: `must be a whole number between 2 and 5000 Buzz for
                             an app_unlock good`, beside the schema's
  priceBuzz 5000    before: silent     after: silent   (the control)

🔴 AND THE RATIONALE WAS FALSE, WHICH IS WHY THE COMMENT IS REWRITTEN AND NOT
JUST THE CODE. "Never report twice" is not an invariant this file holds: a goods
entry with no `title` already emits both `goods[0].title must be a non-empty
string` here AND `goods[0]: missing property 'title'` from the schema, and did so
before any of this landed. The clamp bought consistency with a rule that never
existed, at the cost of naming the wrong bound. The constant block now states the
rule the file ACTUALLY holds — mirror the server's sentence, and accept that the
schema may fire alongside it — so the next reader does not re-derive the clamp.
The check now mirrors the server's own condition for the kind: whole number, 2 to
5000, unclamped above. `blockGoodMaxPriceBuzz` existed only for the clamp and is
deleted.

D4 — ACCEPTED. The stated justification, "JSON Schema cannot express these", is
false: the dialect is draft/2020-12, where `if`/`then` + `required` expresses the
conditional justification, `contains` + `maxContains: 1` the arity, and
`if`/`then` + `maximum` the kind's ceiling. The upstream constants file says so
itself — "a conditional if/then on kind there is more surface than this one
property is worth" — i.e. considered and DECLINED, not impossible. The honest
reason is ownership: the vendored schema is an auto-revendored byte-mirror this
repo may not unilaterally edit. The comment now says that, and says plainly that
declaring the rules upstream would be the better fix because it would cover the
SDK, the docs site and every third-party validator — which the false version
foreclosed by making it look unavailable.

D5 — ACCEPTED. The AGENTS.md bullet called earning.md "the ONLY place the rules
for charging are written out". Measured: that page is HTTP 200, 33,805 B, and
contains `app_unlock` once in a table cell, zero occurrences of 5000, no arity
statement and no goods-justification rule — live AND at
civitai-developer-docs@origin/main, so not deploy lag. It is the sibling docs PR,
unmerged. The claim is removed; the three rules stay stated inline, which is what
an agent can act on regardless of what the page says.

D3 — REJECTED, with the evidence, and pinned so it is not re-raised. The audit
read the invalid-`kind` skip as suppressing the payload byte-size finding, the
one goods rule JSON Schema provably cannot express. It does suppress it — and so
does the SERVER: its kind check returns at block-goods.constants.ts:385-387,
before its own payload check at :464. Mirroring that is this file's entire
contract, so "fixing" it would be the divergence. Two new cases pin both arms:
an invalid kind suppresses the payload finding, and the SAME oversized payload
under a valid kind still reports it — the control proving the case is about
`kind` and not about payload detection going blind.

D2 — not taken, and the reason is D1. The `!isString` half of the justification
check does double-report with the schema's `type`. With the clamp gone that is
no longer an inconsistency but the file's stated rule, applied uniformly: the
author gets the server's own sentence either way.

Also: "22 new subtests" in the previous commit message was an overstatement,
reachable only by counting the two top-level funcs as subtests. Measured: 25
table rows + 2 funcs. The PR body carries a visible correction.

VERIFICATION
- 27 PASS / 0 FAIL on the app_unlock tests (25 rows + 2 funcs), including a
  regression guard whose name records the defect, and the two D3 control cases.
- Six mutants re-run against the REWRITTEN check, ALL KILLED, each verified to
  have applied and compiled first, under -count=1: ceiling 5000->50000;
  RE-ADDING the clamp that caused the defect; `>` -> `>=`; dropping the
  whole-number arm; dropping the floor arm; arity 1->2. The clamp mutant is the
  one that matters — the guard catches a reintroduction.
- Full suite -count=1: failing-test NAME SET still byte-identical to
  origin/main (the 6 container-dependent TestOracle* lines). Attributable delta
  zero. gofmt clean, go vet clean on ./internal/...
@ZacxDev

ZacxDev commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Correction to this PR's description, and round-0 outcomes

Round 0 found four defects in this PR. Posting rather than silently editing, since the body above has been readable for a while.

🔴 The description's verification section is now wrong in my own favour and I am striking it. It said "22 new subtests". Measured: 25 table rows + 2 top-level funcs — 22 was only reachable by counting the funcs as subtests. The count is now higher because the fix added cases, but the original figure was an overstatement when written, not an undercount.

🔴 And the body's central design claim was a defect, not a feature. It said, of staying silent above 50000: "Above 50000 this stays silent rather than reporting twice what the server reports once." That produced the worst finding in the round. Measured on the pre-fix head, an app_unlock priced at 60000 received only the schema's priceBuzz: maximum: got 60,000, want 50,000 — ten times the real ceiling — so a developer would come down to 50000 and be rejected again with a different number.

The rationale was also false. "Never report twice what the server reports once" is not an invariant this file holds: a goods entry with no title already emits both goods[0].title must be a non-empty string (semantic) and goods[0]: missing property 'title' (schema), and did so before this PR. The clamp bought consistency with a rule that never existed, at the cost of naming the wrong bound.

Fixed in 001e572, verified against both binaries:

priceBuzz before after
60000 maximum: got 60,000, want 50,000 alone must be a whole number between 2 and 5000 Buzz for an app_unlock good, beside the schema's
5000 (legal) silent silent — the control

The other three

  • D4 accepted. "JSON Schema cannot express these" is false — draft/2020-12 has if/then + required, contains + maxContains, and a conditional maximum. The upstream constants file says as much itself ("more surface than this one property is worth"): considered and declined, not impossible. The honest reason is ownership — the vendored schema is an auto-revendored byte-mirror this repo may not unilaterally edit. The comment now says so, and says plainly that declaring the rules upstream would be the better fix, since the false version foreclosed that option by making it look unavailable.
  • D5 accepted. The AGENTS.md bullet called earning.md "the ONLY place the rules for charging are written out". That page contains none of the three rules — app_unlock once in a table cell, zero occurrences of 5000 — live and at civitai-developer-docs@origin/main, so not deploy lag. Claim removed; the rules stay stated inline. 🔴 This PR must not merge before docs(apps): document the three app_unlock manifest rules, and guard the table that omitted them civitai-developer-docs#150 deploys, or it ships a pointer to a page that does not carry what it promises — and docs-links.yml checks resolution only, so 200 ⇒ green and nothing would catch it.
  • D3 rejected, with evidence, and pinned. The audit read the invalid-kind skip as suppressing the payload byte-size finding. It does — and so does the server: its kind check returns at block-goods.constants.ts:385-387, before its own payload check at :464. Mirroring that is this file's contract, so "fixing" it would be the divergence. Two cases now pin both arms, including a control proving the case is about kind and not about payload detection going blind.
  • D2 not taken, because of D1: the !isString double-report is no longer an inconsistency but the file's stated rule applied uniformly.

Six mutants re-run against the rewritten check, all killed — including re-adding the clamp that caused the defect, so a reintroduction is caught.

🤖 Generated with Claude Code

@ZacxDev

ZacxDev commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Round 1 claims — what 001e572 claims to have addressed

1. The app_unlock price check is no longer clamped to 2..50000, so a 60000 unlock now receives a message naming 5000 rather than only the schema's "want 50,000".
2. blockGoodMaxPriceBuzz is deleted; it existed only for that clamp.
3. The constant block no longer asserts "never report twice what the server reports once" — a rule the file does not hold, since a missing title already emits both a semantic and a schema finding.
4. The "JSON Schema cannot express these" justification is replaced: draft/2020-12 CAN express all three, the upstream constants file records the decision as declined, and the real reason is that the vendored schema is an auto-revendored byte-mirror.
5. The AGENTS.md bullet no longer calls earning.md the ONLY place the rules are written out; the three rules remain stated inline, and the golden is updated in the same commit.
6. The invalid-kind skip is documented as a DELIBERATE server mirror and pinned by two cases, one of them a control proving payload detection still works under a valid kind.
7. Payload classification for this ladder, decided once: internal/validate/semantic.go and internal/cmd/templates/agents-app.md are PAYLOAD (the template ships into users' repos); the two _test.go files are SCAFFOLDING.

🔴 This PR must not merge before civitai/civitai-developer-docs#150 deploys — its inline rules are correct either way, but anything pointing a reader at earning.md is premature until that lands.

…omment saying it was not

Round 2 returned one 🟡 and two 🟢, all three about prose the round-1 fix wrote.
No behaviour defect; no 🔴. The round also independently confirmed, at the server
source, that round 1's REJECTION of the payload-suppression finding was correct.

🟡1 — the comment-as-claim defect, and it is the same class round 1 existed to
cure. Round 1 deleted the clamp and left the sentence "`blockGoodMinPriceBuzz` is
NOT a check — the schema's `minimum` owns the general floor". That was true WHILE
the check was clamped and became false the moment the clamp came off: the new
condition tests `price < blockGoodMinPriceBuzz`, so
`{"kind":"app_unlock","priceBuzz":0}` emits the mirrored sentence AND the
schema's `minimum: got 0, want 2`. A maintainer taking "NOT a check" at face
value could delete the floor arm.

🔴 AND THE FIX IS NOT JUST TO SWAP THE WORD, BECAUSE THE FLOOR ARM'S
JUSTIFICATION IS NOT THE CEILING'S. Round 1's argument — "naming the wrong bound
is worse than naming it twice" — is CEILING-SPECIFIC: the floor is 2 in the
schema, in the server and here, so on that arm the second message corrects no
bound and is pure duplication. The arm is kept anyway, because it is what makes
this a faithful copy of the server's single condition rather than a hand-picked
subset, and the comment now says so — otherwise the next reader deletes it on
exactly the "pure duplication" reasoning the old sentence invited.

🟢2 — AN UNADVERTISED BEHAVIOUR CHANGE, VERIFIED CORRECT AND NOW DOCUMENTED AND
PINNED. Because the price check `continue`s, an over-cap unlock never reaches the
arity counter, so two unlocks with one at 60000 report the price error ALONE
where before the clamp came off they also reported arity. That is the server's
behaviour, and reading its source turned up a SECOND consequence nobody had
checked: block-goods.constants.ts:501-509 states "two unlocks where one is
over-cap reports ONLY the price error, and two unlocks sharing an id report ONLY
the duplicate error". Verified both hold here, and added a row for each — the
duplicate-unlock case was previously untested in either direction.

⚠ Worth recording: the price arm of that mirror only became true when the clamp
came off. While the check was scoped to 2..50000, a 60000 unlock did NOT
`continue`, so it WAS counted and a second over-cap unlock reported an arity
error the server would not have. Removing the clamp fixed a second mirror defect
nobody had looked for, and the commit that did it did not know.

🟢3 — "The three rules below are stated here too" parses two ways, and the wrong
reading ("earning.md states them as well") is the claim the previous commit
removed as false. Now "repeated in this file deliberately". Template and golden
in the same commit.

VERIFICATION
- 29 PASS / 0 FAIL on the app_unlock tests (was 27; two arity-mirror rows added).
- Real binary, two unlocks with one at 60000: the price errors only, NO arity
  finding — the server's documented behaviour, reproduced rather than reasoned.
- Full suite -count=1: failing-test NAME SET still byte-identical to
  origin/main. Attributable delta zero. gofmt clean, go vet clean, and the
  pinned `### Docs` golden plus the URL ledger both green.
@ZacxDev

ZacxDev commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Round 2 claims — what 30fd72f claims to have addressed

1. The comment no longer says blockGoodMinPriceBuzz "is NOT a check" — the unclamped condition tests price < that constant, so it is one; measured, priceBuzz 0 emits the mirrored sentence AND the schema's minimum.
2. The floor arm's justification is stated SEPARATELY from the ceiling's: the wrong-bound argument is ceiling-specific because the floor is 2 in schema, server and here, so the arm is kept for mirror-fidelity rather than for bound-correction.
3. The arity-suppression behaviour change is documented and pinned: an over-cap unlock continues and so never reaches the counter.
4. A SECOND server-stated arity consequence, previously untested in either direction, is now pinned — two unlocks sharing an id report ONLY the duplicate error (block-goods.constants.ts:501-509).
5. "The three rules below are stated here too" is reworded to "repeated in this file deliberately", removing the reading that asserts earning.md states them — the claim the previous commit removed as false.

⚠ CodeQL reads neutral on this head (success on both prior heads). Cause is not this change's content: 2 configurations not found — the go and python default-setup configurations present on refs/heads/main were not found for this run, so code scanning cannot diff alerts. It is not a required context (["pins-vs-published","scaffold-currency","build-test","ready-ack-runtime","template-page-vite"]) and mergeStateStatus is CLEAN.

…and contradicted the line above it

Round 3 returned exactly one finding and it is this: round 2's new paragraph
opened "AN EARLIER PER-ENTRY FINDING SUPPRESSES THIS ONE". That is false, and it
contradicted BOTH the paragraph three lines above it — "Unlike every check in the
loop this one is ADDITIVE rather than entry-terminating" — and a test row named
after that paragraph, `arity is ADDITIVE, not entry-terminating`, which has
existed since 7fb63a9.

Measured with the real binary, three unlocks with one over-cap (500, 500, 7777):
BOTH the arity finding and the price finding appear. A failing entry is excluded
from the COUNT, so the arity finding disappears only when what SURVIVES is one
unlock or fewer. Both server consequences the paragraph quotes are 2-unlock
cases, where the surviving count happens to fall to 1 — which is exactly why the
wrong headline read plausibly over correct examples.

The paragraph now states the narrow, true version, and carries a line telling the
next writer not to restate it the wrong way, because this is the third time in
this ladder that a fix round's own PROSE was the next finding.

No test added: the three-unlock case is already pinned by the `arity is ADDITIVE`
row, which round 3 confirmed would catch the edit the false headline invited.

🔴 THIS ENDS THE LADDER ON THE ATTRIBUTION GATE, NOT ON A CLEAN ROUND.
Round 3 changed 35 payload lines at file level but ZERO executable lines —
`semantic.go`'s delta was 100% comments, proven by comment-stripped comparison.
This round is comment-only too, by the same proof (stripped source byte-identical
to 30fd72f). That is two consecutive rounds whose fixes changed no executable
line, which is the unit the two-consecutive-zeros stop rule is written in: the
ladder is now auditing its own prose rather than the PR. Stopping here
deliberately, with the reason recorded, rather than running a fourth round.

VERIFICATION
- 29 PASS / 0 FAIL on the app_unlock tests; build, vet and gofmt clean.
- Comment-stripped `semantic.go` is byte-identical to 30fd72f, so there is no
  behaviour change in this commit and round 3's measurements still stand.
- Round 3 independently reproduced BOTH payload figures the assembler could not
  read (35 for round 2, 110 for round 1) from a checkout holding both ends, and
  re-verified the cross-repo line references :385-387, :464 and :501-509.
@ZacxDev

ZacxDev commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Round 3 fixed, and I am ENDING this ladder — on the ATTRIBUTION GATE

1. The arity paragraph's headline no longer says "AN EARLIER PER-ENTRY FINDING SUPPRESSES THIS ONE" — which was false, and contradicted the paragraph three lines above it and a test row named after that paragraph.
2. It now states the narrow true version: a failing entry is excluded from the COUNT, so the arity finding disappears only when what SURVIVES is one unlock or fewer.
3. A line tells the next writer not to restate it the wrong way, and why it read plausibly (both quoted server consequences are 2-unlock cases).
4. No test added: the three-unlock case was already pinned by the `arity is ADDITIVE` row, which round 3 confirmed catches the edit the false headline invited.

Round 3 found exactly one thing and it was mine: the headline was false. Measured with the real binary, three unlocks with one over-cap (500, 500, 7777) produce both the arity finding and the price finding. Fixed.

Why the ladder ends here, and it is not because the round was clean

Round 3 changed 35 payload lines at file level but ZERO executable lines — semantic.go's entire delta was comments, which round 3 proved by comment-stripped comparison. This round is comment-only too, by the same proof: comment-stripped semantic.go is byte-identical to 30fd72f.

That is two consecutive rounds whose fixes changed no executable line, which is the unit the two-consecutive-zeros stop rule is written in. The ladder is now auditing its own prose rather than this PR, so it stops here deliberately rather than running a fourth round that would do the same again.

What the ladder established, for the reader who arrives at the diff

  • D1 was the real defect and is fixed: the price clamp made a 60000 unlock receive only the schema's want 50,000 — ten times the real ceiling.
  • D3 was REJECTED, and round 3 independently confirmed the rejection at the server source: the kind check returns at block-goods.constants.ts:385-387, before the payload check at :464, so suppressing is faithful rather than a regression.
  • A second server-stated arity consequence — two unlocks sharing an id report only the duplicate error — was previously untested in either direction and is now pinned.
  • Round 3 reproduced both payload figures the assembler could not read (110 for round 1, 35 for round 2) from a checkout holding both ends, and re-verified all three cross-repo line references.

⚠ CodeQL reads neutral on these heads: 2 configurations not found — the go/python default-setup configs on main were not found for this run, so code scanning cannot diff alerts. All four Analyze (…) check-runs are success, it is not a required context, and mergeStateStatus is CLEAN. Not masking an analysis failure.

🔴 Merge order still binds: civitai/civitai-developer-docs#150 must merge and DEPLOY before this PR ships, because the AGENTS.md block it writes points a reader at earning.md, that page carries none of these rules until #150 lands, and docs-links.yml checks resolution only — 200 ⇒ green, so nothing would catch the false pointer.

🤖 Generated with Claude Code

ZacxDev added a commit to civitai/civitai-developer-docs that referenced this pull request Oct 4, 2026
…he table that omitted them (#150)

The per-entry `goods` table documented six of the canonical schema's seven
`goods.items` properties. The missing one was `justification`, which the
submit-time validator REQUIRES for a `kind: "app_unlock"` good — so the
documented path to authoring a paid app ended in a submit rejection the
reference could not explain, and `civitai app validate` could not catch it
either (that half is civitai/cli#782).

Two further rules were undocumented and one made a published bound actively
wrong: `priceBuzz` is capped at 5000 for an unlock, not the 50000 the table
stated unqualified, and at most one unlock may be declared per manifest. All
three come from `civitai:src/shared/constants/block-goods.constants.ts`
(:117, :183, :459); the canonical schema's own property descriptions already
carried them, which makes this a docs-side loss rather than a contract gap.

- `apps/reference/manifest.md` — adds the `justification` row, makes `priceBuzz`
  kind-qualified, and replaces "leave it unset unless you intend that future
  behaviour" with the three rules plus the honest statement that selling an
  `app_unlock` does not paywall the app today.
- `apps/guide/earning.md` — a "Charging for access to the app itself" section and
  the `self_purchase` precondition (owners cannot buy their own app's goods), with
  the unlock bounds deliberately NOT restated: the reference is the one place
  those numbers live.
- `scripts/check-goods-item-parity.mjs` — pins the hand table's key set against
  `goods.items.properties` in both directions, riding the existing
  `appblocks-md-regions` job alongside `check:porting-hooks`.

WHY A NEW GUARD: neither `check:md-regions` nor `check:manifest-parity` could see
this, and both were green throughout — correctly. `<JsonSchemaTable />` renders
top-level fields only, which is why the page carries a hand table at all, so a
nested property addition moves no top-level field and `len(properties)` read 24
before and after. A cardinality check at the wrong depth is a confident green
about a different question. The guard checks the KEY SET only and says so in its
header — a wrong bound cell still passes.

VERIFIED: guard RED at the merge-base and GREEN at head, three real-page mutants
each failing for their own distinct reason, 8/8 detector fixtures, and the CI
step confirmed to have executed rather than skipped. 16/16 checks green.

Three adversarial audit rounds; every finding was prose, several written by the
previous round's own fix. Round 0's deletion candidate D2 — generate the nested
table and retire both the hand table and this guard — is deliberately NOT taken
and is recorded on the PR as an operator decision.

🔴 KNOWN CONFLICT: PR #133 appends a different step after `check:porting-hooks`
in the same workflow and a `"check:*"` line after it in `package.json`. Verified
by `git merge-tree` exit code: conflicts in both files. Whoever merges #133 takes
the resolution; both regions resolve by taking both sides.
@ZacxDev
ZacxDev merged commit 1ad744c into main Oct 4, 2026
12 checks passed
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.

1 participant