[{"data":1,"prerenderedAt":938},["ShallowReactive",2],{"figure-telemetry":3,"menu-audits":6,"menu-decisions":7,"menu-projects":23,"menu-workflows":99,"decision-0031-content-server-accessor":116},{"value":4,"alert":5},"18%",false,[],[8,11,14,17,20],{"label":9,"to":10},"0041 The visitor view becomes its own app, and the portal reads only as a developer platform","\u002Fdecisions\u002F0041-personal-site-splits-from-developer-portal",{"label":12,"to":13},"0040 Visitors land on the front page and toggle to the developer view","\u002Fdecisions\u002F0040-developer-portal-visitor-structure",{"label":15,"to":16},"0039 The developer portal is redesigned for visitors, from a twelve-site benchmark","\u002Fdecisions\u002F0039-developer-portal-benchmark",{"label":18,"to":19},"0038 Marina Roustan's discovery","\u002Fdecisions\u002F0038-marina-roustan-discovery",{"label":21,"to":22},"0013 New linters: the robustness gap is tsconfig and enforcement, not plugins","\u002Fdecisions\u002F0013-linter-coverage",[24,29,60,83],{"labelKey":25,"icon":26,"to":27,"badge":28},"app.menu.allProjects","i-lucide-layers","\u002Fprojects","11",{"labelKey":30,"icon":31,"to":32,"badge":33,"children":34},"app.menu.kinds.apps","i-lucide-app-window","\u002Fprojects?kind=apps","5",[35,40,45,50,55],{"label":36,"icon":31,"to":37,"badge":38,"coverage":39},"developer-portal","\u002Fprojects\u002Fdeveloper-portal","94%",94.37,{"label":41,"icon":31,"to":42,"badge":43,"coverage":44},"huella-legal","\u002Fprojects\u002Fhuella-legal","97%",97.48,{"label":46,"icon":31,"to":47,"badge":48,"coverage":49},"marina-roustan","\u002Fprojects\u002Fmarina-roustan","100%",100,{"label":51,"icon":31,"to":52,"badge":53,"coverage":54},"portfolio","\u002Fprojects\u002Fportfolio","91%",91.31,{"label":56,"icon":31,"to":57,"badge":58,"coverage":59},"wp-editor","\u002Fprojects\u002Fwp-editor","50%",49.89,{"labelKey":61,"icon":62,"to":63,"badge":64,"children":65},"app.menu.kinds.packages","i-lucide-package","\u002Fprojects?kind=packages","4",[66,71,75,80],{"label":67,"icon":62,"to":68,"badge":69,"coverage":70},"configs","\u002Fprojects\u002Fconfigs","76%",75.7,{"label":72,"icon":62,"to":73,"badge":48,"coverage":74},"content","\u002Fprojects\u002Fcontent",99.58,{"label":76,"icon":62,"to":77,"badge":78,"coverage":79},"i18n","\u002Fprojects\u002Fi18n","99%",99.08,{"label":81,"icon":62,"to":82,"badge":48,"coverage":49},"observability","\u002Fprojects\u002Fobservability",{"labelKey":84,"icon":85,"to":86,"badge":87,"children":88},"app.menu.kinds.infrastructure","i-lucide-server","\u002Fprojects?kind=infrastructure","2",[89,94],{"label":90,"icon":85,"to":91,"badge":92,"coverage":93},"scripts","\u002Fprojects\u002Fscripts","79%",78.6,{"label":95,"icon":85,"to":96,"badge":97,"coverage":98},"translations","\u002Fprojects\u002Ftranslations","93%",93.33,[100,103,106,109,112],{"label":101,"to":102},"Huella Legal","\u002Fworkflows\u002Fhuella-legal",{"label":104,"to":105},"Marina Roustan","\u002Fworkflows\u002Fmarina-roustan",{"label":107,"to":108},"Developer portal front door","\u002Fworkflows\u002Fdeveloper-portal-front-door",{"label":110,"to":111},"Huella Legal editorial","\u002Fworkflows\u002Fhuella-legal-editorial",{"labelKey":113,"icon":114,"to":115},"app.menu.newProject","i-lucide-plus","\u002Fworkflows\u002Fnew",{"id":117,"title":118,"body":119,"description":919,"extension":927,"kind":928,"meta":929,"navigation":933,"path":934,"seo":935,"stem":936,"url":928,"verdict":928,"__hash__":937},"docs\u002Fdocs\u002Fdecisions\u002F0031-content-server-accessor.md","🧭 Content is read on the server through useContent, not over a public route",{"type":120,"value":121,"toc":918},"minimark",[122,132,137,178,192,196,239,242,475,666,670,742,746,756,762,765,794,800,804],[123,124,126,127,131],"h1",{"id":125},"content-is-read-on-the-server-through-usecontent-not-over-a-public-route","🧭 Content is read on the server through ",[128,129,130],"code",{},"useContent",", not over a public route",[133,134,136],"h2",{"id":135},"context","Context",[138,139,140,143,144,147,148,151,152,154,155,158,159,162,163,165,166,173,174,177],"p",{},[128,141,142],{},"@joinery\u002Fcontent\u002Fnuxt"," mounted two public cached routes, ",[128,145,146],{},"GET \u002Fapi\u002Fcontent\u002F:resource"," and\n",[128,149,150],{},"\u002F:resource\u002F:slug",", and auto-imported a client ",[128,153,130],{}," that read them. It assumed pages render\n",[128,156,157],{},"Entry"," directly. Huella's rule is the opposite: a layer's ",[128,160,161],{},"server\u002F"," maps vendor shapes into view\nmodels \"so an ",[128,164,157],{}," never reaches the browser\" (",[167,168,170],"a",{"href":169},"repo:apps\u002Fhuella-legal\u002FCLAUDE%2Emd",[128,171,172],{},"AGENTS.md",").\nSo #240's article routes had no server-side way into the module, and they ",[128,175,176],{},"$fetch","ed its public\nroutes in-process: one Nitro server calling itself over h3.",[138,179,180,181,184,185,187,188,191],{},"That left a stopgap, ",[128,182,183],{},"layers\u002Farticles\u002Fserver\u002Futils\u002FfetchContent.ts",", which re-plumbed paths, casts\nand status codes. It also left two cache layers for one read, a public endpoint serving raw ",[128,186,157],{},"\nthat nothing needed, and a client composable whose only caller was the provisional ",[128,189,190],{},"\u002Fpublicaciones\u002F","\nscaffold. The question: what the package's Nuxt surface should be, given it must stay generic.",[133,193,195],{"id":194},"result","Result",[138,197,198,206,207,210,211,214,215,218,219,222,223,225,226,229,230,234,235,238],{},[199,200,201,202,205],"strong",{},"The module exposes one server-only, cached ",[128,203,204],{},"useContent(event)"," and no route."," It is a Nitro\nauto-import (",[128,208,209],{},"addServerImports",") with the port's four reads. Two module-scope ",[128,212,213],{},"defineCachedFunction","s\nback it: ",[128,216,217],{},"content-list"," and ",[128,220,221],{},"content-item",", group ",[128,224,72],{},", with the existing windows. Both are\nkeyed by ",[128,227,228],{},"contentKey(vendor, resource, query)",". Each read normalises and bounds its typed query\n",[231,232,233],"em",{},"before"," the cached call, builds the provider only on a miss, and maps domain errors to h3 statuses\nas the routes did. The public routes, ",[128,236,237],{},"CONTENT_API_PATH"," and the client composable are deleted.",[138,240,241],{},"Verified against nitropack 2.13.4, @nuxt\u002Fkit 4.5.2, h3 1.15.11, unstorage 1.17.5 and\n@nuxtjs\u002Fi18n 10.6.0. Line numbers are as of this report:",[243,244,245,258],"table",{},[246,247,248],"thead",{},[249,250,251,255],"tr",{},[252,253,254],"th",{},"Question",[252,256,257],{},"Finding",[259,260,261,308,324,346,361,373,405,434,452],"tbody",{},[249,262,263,275],{},[264,265,266,267,270,271,274],"td",{},"Does ",[128,268,269],{},"contentKey"," work as ",[128,272,273],{},"getKey","?",[264,276,277,278,280,281,284,285,288,289,292,293,296,297,300,301,303,304,307],{},"Yes. ",[128,279,213],{}," stores the key as given (",[128,282,283],{},"runtime\u002Finternal\u002Fcache.mjs:103","). Only ",[128,286,287],{},"defineCachedEventHandler"," runs ",[128,290,291],{},"escapeKey"," (",[128,294,295],{},":131-135","). unstorage's ",[128,298,299],{},"normalizeKey"," still cuts at ",[128,302,274],{}," and splits at ",[128,305,306],{},"\u002F \\ :",", so word-chars-only keys still matter",[249,309,310,313],{},[264,311,312],{},"Are errors cached?",[264,314,315,316,319,320,323],{},"No. A thrown read is never stored (",[128,317,318],{},":56-62","). A failed SWR refresh logs and keeps serving the stale value (",[128,321,322],{},":89-94",")",[249,325,326,329],{},[264,327,328],{},"Where does the event go?",[264,330,331,332,335,336,292,339,342,343,323],{},"First. The cache passes it to ",[128,333,334],{},"waitUntil"," only when ",[128,337,338],{},"isEvent(args[0])",[128,340,341],{},":86",", ",[128,344,345],{},":109",[249,347,348,351],{},[264,349,350],{},"Should the functions be defined per call?",[264,352,353,354,357,358,323],{},"No: in-flight dedupe is a ",[128,355,356],{},"pending"," map per definition (",[128,359,360],{},":23",[249,362,363,366],{},[264,364,365],{},"Memoise the provider?",[264,367,368,369,372],{},"No. It is built only inside the resolver, so once per miss, as before. That keeps vendor config validated at read time, and ",[128,370,371],{},"useRuntimeConfig(event)"," clones config per event, so there is no stable identity to memoise on",[249,374,375,378],{},[264,376,377],{},"Can the existing parsers bound typed input?",[264,379,380,381,384,385,388,389,392,393,396,397,400,401,404],{},"No. ",[128,382,383],{},"toText"," returns ",[128,386,387],{},"undefined"," for a non-string, so ",[128,390,391],{},"{ page: 2 }"," became page 1 and a typed ",[128,394,395],{},"term"," was dropped. ",[128,398,399],{},"runtime\u002Fserver\u002Futils\u002Fquery.ts"," replaces ",[128,402,403],{},"parsing.ts"," with typed checks",[249,406,407,414],{},[264,408,409,410,413],{},"Does the app's ",[128,411,412],{},"Article"," cache earn its keep?",[264,415,380,416,419,420,423,424,426,427,430,431],{},[128,417,418],{},"toArticle"," on a 53 KB body (the 0027 corpus average) takes 4.1 ms, and four ",[128,421,422],{},"toArticleSummary"," calls take 9.0 ms. Measured warm, locally. A second cache doubled the worst-case staleness, and its slug key went through ",[128,425,291],{},", which merges ",[128,428,429],{},"a-b"," with ",[128,432,433],{},"ab",[249,435,436,439],{},[264,437,438],{},"What did the public route expose?",[264,440,441,442,342,445,448,449],{},"Raw, unsanitised vendor HTML. Its key space was bounded on page, perPage and search length only: every distinct ",[128,443,444],{},"slug",[128,446,447],{},"author"," or term id cached its own empty ",[128,450,451],{},"Page",[249,453,454,457],{},[264,455,456],{},"Is i18n the same case?",[264,458,459,460,292,463,466,467,470,471,474],{},"Same shape, different stakes. The browser fetches ",[128,461,462],{},"\u002F_i18n\u002F\u003Chash>\u002F\u003Clocale>\u002Fmessages.json",[128,464,465],{},"@nuxtjs\u002Fi18n"," ",[128,468,469],{},"runtime\u002Fcontext.js:131","), whose server route runs our loader, which self-fetches ",[128,472,473],{},"\u002Fapi\u002Ftranslations\u002F:locale",". Translations are public by design and there is no client composable, so nothing leaks. Left as is",[243,476,477,490],{},[246,478,479],{},[249,480,481,484,487],{},[252,482,483],{},"#",[252,485,486],{},"File",[252,488,489],{},"Change",[259,491,492,509,530,552,582,607,631,650],{},[249,493,494,497,503],{},[264,495,496],{},"1",[264,498,499,502],{},[128,500,501],{},"packages\u002Fcontent\u002Fsrc\u002Fnuxt\u002Fruntime\u002Fserver\u002Futils\u002FuseContent.ts"," (new)",[264,504,505,506],{},"The accessor and its two cached functions. Error mapping moved here from ",[128,507,508],{},"request.ts",[249,510,511,513,518],{},[264,512,87],{},[264,514,515,502],{},[128,516,517],{},"packages\u002Fcontent\u002Fsrc\u002Fnuxt\u002Fruntime\u002Fserver\u002Futils\u002Fquery.ts",[264,519,520,342,523,342,526,529],{},[128,521,522],{},"toQuery",[128,524,525],{},"toEntryQuery",[128,527,528],{},"toSlug",": defaults, ceilings, trimmed text, known taxonomy, non-empty ids",[249,531,532,535,543],{},[264,533,534],{},"3",[264,536,537,342,540],{},[128,538,539],{},"packages\u002Fcontent\u002Fsrc\u002Fnuxt\u002Fmodule.ts",[128,541,542],{},"config.ts",[264,544,545,546,548,549,551],{},"One ",[128,547,209],{},". ",[128,550,237],{}," is gone",[249,553,554,556,573],{},[264,555,64],{},[264,557,558,342,561,342,564,342,567,342,570],{},[128,559,560],{},"content.get.ts",[128,562,563],{},"contentItem.get.ts",[128,565,566],{},"utils\u002Frequest.ts",[128,568,569],{},"utils\u002Fparsing.ts",[128,571,572],{},"composables\u002F*",[264,574,575,576,218,579],{},"Deleted. Their spec cases moved to ",[128,577,578],{},"useContent.spec.ts",[128,580,581],{},"query.spec.ts",[249,583,584,586,594],{},[264,585,33],{},[264,587,588,342,591],{},[128,589,590],{},"apps\u002Fhuella-legal\u002Flayers\u002Farticles\u002Fserver\u002Fapi\u002Farticles\u002F[slug].get.ts",[128,592,593],{},"[slug]\u002Frelated.get.ts",[264,595,596,599,600,602,603,606],{},[128,597,598],{},"defineEventHandler"," over ",[128,601,204],{},". The slug is read with ",[128,604,605],{},"{ decode: true }",", since nothing re-encodes it now",[249,608,609,612,617],{},[264,610,611],{},"6",[264,613,614,502],{},[128,615,616],{},"…\u002Fapi\u002Farticles\u002Findex.get.ts",[264,618,619,622,623,626,627,630],{},[128,620,621],{},"Page\u003CArticleSummary>",". Only ",[128,624,625],{},"page"," is forwarded; ",[128,628,629],{},"perPage"," is fixed at 6",[249,632,633,636,641],{},[264,634,635],{},"7",[264,637,638],{},[128,639,640],{},"…\u002Fapp\u002Fpages\u002Farticles\u002Findex.vue",[264,642,643,646,647],{},[128,644,645],{},"useFetch(\"\u002Fapi\u002Farticles\")",". Renders summaries as text, with no ",[128,648,649],{},"v-html",[249,651,652,655,663],{},[264,653,654],{},"8",[264,656,657,342,660],{},[128,658,659],{},"…\u002Fserver\u002Fcache.ts",[128,661,662],{},"…\u002Fserver\u002Futils\u002FfetchContent.ts",[264,664,665],{},"Deleted",[133,667,669],{"id":668},"options-considered","Options considered",[243,671,672,682],{},[246,673,674],{},[249,675,676,679],{},[252,677,678],{},"Option",[252,680,681],{},"Why not",[259,683,684,692,703,718,732],{},[249,685,686,689],{},[264,687,688],{},"Keep the routes and add a server helper over them",[264,690,691],{},"Formalises the self-call. Paths, query strings, casts and status codes still serialise and re-parse inside one process, and the public raw endpoint stays",[249,693,694,697],{},[264,695,696],{},"Routes and client composable behind a module option",[264,698,699,700,702],{},"Config, specs and docs for a surface with no consumer. A browser-facing route is a few lines in an app over ",[128,701,130],{},", where the app decides what the browser gets",[249,704,705,712],{},[264,706,707,708,711],{},"An uncached ",[128,709,710],{},"useContentProvider",", with each app caching its view models",[264,713,714,715,717],{},"Every app would re-derive keys and ceilings, the very thing ",[128,716,269],{}," exists to stop. The expensive part is the upstream round trip, not a 4 ms mapping",[249,719,720,726],{},[264,721,722,723,725],{},"Keep the app's ",[128,724,412],{}," and related caches on top",[264,727,728,729,731],{},"Up to 12 h before a correction shows, two key families to purge, and the ",[128,730,291],{}," collisions above — all to save single-digit milliseconds",[249,733,734,739],{},[264,735,736,737],{},"A separate server name beside the client ",[128,738,130],{},[264,740,741],{},"Two functions with one job and a confusing pair of names",[133,743,745],{"id":744},"consequences","Consequences",[138,747,748,749,752,753,755],{},"Server code reads content with typed calls and no plumbing, and nothing raw has a public URL. The\ncost is that every browser-facing read needs an app route. #241 (C2) extends ",[128,750,751],{},"GET \u002Fapi\u002Farticles","\nwith filters rather than writing it, and #248 (C5) searches through a route over ",[128,754,130],{},".",[138,757,758,759,761],{},"#236 gets simpler. There is one cache layer, so the worst case for a correction to reach a post\nfalls from about 12 h to 6 h. A purge touches one key family, the ",[128,760,72],{}," group, whose key format\nonly the package knows.",[138,763,764],{},"Two earlier reports describe what no longer exists, and neither is edited, since each is a record of\nits own decision:",[766,767,768,784],"ul",{},[769,770,771,775,776,779,780,783],"li",{},[167,772,774],{"href":773},"\u002Fwiki\u002Fdocs\u002Fdecisions\u002F0030-huella-legal-rendering-hosting-and-cost","0030","'s ",[128,777,778],{},"\u002Fapi\u002Fcontent\u002F**"," route rule and its\nfinding that \"browsers fetch ",[128,781,782],{},"\u002Fapi\u002Fcontent\u002F*","\". F1 should drop both.",[769,785,786,790,791,793],{},[167,787,789],{"href":788},"\u002Fwiki\u002Fdocs\u002Fdecisions\u002F0027-huella-legal-content-model","0027","'s change 11, which had the article route build its\nown provider. ",[128,792,130],{}," is now that route's entry point.",[138,795,796,797,799],{},"Revisit if a consumer genuinely needs raw ",[128,798,157],{}," in the browser. That is an app route, not a\npackage one. Revisit also if Nitro starts escaping function keys or changes where it reads the event.",[133,801,803],{"id":802},"confirmation","Confirmation",[243,805,806,816],{},[246,807,808],{},[249,809,810,813],{},[252,811,812],{},"Claim",[252,814,815],{},"Check",[259,817,818,835,852,862,873,890,905],{},[249,819,820,825],{},[264,821,822,823],{},"No public content route, and no client ",[128,824,130],{},[264,826,827,830,831,834],{},[128,828,829],{},"grep -rl \"api\u002Fcontent\" apps\u002Fhuella-legal\u002F.output"," after ",[128,832,833],{},"pnpm exec nx build @joinery\u002Fhuella-legal"," prints nothing",[249,836,837,840],{},[264,838,839],{},"Bounds run before a key exists, and typed input survives normalising",[264,841,842,845,846,848,849,851],{},[128,843,844],{},"pnpm exec nx test @joinery\u002Fcontent",": ",[128,847,578],{}," \"refuses … without keying it\", ",[128,850,581],{}," \"keeps the page that was asked for\" and \"keeps the term and the author\"",[249,853,854,857],{},[264,855,856],{},"Defaults collapse to one entry",[264,858,859,861],{},[128,860,578],{}," \"gives %o the same entry as the first page\"",[249,863,864,867],{},[264,865,866],{},"The module registers a server import and no route",[264,868,869,872],{},[128,870,871],{},"module.spec.ts"," \"auto-imports useContent into server code\"",[249,874,875,878],{},[264,876,877],{},"Article routes read decoded slugs and cache nothing themselves",[264,879,880,845,883,886,887,834],{},[128,881,882],{},"pnpm exec nx test @joinery\u002Fhuella-legal",[128,884,885],{},"[slug].get.spec.ts"," \"its slug decoded\". ",[128,888,889],{},"git grep defineCachedEventHandler apps\u002Fhuella-legal\u002Flayers",[249,891,892,895],{},[264,893,894],{},"The listing, the article and its 404 still work end to end",[264,896,897,900,901,904],{},[128,898,899],{},"pnpm exec playwright test"," in ",[128,902,903],{},"apps\u002Fhuella-legal"," after a build",[249,906,907,913],{},[264,908,909,910],{},"The browser never fetches ",[128,911,912],{},"\u002Fapi\u002Ftranslations",[264,914,915,834],{},[128,916,917],{},"grep -rl \"api\u002Ftranslations\" apps\u002Fhuella-legal\u002F.output\u002Fpublic",{"title":919,"searchDepth":920,"depth":920,"links":921},"",2,[922,923,924,925,926],{"id":135,"depth":920,"text":136},{"id":194,"depth":920,"text":195},{"id":668,"depth":920,"text":669},{"id":744,"depth":920,"text":745},{"id":802,"depth":920,"text":803},"md",null,{"issue":930,"status":931,"decision":932},240,"implemented","accepted",true,"\u002Fdocs\u002Fdecisions\u002F0031-content-server-accessor",{"title":118,"description":919},"docs\u002Fdecisions\u002F0031-content-server-accessor","wloyACW_awbwK2QC7HMfP94g56v_vgTmAqDCd5Soh3Q",1795478396819]