Files
Febe/tests/Febe.Tests/Collection/Support/SettledCatalog.cs
T
Alby96andClaude Opus 5.5 76dd1b6032
verifica / controlli (push) Successful in 17s
verifica / prove (push) Successful in 18m22s
verifica / installatore (push) Successful in 4m43s
verifica / immagine (push) Successful in 17m20s
Giunto per le richieste dirette, senza cambiare comportamento (#36, S1)
Le risposte catturate dal browser e quelle che il client del sito chiederà
devono arrivare ai lettori e ai segnali nello stesso modo: la consegna passa
in ResponseDelivery (Core), che ResponseTap usa con gli stessi conteggi e
messaggi. Arrivano i contratti SiteRequest, SiteAnswer e ISiteRequester con
SiteRequestGuard (un permesso concesso, della categoria giusta, per una sola
richiesta) e RequestCatalog, che legge richieste.<sito>.json e tiene nel
codice i divieti: nomi con Mutation, chat, telemetria, /ajax/, /ws/, percorsi
con segmenti strani. Nessun doc_id nel repository; nessuna operazione di
Instagram è ancora configurata perché le forme della sonda non dicono da dove
vengano alcuni campi (tappa S4). ScriptedRequester risponde dai campioni
ripuliti per le prove. Nulla di nuovo è collegato al motore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:59:32 +01:00

51 lines
2.1 KiB
C#

using System.Text.Json.Nodes;
using Febe.Core.Collection;
using Febe.Core.Collection.Requests;
namespace Febe.Tests.Collection.Support;
/// <summary>
/// The shipped Instagram catalog as tappa S4 will leave it for some operations: their headers and fields with a
/// «pending» source dropped and the operation configured. Only for the tests of the site client contract, which need
/// an Instagram operation the guard lets through; the shipped file keeps them not configured (rule 9).
/// </summary>
public static class SettledCatalog
{
/// <summary>The operations whose variables the shapes show whole (only the headers and fields wait for S4).</summary>
public static IReadOnlyList<string> KnownVariables { get; } =
[
"PolarisProfileReelsTabContentQuery", "PolarisProfileTaggedTabContentQuery",
"PolarisProfileStoryHighlightsTrayContentQuery", "media-info",
];
/// <summary>The Instagram catalog with <paramref name="names"/> (by default <see cref="KnownVariables"/>) settled.</summary>
public static RequestCatalog Instagram(params string[] names)
{
var settle = names.Length == 0 ? KnownVariables : names;
var file = JsonNode.Parse(SiteMap.ReadEmbeddedText("richieste.instagram.json"))!.AsObject();
foreach (var operation in file["operations"]!.AsArray().Select(o => o!.AsObject()))
{
if (!settle.Contains(operation["name"]!.GetValue<string>()))
{
continue;
}
foreach (var part in new[] { "headers", "body" })
{
if (operation[part] is JsonObject sources)
{
foreach (var key in sources.Where(s => s.Value?.GetValue<string>() == "pending").Select(s => s.Key).ToList())
{
sources.Remove(key);
}
}
}
operation["configured"] = true;
operation.Remove("reason");
}
return RequestCatalog.Parse(file.ToJsonString(), "richieste.instagram.json (sistemato per le prove)");
}
}